A container registry that uses the AT Protocol for manifest storage and S3 for blob storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 55 lines 1.6 kB view raw
1#!/bin/bash 2set -euo pipefail 3exec > >(tee {{.LogFile}}) 2>&1 4 5echo "=== {{.DisplayName}} Setup: {{.BinaryName}} ===" 6echo "Started at $(date -u)" 7 8# Wait for network/DNS 9for i in $(seq 1 30); do 10 if getent hosts go.dev >/dev/null 2>&1; then 11 echo "Network ready after ${i}s" 12 break 13 fi 14 sleep 1 15done 16 17# System packages 18export DEBIAN_FRONTEND=noninteractive 19apt-get update && apt-get upgrade -y 20apt-get install -y git gcc make curl libsqlite3-dev nodejs npm htop systemd-timesyncd 21sed -i 's/^#NTP=.*/NTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org/' /etc/systemd/timesyncd.conf 22timedatectl set-ntp true 23 24# Swap (for small instances) 25if [ ! -f /swapfile ]; then 26 dd if=/dev/zero of=/swapfile bs=1M count=2048 27 chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile 28 echo '/swapfile none swap sw 0 0' >> /etc/fstab 29fi 30 31# Install directory (binaries deployed via SCP) 32mkdir -p {{.InstallDir}}/bin 33 34# Service user & data dirs 35useradd --system --no-create-home --shell /usr/sbin/nologin {{.SystemUser}} || true 36mkdir -p {{.DataDir}} && chown {{.SystemUser}}:{{.SystemUser}} {{.DataDir}} 37 38# Config file 39mkdir -p {{.ConfigDir}} 40if [ ! -f {{.ConfigPath}} ]; then 41cat > {{.ConfigPath}} << 'CFGEOF' 42{{.ConfigYAML}} 43CFGEOF 44else 45 echo "Config {{.ConfigPath}} already exists, skipping overwrite (missing keys merged separately)" 46fi 47 48# Systemd service 49cat > /etc/systemd/system/{{.ServiceName}}.service << 'SVCEOF' 50{{.ServiceUnit}} 51SVCEOF 52systemctl daemon-reload 53systemctl enable {{.ServiceName}} 54 55echo "=== Setup complete at $(date -u) ==="