From 1e4407dda07151b357f53e445947110058b50efe Mon Sep 17 00:00:00 2001 From: Tine Date: Thu, 2 Jan 2025 16:34:51 +0100 Subject: [PATCH] fix(ingress.tjo.cloud): enable services once ready --- ingress.tjo.cloud/install.sh | 8 ++++---- ingress.tjo.cloud/justfile | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ingress.tjo.cloud/install.sh b/ingress.tjo.cloud/install.sh index 7fdc3f6..7f94ff2 100755 --- a/ingress.tjo.cloud/install.sh +++ b/ingress.tjo.cloud/install.sh @@ -59,10 +59,6 @@ curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/noble.tailscale-keyring.list apt update -y apt install -y tailscale -## -echo "== Ensure services are enabled" -systemctl enable --now nginx alloy tailscaled dydns - ## echo "== Configure Grafana Alloy" cp -r root/etc/alloy/* /etc/alloy/ @@ -78,6 +74,7 @@ echo "OTEL_RESOURCE_ATTRIBUTES=${ATTRIBUTES}" >>/etc/default/alloy echo "alloy_username=${SERVICE_ACCOUNT_USERNAME}" echo "alloy_password=${SERVICE_ACCOUNT_PASSWORD}" } >>/etc/default/alloy +systemctl enable --now alloy systemctl restart alloy ## @@ -87,10 +84,12 @@ cp -r root/etc/default/dydns /etc/default/dydns echo "DIGITALOCEAN_TOKEN=${DIGITALOCEAN_TOKEN}" echo "NAME=${CLOUD_REGION}" } >>/etc/default/dydns +systemctl enable --now dydns systemctl restart dydns ## echo "== Configure Tailscale" +systemctl enable --now tailscaled if tailscale status --json | jq -e -r '.BackendState != "Running"' >/dev/null; then tailscale up \ --ssh=true \ @@ -134,4 +133,5 @@ systemctl enable ufw echo "== Configure NGINX" cp assets/dbip-city-lite-2023-07.mmdb /var/geoip.mmdb cp -r root/etc/nginx/* /etc/nginx/ +systemctl enable --now nginx systemctl reload nginx diff --git a/ingress.tjo.cloud/justfile b/ingress.tjo.cloud/justfile index 407c305..8dd5dd9 100644 --- a/ingress.tjo.cloud/justfile +++ b/ingress.tjo.cloud/justfile @@ -48,10 +48,11 @@ provision-only node: pushd {{source_directory()}}/terraform > /dev/null NODES=$(tofu output -json | jq -r '.nodes.value[]') popd > /dev/null - + for NODE in $NODES do - if [ "$NODE" -eq "{{node}}" ] + if [ "$NODE" = "{{node}}-ingress-tjo-cloud" ] + then echo "= Provisioning node ${NODE}" cat install.sh | tailscale ssh ubuntu@${NODE} 'sudo bash -s' fi @@ -80,4 +81,4 @@ update-blocked-list: echo "#!!DO NOT EDIT!! Generated by using just ingress-blocked-list command." > root/etc/nginx/partials/blocked.conf for ip in $IP_RANGES; do echo "deny $ip;" >> root/etc/nginx/partials/blocked.conf - done + done \ No newline at end of file