- Read NEXT_PUBLIC_COLLAB_SERVER_URL in yjs provider; bake NEXT_PUBLIC_* at Docker build - Add prod compose, deploy scripts, CT 116 proxmox scaffolding - Forgejo Actions CI/deploy; migrate-origin and post-migration scripts
56 lines
2.4 KiB
Bash
Executable file
56 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# First-time bootstrap for CT 116 (Submatter / Echodo production host).
|
|
# Run as root on a fresh Debian 13 LXC after `pct create`.
|
|
#
|
|
# Example (on Proxmox host — adjust storage/template to your install):
|
|
# pct create 116 local:vztmpl/debian-13-standard_13.0-1_amd64.tar.zst \
|
|
# --hostname submatter --cores 2 --memory 8192 --swap 512 \
|
|
# --rootfs local-lvm:32 --net0 name=eth0,bridge=vmbr0,ip=192.168.68.116/22,gw=192.168.68.1 \
|
|
# --unprivileged 1 --features nesting=1,keyctl=1
|
|
# pct start 116
|
|
# pct push 116 proxmox/ct116/bootstrap.sh /root/bootstrap.sh
|
|
# pct exec 116 -- bash /root/bootstrap.sh
|
|
set -euo pipefail
|
|
|
|
APP_DIR="${APP_DIR:-/opt/submatter}"
|
|
REPO_URL="${REPO_URL:-https://forgejo.stillwell.cloud/rstillwell/Submatter.git}"
|
|
DEPLOY_BRANCH="${DEPLOY_BRANCH:-main}"
|
|
|
|
echo "[bootstrap] installing docker..."
|
|
apt-get update
|
|
apt-get install -y ca-certificates curl git rsync
|
|
install -m 0755 -d /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
|
|
chmod a+r /etc/apt/keyrings/docker.asc
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
|
|
> /etc/apt/sources.list.d/docker.list
|
|
apt-get update
|
|
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
|
|
|
|
echo "[bootstrap] cloning repo to ${APP_DIR}..."
|
|
mkdir -p "$(dirname "$APP_DIR")"
|
|
if [[ ! -d "${APP_DIR}/.git" ]]; then
|
|
git clone --branch "$DEPLOY_BRANCH" "$REPO_URL" "$APP_DIR"
|
|
fi
|
|
|
|
cd "$APP_DIR"
|
|
if [[ ! -f .env ]]; then
|
|
cp .env.example .env
|
|
echo "[bootstrap] Wrote ${APP_DIR}/.env from .env.example — edit before first deploy."
|
|
fi
|
|
|
|
chmod +x scripts/build-prod.sh scripts/deploy-prod.sh docker/worker-entrypoint.sh 2>/dev/null || true
|
|
|
|
mkdir -p /opt/appdata/submatter
|
|
cat <<'EOF'
|
|
|
|
[bootstrap] Next steps (manual):
|
|
1. Edit /opt/submatter/.env with CT 102 DATABASE_URL, REDIS_URL, auth secrets, public URLs.
|
|
2. bash /opt/submatter/scripts/deploy-prod.sh build
|
|
3. Add CT 100 Traefik routes (see proxmox/ct116/traefik-ct100.example.yml).
|
|
4. Install Dozzle + Beszel agents per CT 101 runbook.
|
|
5. Configure deploy automation:
|
|
- GitHub/Forgejo repo secrets for HOMELAB_DEPLOY_* (see docs/deployment-production.md)
|
|
- OR Forgejo push webhook → proxmox/ct116/deploy-webhook.sh
|
|
|
|
EOF
|