mirror of
https://github.com/acaloiaro/sfos
synced 2026-07-21 10:12:24 +00:00
58 lines
2.5 KiB
Smarty
58 lines
2.5 KiB
Smarty
#cloud-config
|
|
users:
|
|
- name: sfos
|
|
groups: users, admin
|
|
sudo: ALL=(ALL) NOPASSWD:ALL
|
|
shell: /bin/bash
|
|
ssh_authorized_keys:
|
|
- ssh-rsa ${admin_public_key}
|
|
package_update: true
|
|
package_upgrade: true
|
|
packages:
|
|
- git
|
|
- bash
|
|
- apt-transport-https
|
|
- ca-certificates
|
|
- software-properties-common
|
|
|
|
write_files:
|
|
- encoding: b64
|
|
content: ${ install_nomad_script }
|
|
owner: root:root
|
|
path: /root/install-nomad.sh
|
|
permissions: '0755'
|
|
- encoding: b64
|
|
content: ${ run_nomad_script }
|
|
owner: root:root
|
|
path: /opt/nomad/bin/run-nomad.sh
|
|
permissions: '0755'
|
|
- encoding: b64
|
|
content: ${ nomad_config_file }
|
|
path: /root/nomad.config.hcl
|
|
owner: nomad:nomad
|
|
|
|
runcmd:
|
|
- sudo curl -fsSL https://tailscale.com/install.sh | sh
|
|
- echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
|
|
- echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
|
|
- sudo sysctl -p /etc/sysctl.conf
|
|
- sudo tailscale up --auth-key ${ tailscale_auth_key } --advertise-routes ${ private_network_cidr }
|
|
- sleep 2
|
|
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
|
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
- sudo echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list
|
|
- wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc &>/dev/null
|
|
- sudo apt update
|
|
- apt-cache policy docker-ce
|
|
- apt install docker-ce restic rclone postgresql-client-15 -y
|
|
- usermod -G docker -a nomad
|
|
- /root/install-nomad.sh --version ${ nomad_version } --path /opt/nomad --user root
|
|
- echo '${ nomad_config_file }' | base64 -d > /opt/nomad/config/custom.hcl
|
|
- /opt/nomad/bin/run-nomad.sh --server --num-servers 10000 --config-dir /opt/nomad/config --data-dir /opt/nomad/data --bin-dir /opt/nomad/bin
|
|
- mkdir -p /etc/nginx/conf && mkdir -p /etc/certbot && mkdir -p /var/www/certbot
|
|
- echo "vm.max_map_count=262144" >> /etc/sysctl.conf
|
|
- sysctl -p
|
|
- chmod o+rw /var/run/docker.sock
|
|
- curl -L -o cni-plugins.tgz https://github.com/containernetworking/plugins/releases/download/v1.1.1/cni-plugins-linux-amd64-v1.1.1.tgz
|
|
- sudo mkdir -p /opt/cni/bin
|
|
- sudo tar -C /opt/cni/bin -xzf cni-plugins.tgz
|