carlos / opentofu Public

Clone
git clone https://amadan.net/carlos/opentofu

Plain git — no account needed to clone.

Download

Download this file

1#!/bin/bash
2set -euo pipefail
3umask 077
4
5export DEBIAN_FRONTEND=noninteractive
6apt-get update
7apt-get install -y curl ca-certificates
8
9stage="$(mktemp -d /var/lib/carlos-stage.XXXXXX)"
10trap 'rm -rf "$stage"' EXIT
11
12curl --retry 5 --retry-delay 3 -fsSL -o "$stage/amazon-ssm-agent.deb" \
13 "https://s3.${local_region}.amazonaws.com/amazon-ssm-${local_region}/3.3.5538.0/debian_arm64/amazon-ssm-agent.deb"
14echo "614e40869848a37427101f9965d2a93d463c19eb8ec652800a4f767fc664d3e2 $stage/amazon-ssm-agent.deb" | sha256sum -c -
15dpkg -i "$stage/amazon-ssm-agent.deb"
16systemctl enable --now amazon-ssm-agent
17
18curl --retry 5 --retry-delay 3 -fsSL -o "$stage/carlos" \
19 "https://github.com/carlosframework/releases/releases/download/v0.28.15/carlos-linux-arm64"
20echo "6587576f1aefae5887cae522770b0238e205f0b56b5ffe94de436ac52190e0dd $stage/carlos" | sha256sum -c -
21
22install -d -m 0755 /opt/carlos
23install -m 0755 "$stage/carlos" /opt/carlos/carlos
24
25install -d -m 0755 /etc/carlos
26cat > /etc/carlos/host.env <<'ENVEOF'
27CARLOS_DEPLOYMENT_BUCKET=${deployment_bucket_name}
28AWS_REGION=${deployment_region}
29AWS_DEFAULT_REGION=${deployment_region}
30CARLOS_RELEASE_PUBKEY=${release_public_key}
31CARLOS_REGION=${placement_region}
32CARLOS_HIBERNATE_BUCKET=${data_bucket_name}
33CARLOS_HIBERNATE_REGION=${local_region}
34CARLOS_HIBERNATE_PREFIX=instances
35PLATFORM_APPS_DOMAIN=${apps_domain}
36CARLOS_SYSTEM_CHANNEL=stable
37CARLOS_HOST_METRICS=cloudwatch
38ENVEOF
39chown root:root /etc/carlos/host.env
40chmod 0600 /etc/carlos/host.env
41
42umask 022
43/opt/carlos/carlos bootstrap
44systemctl start carlos-edge
45