{"id":18870248,"url":"https://github.com/thor77/hetzner-flatcar","last_synced_at":"2025-06-19T05:05:15.725Z","repository":{"id":50471817,"uuid":"482858477","full_name":"Thor77/hetzner-flatcar","owner":"Thor77","description":"A tool to deploy Flatcar Linux on Hetzner Cloud","archived":false,"fork":false,"pushed_at":"2025-04-16T22:57:38.000Z","size":117,"stargazers_count":4,"open_issues_count":7,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-19T05:04:49.612Z","etag":null,"topics":["flatcar-linux","hetzner-cloud"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Thor77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-18T13:33:25.000Z","updated_at":"2025-01-20T01:42:23.000Z","dependencies_parsed_at":"2025-01-20T02:25:27.841Z","dependency_job_id":"f81be0a8-a142-441b-b45f-a1d3359e40b8","html_url":"https://github.com/Thor77/hetzner-flatcar","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Thor77/hetzner-flatcar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thor77%2Fhetzner-flatcar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thor77%2Fhetzner-flatcar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thor77%2Fhetzner-flatcar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thor77%2Fhetzner-flatcar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thor77","download_url":"https://codeload.github.com/Thor77/hetzner-flatcar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thor77%2Fhetzner-flatcar/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260690830,"owners_count":23047099,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flatcar-linux","hetzner-cloud"],"created_at":"2024-11-08T05:19:27.700Z","updated_at":"2025-06-19T05:05:10.703Z","avatar_url":"https://github.com/Thor77.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hetzner-flatcar\nA tool to deploy [Flatcar Linux](https://flatcar.org/) on [Hetzner Cloud](https://www.hetzner.com/cloud/).\nIncludes transpiling of [Container Linux Config](https://www.flatcar.org/docs/latest/provisioning/cl-config/) and reinstalling maschines on changes.\n\n## Build\n`go build .`\n\n## Usage\n* create a config named `config.toml` with the values described in [configuration](#configuration).\n* create a container linux config template, see [template](#template) for details\n* `./hetzner-flatcar hostname`\n\nThis tool will establish a SSH session to the rescue os to run the flatcar-install script using [goph](https://github.com/melbahja/goph).\nFor authentication it uses the SSH agent, so ensure the private counterpart to the public key uploaded to Hetzner and referenced in the config is added to your SSH agent.\n\n## Configuration\n```toml\n[hcloud]\ntoken = \"\u003chetzner cloud token\u003e\"\nserver_type = \"cx11\"\nlocation = \"nbg1\"\nssh_key = \"\u003cname of ssh key used for rescue and passed to template\u003e\"\nprivate_network = \"\u003cprivate network server is attached to\u003e\"\n\n[flatcar]\nversion = \"3139.2.0\"\nconfig_template = \"ignition.yml.gtpl\"\n# provide path to custom flatcar-install script\n# if not provided will be downloaded from\n# https://github.com/flatcar-linux/init/blob/flatcar-master/bin/flatcar-install\n# install_script = \"custom-install-script\"\n[flatcar.template_static]\nnomad_version = \"1.2.6\"\nconsul_version = \"1.11.4\"\n```\n\n## Template\nThe [Container Linux Config](https://github.com/flatcar-linux/container-linux-config-transpiler/blob/flatcar-master/doc/configuration.md) template is rendered using [text/template](https://golang.org/pkg/text/template/) and is given this data:\n* `Server` - [Server](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/hcloud#Server) object as returned by Hetzner Cloud API\n* `SSHKey` - [SSHKey](https://pkg.go.dev/github.com/hetznercloud/hcloud-go/hcloud#SSHKey) object of the SSH Key used for rescue boot\n* `Static` - static data from [config](#configuration) option `flatcar.template_static` as `map[string]string`\n* `ReadFile(filename string) (string, error)` - function to read a local file\n* `Function(indent int, input string) string` - function to indent strings\n\nAfterwards it's transpiled into a Ignition file.\n\nTake a look at the [example config](doc/example.yml.gtpl) for a minimal example just creating a `core` user with the SSH Key used for rescue boot and setting the hostname to the maschine name.\n\n### injecting local files\nThe container linux config transpiler supports injecting local files ([ref](https://github.com/flatcar-linux/container-linux-config-transpiler/blob/flatcar-master/config/types/files.go#L177)).\nUnfortunately that feature is not usable when not calling it using the CLI, because it relies on the value of a flag to determine the base path to search for files.\nAs an alternative hetzner-flatcar supports the `ReadFile` template function to inject files into templates.\n\nExample usage:\n```\nstorage:\n  files:\n    - path: /etc/LICENSE\n      filesystem: root\n      contents:\n        inline: |\n{{ call .ReadFile \"LICENSE\" | call .Indent 12 }}\n```\n\n### Custom template command\nInstead of using the native go template, you can also use any other command (for example [Helm](https://helm.sh)).\nTo do that provide your custom command in the configuration option `flatcar.template_command`.\nIt will get passed the hostname as the first argument and `Server` and `SSHKey` in YAML format on stdin.\n```\nhetzner:\n  server:\n    name: ...\n  sshkey:\n    publickey: ...\n```\nExample script to render a helm template with a values file based on the hostname:\n```sh\n#!/bin/sh\ncat - common.yaml \"${1}.yaml\" | yq -y . | helm template ignition -f -\n```\n\n## Deployment procedure\n1. check whether vm with the name given as first parameter already exists\n2. create VM (if not already exists)\n3. render container linux config template with data from new or existing VM\n4. transpile container linux config into ignition file\n5. enable rescue boot on VM\n6. Startup or reboot VM (into rescue)\n7. upload flatcar-install script and rendered ignition config\n8. call flatcar-install and reboot\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthor77%2Fhetzner-flatcar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthor77%2Fhetzner-flatcar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthor77%2Fhetzner-flatcar/lists"}