From 158d0791e17c0fd4e8100c07c510084350bd4c26 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Mon, 7 Apr 2025 00:02:09 +0000 Subject: [PATCH] Fix the website infra restart --- website/infra/bootstrap/60-static-ip.yaml | 9 +++++++++ website/infra/bootstrap/user_data.yml | 2 +- website/infra/cloud_init.tf | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 website/infra/bootstrap/60-static-ip.yaml diff --git a/website/infra/bootstrap/60-static-ip.yaml b/website/infra/bootstrap/60-static-ip.yaml new file mode 100644 index 00000000..eaae0fe8 --- /dev/null +++ b/website/infra/bootstrap/60-static-ip.yaml @@ -0,0 +1,9 @@ +# Based on Hetzner's instructions: +# https://docs.hetzner.com/cloud/floating-ips/persistent-configuration/#ubuntu-using-netplan + +network: + version: 2 + renderer: networkd + ethernets: + eth0: + addresses: ["${server_ip}/32"] diff --git a/website/infra/bootstrap/user_data.yml b/website/infra/bootstrap/user_data.yml index c961b8a2..f1456059 100644 --- a/website/infra/bootstrap/user_data.yml +++ b/website/infra/bootstrap/user_data.yml @@ -53,7 +53,7 @@ runcmd: log_content /var/run/reboot-required log_content /var/run/reboot-required.pkgs - - ip addr add ${server_ip} dev eth0 + - netplan apply - systemctl enable --now data-volume.service diff --git a/website/infra/cloud_init.tf b/website/infra/cloud_init.tf index 05a628b1..c35ae534 100644 --- a/website/infra/cloud_init.tf +++ b/website/infra/cloud_init.tf @@ -6,6 +6,7 @@ locals { bootstrap = "${path.module}/bootstrap" template_files = { + "60-static-ip.yaml" = "/etc/netplan/60-static-ip.yaml" "umami.service" = "/etc/systemd/system/umami.service" "data-volume.service" = "/etc/systemd/system/data-volume.service" "docker-daemon.json" = "/etc/docker/daemon.json"