Skip to content

Commit 0b87f2e

Browse files
authored
Merge pull request #368 from John15321/master
Refactor Tutorial section for improved clarity and structure
2 parents 6da7925 + 37cec16 commit 0b87f2e

File tree

6 files changed

+205
-93
lines changed

6 files changed

+205
-93
lines changed

content/docs/latest/contribute/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Submit fixes and additions in the form of [GitHub *Pull Requests* (PRs)][pull-re
1010

1111
1. Fork this repository into your GitHub account
1212
2. Make changes in a topic branch or your fork's `master`
13-
3. Send a Pull Request from that topic branch to flatcar-linux/docs
13+
3. Send a Pull Request from that topic branch to flatcar/flatcar-website
1414
4. Maintainers will review the PR and either merge it or make comments
1515

1616
Cognizance of the tribal customs described and linked to below will help get your contributions incorporated with the greatest of ease.

content/docs/latest/tutorial/_index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ weight: 2
66

77
# Introduction
88

9-
This tutorial is a deep dive into some Flatcar fundamental concepts, it is designed to give you the key elements and resources to become autonomous with Flatcar. If you want to have a quickstart, please have a look to the [quickstart guide][quickstart].
9+
This tutorial is a deep dive into some Flatcar fundamental concepts, it is designed to give you the key elements and resources to become autonomous with Flatcar. If you want to have a quickstart, please have a look to the [Quickstart Guide][quickstart].
1010

1111
# Requirements
1212

1313
* Linux VM with nested virtualization (or Linux host with KVM)
14-
* `qemu`
15-
* `terraform` (https://developer.hashicorp.com/terraform/downloads)
16-
* `butane` (can be used from the Docker image or directly from the binary: https://coreos.github.io/butane/getting-started/#getting-butane)
17-
* (OpenStack credentials for the "Hands-on 3")
14+
* `qemu` ([Installing QEMU Guide](https://www.qemu.org/download/))
15+
* `terraform` ([Installing Terraform Guide](https://developer.hashicorp.com/terraform/downloads))
16+
* `butane` (can be used from the Docker image or [directly from the binary](https://coreos.github.io/butane/getting-started/#getting-butane))
17+
* OpenStack credentials for the [Hands-on 3](https://www.flatcar.org/docs/latest/tutorial/hands-on-3/)
1818

1919
For each covered item, there is a demo and a few lines to explain what's going on under the hood - each item is independent, but it's recommended to follow them in the given order, especially if it is your first time operating Flatcar.
2020

content/docs/latest/tutorial/hands-on-1/_index.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,57 @@ weight: 2
55
---
66

77
The goal of this hands-on is to:
8-
* locally run a Flatcar instance
9-
* boot the instance and SSH into
10-
* run Nginx container on the instance
8+
9+
* Locally run a Flatcar instance
10+
* Boot the instance and SSH into
11+
* Run Nginx container on the instance
1112

1213
# Step-by-step
1314

15+
Create a working directory:
16+
1417
```bash
15-
# create a working directory
1618
mkdir flatcar; cd flatcar
17-
# get the qemu helper
19+
```
20+
21+
Get the qemu helper:
22+
23+
```bash
1824
wget https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu.sh
19-
# get the latest stable release for qemu
25+
```
26+
27+
Get the latest stable release for qemu:
28+
29+
```bash
2030
wget https://stable.release.flatcar-linux.net/amd64-usr/current/flatcar_production_qemu_image.img
21-
# create a backup to always have a fresh image around
31+
```
32+
33+
Create a backup to always have a fresh image around:
34+
35+
```bash
2236
mv flatcar_production_qemu_image.img flatcar_production_qemu_image.img.fresh
23-
# make the qemu helper executable
37+
```
38+
39+
Make the qemu helper executable:
40+
41+
```bash
2442
chmod +x flatcar_production_qemu.sh
25-
# before starting, make sure you boot a fresh image
43+
```
44+
45+
Before starting, make sure you boot a fresh image:
46+
47+
```bash
2648
cp -i --reflink=auto flatcar_production_qemu_image.img.fresh flatcar_production_qemu_image.img
27-
# starts the flatcar image in console mode
49+
```
50+
51+
Starts the flatcar image in console mode:
52+
53+
```bash
2854
./flatcar_production_qemu.sh -- -display curses
2955
```
3056

31-
NOTE: it's possible to connect to the instance via SSH:
57+
**_NOTE_**: it's possible to connect to the instance via SSH:
58+
3259
```bash
3360
$ cat ~/.ssh/config
3461
Host flatcar
@@ -41,18 +68,23 @@ $ ssh flatcar
4168
```
4269

4370
Once on the instance, you can try things and run a docker image:
44-
```
45-
# run an nginx docker image
71+
72+
```bash
4673
docker run --rm -p 80:80 -d nginx
47-
# assert it works
74+
```
75+
76+
Assert it works:
77+
78+
```bash
4879
curl localhost
4980
```
5081

5182
# Resources
5283

53-
* [documentation](../../installing/vms/qemu/#startup-flatcar-container-linux)
84+
* [Hands on 2](../../tutorial/hands-on-2/)
85+
* [Startup Flatcar Container Linux ](../../installing/vms/qemu/#startup-flatcar-container-linux)
5486

5587
# Demo
5688

57-
* Video with timestamp: https://youtu.be/woZlGiLsKp0?t=472
58-
* Asciinema: https://asciinema.org/a/591438
89+
* Video with timestamp: <https://youtu.be/woZlGiLsKp0?t=472>
90+
* Asciinema: <https://asciinema.org/a/591438>

content/docs/latest/tutorial/hands-on-2/_index.md

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,77 @@ weight: 2
55
---
66

77
The goal of this hands-on is to:
8-
* provision a local Flatcar instance
9-
* write Butane configuration
10-
* generate the Ignition configuration
11-
* boot the instance with the config
128

13-
This is what we've done in the previous hands-on but now it's done _as code_, we want to deploy an Nginx container serving a "hello world" static webpage. As a reminder, Ignition configuration is used to provision a Flatcar instance, it's JSON file generated from a Butane configuration (YAML).
9+
* Provision a local Flatcar instance
10+
* Write Butane configuration
11+
* Generate the Ignition configuration
12+
* Boot the instance with the config
13+
14+
This is what we've done in the previous hands-on but now it's done _as code_, we want to deploy an Nginx container serving a "hello world" static webpage. As a reminder, Ignition configuration is used to provision a Flatcar instance, it's a JSON file generated from a Butane YAML configuration.
1415

1516
# Step-by-step
1617

17-
* Clone the tutorial repository and cd into it: `git clone https://github.com/flatcar/flatcar-tutorial ; cd flatcar-tutorial/hands-on-2`
18-
* Open `./config.yaml` and find the TODO section.
19-
* Add the following section (from https://coreos.github.io/butane/examples/#files):
18+
Clone the tutorial repository and cd into it:
19+
20+
```bash
21+
git clone https://github.com/flatcar/flatcar-tutorial ; cd flatcar-tutorial/hands-on-2
2022
```
23+
24+
Open `./config.yaml`, find the TODO section, and add the following section:
25+
26+
```bash
2127
storage:
2228
files:
2329
- path: /var/www/index.html
2430
contents:
2531
inline: Hello world
2632
```
27-
* Transpile the Butane configuration (`config.yaml`) to Ignition configuration (`config.json`) - it is possible to use the Butane [binary](https://coreos.github.io/butane/getting-started/#standalone-binary) or the Docker image
28-
```
29-
$ docker run --rm -i quay.io/coreos/butane:latest < config.yaml > config.json
30-
```
31-
* Use a fresh Flatcar image from the previous hands-on (or download again). NOTE: Ignition runs at first boot, it won't work if you reuse your the previously booted image, always decompress again each time you change your Ignition config.
33+
34+
**_NOTE_**: More [Butane Config Examples](https://www.flatcar.org/docs/latest/provisioning/config-transpiler/examples/) and [Common Setup, Operations and Customization](https://www.flatcar.org/docs/latest/setup).
35+
36+
Transpile the Butane configuration (`config.yaml`) to Ignition configuration (`config.json`) - it is possible to use the Butane [binary](https://coreos.github.io/butane/getting-started/#standalone-binary) or the Docker image
37+
38+
```bash
39+
docker run --rm -i quay.io/coreos/butane:latest < config.yaml > config.json
3240
```
41+
42+
Use a fresh Flatcar image from the previous hands-on (or download again). NOTE: Ignition runs at first boot, it won't work if you reuse the previously booted image, always start from a pristine image.
43+
44+
```bash
3345
cp -i --reflink=auto ../hands-on-1/flatcar_production_qemu_image.img.fresh flatcar_production_qemu_image.img
3446
chmod +x flatcar_production_qemu.sh
3547
```
36-
* Start the image with Ignition configuration (`-i ./config.json`)
37-
```
48+
49+
Start the image with Ignition configuration (`-i ./config.json`)
50+
51+
```bash
3852
./flatcar_production_qemu.sh -i ./config.json -- -display curses
3953
```
40-
* Once on the instance, assert nginx works correctly (`curl localhost` or `systemctl status nginx.service`)
54+
55+
Once on the instance, assert nginx works correctly:
56+
57+
58+
```bash
59+
curl localhost
60+
```
61+
62+
or
63+
64+
```bash
65+
systemctl status nginx.service
66+
```
4167

4268
# Resources
4369

44-
* https://coreos.github.io/butane/examples/
45-
* https://coreos.github.io/ignition/rationale/
46-
* https://www.flatcar.org/docs/latest/installing/#concepts-configuration-and-provisioning
70+
* [Hands on 3](../../tutorial/hands-on-3/)
71+
* [More Butane Config Examples](https://www.flatcar.org/docs/latest/provisioning/config-transpiler/examples/)
72+
* [Common Setup, Operations and Customization](https://www.flatcar.org/docs/latest/setup)
73+
* [More On Butane Config Transpiler](https://www.flatcar.org/docs/latest/provisioning/config-transpiler/)
74+
* [Concepts, Configuration, and Provisioning](https://www.flatcar.org/docs/latest/installing/#concepts-configuration-and-provisioning)
75+
* <https://coreos.github.io/butane/examples/>
76+
* <https://coreos.github.io/ignition/rationale/>
4777

4878
# Demo
4979

50-
* Video with timestamp: https://youtu.be/woZlGiLsKp0?t=676
51-
* Asciinema: https://asciinema.org/a/591440
80+
* Video with timestamp: <https://youtu.be/woZlGiLsKp0?t=676>
81+
* Asciinema: <https://asciinema.org/a/591440>

content/docs/latest/tutorial/hands-on-3/_index.md

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,75 @@ weight: 2
55
---
66

77
The goal of this hands-on is to:
8-
* deploy Flatcar instances with IaC (Terraform)
9-
* manipulate Terraform code
10-
* write Flatcar provisioning with Terraform
11-
* deploy Flatcar on OpenStack with Terraform
8+
9+
* Deploy Flatcar instances with IaC (Terraform)
10+
* Manipulate Terraform code
11+
* Write Flatcar provisioning with Terraform
12+
* Deploy Flatcar on OpenStack with Terraform
1213

1314
This is a bundle of hands-on-1 and hands-on-2 but it's not a local deployment and _everything_ is as code.
1415

1516
# Step-by-step
1617

18+
19+
Clone the tutorial repository and cd into it:
20+
1721
```bash
1822
git clone https://github.com/flatcar/flatcar-tutorial; cd flatcar-tutorial/hands-on-3
19-
# go into the terraform directory
23+
```
24+
25+
Go into the terraform directory
26+
27+
```bash
2028
cd terraform
21-
# update the config for creating index.html from previous hands-on
29+
```
30+
31+
Update the config for creating index.html from previous hands-on:
32+
33+
```bash
2234
vim server-configs/server1.yaml
23-
# init the terraform project locally
35+
```
36+
37+
Initialize the terraform project locally:
38+
39+
```bash
2440
terraform init
25-
# get the credentials and update the `terraform.tfvars` consequently
26-
# generate the plan and inspect it
41+
```
42+
43+
Get the credentials and update the `terraform.tfvars` consequently generate the plan and inspect it:
44+
45+
```bash
2746
terraform plan
28-
# apply the plan
47+
```
48+
49+
Apply the plan:
50+
51+
```bash
2952
terraform apply
30-
# go on the horizon dashboard and connect with terraform credentials
31-
# find your instance
3253
```
3354

34-
One can assert that it works by accessing the console (click on the instance then "console")
55+
Go on the horizon dashboard and connect with terraform credentials find your instance.
56+
One can assert that it works by accessing the console (click on the instance then "console").
3557

3658
_NOTE_: it's possible to SSH into the instance but at the moment, it takes a SSH jump through the openstack (devstack) instance.
37-
```
59+
60+
```bash
3861
ssh -J user@[DEVSTACK-IP] -i ./.ssh/provisioning_private_key.pem -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null core@[SERVER-IP]
3962
```
4063

41-
To destroy the instance:
42-
```
43-
# if you are happy, destroy everything
64+
In order to destroy the instance:
65+
66+
```bash
4467
terraform destroy
4568
```
4669

4770
# Resources
4871

49-
* https://github.com/flatcar/flatcar-terraform/ (NOTE: the terraform code used here is based on this repository)
50-
* https://www.flatcar.org/docs/latest/installing/cloud/openstack/
72+
* [Hands on 4](../../tutorial/hands-on-4/)
73+
* [Running Flatcar Container Linux on OpenStack](https://www.flatcar.org/docs/latest/installing/cloud/openstack/)
74+
* <https://github.com/flatcar/flatcar-terraform/> (__NOTE__: the terraform code used here is based on this repository)
5175

5276
# Demo
5377

54-
* Video with timestamp: https://youtu.be/woZlGiLsKp0?t=1395
55-
* Asciinema: https://asciinema.org/a/591442
56-
57-
78+
* Video with timestamp: <https://youtu.be/woZlGiLsKp0?t=1395>
79+
* Asciinema: <https://asciinema.org/a/591442>

0 commit comments

Comments
 (0)