From 936dc923d76c09c6f5ea85a58b91e1fa6967e3b1 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Fri, 19 Apr 2024 17:21:41 +0200 Subject: [PATCH] community-platforms: add scaleway Signed-off-by: Mathieu Tortuyaux --- .../installing/community-platforms/_index.md | 2 + .../community-platforms/scaleway.md | 95 +++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 content/docs/latest/installing/community-platforms/scaleway.md diff --git a/content/docs/latest/installing/community-platforms/_index.md b/content/docs/latest/installing/community-platforms/_index.md index 8aa6b719..63f70583 100644 --- a/content/docs/latest/installing/community-platforms/_index.md +++ b/content/docs/latest/installing/community-platforms/_index.md @@ -16,6 +16,7 @@ The platforms and providers listed below each provide support and documentation * [Exoscale][exoscale] * [Rackspace Cloud][rackspace] +* [Scaleway][scaleway] * [Vultr VPS][vultr] ## Other providers @@ -28,6 +29,7 @@ The platforms and providers listed below each provide support and documentation [rackspace]: rackspace [vultr]: vultr [eucalyptus]: eucalyptus +[scaleway]: scaleway [vagrant]: ../vms/vagrant [virtualbox]: ../vms/virtualbox [official-support]: ../../ diff --git a/content/docs/latest/installing/community-platforms/scaleway.md b/content/docs/latest/installing/community-platforms/scaleway.md new file mode 100644 index 00000000..15d6349a --- /dev/null +++ b/content/docs/latest/installing/community-platforms/scaleway.md @@ -0,0 +1,95 @@ +--- +title: Running Flatcar on Scaleway +linktitle: Running on Scaleway +weight: 10 +--- + +These instructions will walk you through using Flatcar on [Scaleway][scaleway], importing an image, and running your first server using the command line interface. Please note that Scaleway is a community supported platform at the moment which means that the CI do not run on Scaleway images. + +## Import the image + +_Note_: This getting started assumes that Scaleway and AWS CLI are already installed and properly configured. + +It is possible to import your own Flatcar image in Scaleway using the [CLI][cli]. The process is done in two steps: +1. Upload Flatcar image on Scaleway S3 bucket +2. Create a snapshot from the S3 object + +For example, to upload an image from the Flatcar Beta channel: + +```bash +$ wget https://beta.release.flatcar-linux.net/amd64-usr/current/flatcar_production_scaleway_image.img.bz2 +$ bzip2 --decompress ./flatcar_production_scaleway_image.img.bz2 +$ mv flatcar_production_scaleway_image.{img,qcow2} +$ aws s3api create-bucket --bucket flatcar +$ aws s3 cp flatcar_production_scaleway_image.qcow2 s3://flatcar/flatcar_production_scaleway_image.qcow2 +$ scw instance snapshot create --wait \ + zone=fr-par-1 name=flatcar-beta volume-type=l_ssd \ + bucket=flatcar key=flatcar_production_scaleway_image.qcow2 +ID 1ead5e70-7e51-46bd-af3a-ca2d2fd9a8f2 +Name flatcar-beta +Organization edca8b74-84f7-4a92-a8d6-0ea2eb816cb0 +Project edca8b74-84f7-4a92-a8d6-0ea2eb816cb0 +VolumeType l_ssd +Size 8.5 GiB +State available +CreationDate 2 minutes ago +ModificationDate 1 second ago +Zone fr-par-1 +``` + +## Butane Configs + +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 Scaleway via the user-data flag. Our Butane Config will also contain SSH keys that will be used to connect to the instance. + +As an example, this Butane YAML config will start an Nginx Docker container and display the instance hostname: + +```yaml +variant: flatcar +version: 1.0.0 +passwd: + users: + - name: core + ssh_authorized_keys: + - ssh-rsa ABCD... +storage: + directories: + - path: /var/www +systemd: + units: + - name: nginx.service + enabled: true + contents: | + [Unit] + Description=NGINX example + After=docker.service coreos-metadata.service + Requires=docker.service coreos-metadata.service + [Service] + EnvironmentFile=/run/metadata/flatcar + TimeoutStartSec=0 + ExecStartPre=-/usr/bin/docker rm --force nginx1 + ExecStartPre=-/usr/bin/bash -c "echo 'Hello from ${COREOS_OPENSTACK_HOSTNAME}' > /var/www/index.html" + 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 + ExecStop=/usr/bin/docker stop nginx1 + Restart=always + RestartSec=5s + [Install] + WantedBy=multi-user.target +``` + +Transpile it to Ignition JSON: + +```bash +cat butane.yaml | docker run --rm -i quay.io/coreos/butane:release > ignition.json +``` + +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. + +## Using Flatcar Container Linux + +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]. + +[butane-configs]: ../../provisioning/config-transpiler +[cli]: https://github.com/scaleway/scaleway-cli +[doc-index]: ../../ +[quickstart]: ../ +[scaleway]: https://www.scaleway.com/