Skip to content

Commit da482cf

Browse files
committed
brightbox: initial commit
Signed-off-by: Mathieu Tortuyaux <[email protected]>
1 parent 568d8c4 commit da482cf

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

content/docs/latest/_index.md

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ platforms and bare metal servers.
2929
* [DigitalOcean][digital-ocean]
3030
* [Hetzner][hetzner]
3131
* [OpenStack][openstack]
32+
* [Brightbox][brightbox]
3233

3334
#### Virtualization options
3435
It's easy to run a local Flatcar VM on your laptop for testing and debugging
@@ -240,6 +241,7 @@ Flatcar tutorial to deep dive into some Flatcar fundamental concepts.
240241
[sysext]: provisioning/sysext/
241242
[acpi]: setup/customization/ACPI
242243
[openstack]: installing/cloud/openstack
244+
[brightbox]: installing/cloud/brightbox
243245
[kubernetes]: container-runtimes/getting-started-with-kubernetes
244246
[using-nvidia]: setup/customization/using-nvidia
245247
[tutorial-introduction]: tutorial/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: Running Flatcar on Brightbox
3+
linktitle: Running on Brightbox
4+
weight: 10
5+
---
6+
7+
## Import the image
8+
9+
While Brightbox provides Flatcar images for Beta, Stable and LTS channels it is possible to import your own Flatcar image in Brightbox using the [CLI][cli].
10+
11+
For example, to upload the Alpha channel of Flatcar:
12+
13+
```bash
14+
$ brightbox images register \
15+
--arch=x86_64 --name=flatcar-alpha \
16+
--url=https://alpha.release.flatcar-linux.net/amd64-usr/current/flatcar_production_openstack_image.img
17+
$ brightbox images list --type=upload
18+
id owner type created_on status size name
19+
---------------------------------------------------------------------------------
20+
img-xoufd acc-jg5aa upload 2023-12-05 private 8694 flatcar-alpha (x86_64)
21+
---------------------------------------------------------------------------------
22+
```
23+
24+
## Butane Configs
25+
26+
Flatcar allows you to configure machine parameters, launch systemd units on startup and more via Butane Configs. These configs are then transpiled into Ignition JSON configs and given to booting machines. Jump over to the [docs to learn about the supported features][butane-configs]. We're going to provide our Butane Config to Brightbox via the user-data flag. Our Butane Config will also contain SSH keys that will be used to connect to the instance.
27+
28+
As an example, this Butane YAML config will start an Nginx Docker container and display the instance hostname:
29+
30+
```yaml
31+
variant: flatcar
32+
version: 1.0.0
33+
passwd:
34+
users:
35+
- name: core
36+
ssh_authorized_keys:
37+
- ssh-rsa ABCD...
38+
storage:
39+
directories:
40+
- path: /var/www
41+
systemd:
42+
units:
43+
- name: nginx.service
44+
enabled: true
45+
contents: |
46+
[Unit]
47+
Description=NGINX example
48+
After=docker.service coreos-metadata.service
49+
Requires=docker.service coreos-metadata.service
50+
[Service]
51+
EnvironmentFile=/run/metadata/flatcar
52+
TimeoutStartSec=0
53+
ExecStartPre=-/usr/bin/docker rm --force nginx1
54+
ExecStartPre=-/usr/bin/bash -c "echo 'Hello from ${COREOS_OPENSTACK_HOSTNAME}' > /var/www/index.html"
55+
ExecStart=/usr/bin/docker run --name nginx1 --volume "/var/www:/usr/share/nginx/html:ro" --pull always --log-driver=journald --net host docker.io/nginx:1
56+
ExecStop=/usr/bin/docker stop nginx1
57+
Restart=always
58+
RestartSec=5s
59+
[Install]
60+
WantedBy=multi-user.target
61+
```
62+
63+
Transpile it to Ignition JSON:
64+
65+
```bash
66+
cat butane.yaml | docker run --rm -i quay.io/coreos/butane:release > ignition.json
67+
```
68+
69+
The `coreos-metadata.service` saves metadata variables to `/run/metadata/flatcar`. Systemd units can use them with `EnvironmentFile=/run/metadata/flatcar` in the `[Service]` section when setting `Requires=coreos-metadata.service` and `After=coreos-metadata.service` in the `[Unit]` section.
70+
71+
## Launch machine
72+
73+
Boot the machines with the CLI, referencing the image ID from the import step above and your [JSON file from ct][cl-configs]:
74+
75+
```shell
76+
$ brightbox servers create --cloud-ip=true --user-data-file=./config.json img-xoufd
77+
```
78+
79+
Your first Flatcar instance should now be running. The only thing left to do is find an IP and SSH in.
80+
81+
```shell
82+
$ brightbox servers show $THE_INSTANCE_ID
83+
...
84+
cloud_ipv4s: 109.107.37.145
85+
...
86+
```
87+
88+
Finally SSH into an instance, note that the user is `core`:
89+
90+
```shell
91+
$ curl 109.107.37.145
92+
Hello from srv-f0lo3.gb1.brightbox.com
93+
94+
core@srv-f0lo3 ~ $
95+
core@srv-f0lo3 ~ $ systemctl status nginx
96+
● nginx.service - NGINX example
97+
Loaded: loaded (/etc/systemd/system/nginx.service; enabled; preset: enabled)
98+
Active: active (running) since Tue 2023-12-05 16:25:06 UTC; 1min 53s ago
99+
...
100+
```
101+
102+
## Using Flatcar Container Linux
103+
104+
Now that you have a machine booted it is time to play around. Check out the [Flatcar Container Linux Quickstart][quickstart] guide or dig into [more specific topics][doc-index].
105+
106+
[cli]: https://www.brightbox.com/docs/reference/clig
107+
[quickstart]: ../
108+
[doc-index]: ../../
109+
[butane-configs]: ../../provisioning/config-transpiler

0 commit comments

Comments
 (0)