refactor(deploy): pivot compose target to coolify

Co-authored-by: claw <stanislavkalishin+claw@gmail.com>
This commit is contained in:
2026-03-30 22:52:14 +02:00
parent 160d922b8b
commit 116e403f7a
11 changed files with 228 additions and 589 deletions

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ "$(id -u)" -ne 0 ]]; then
echo "Run as root" >&2
exit 1
fi
apt-get update
apt-get install -y ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" \
| tee /etc/apt/sources.list.d/docker.list >/dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
systemctl enable docker
systemctl start docker
mkdir -p /opt/household-bot/app /opt/household-bot/env
echo "Docker installed. Next: place env files in /opt/household-bot/env and deploy the app bundle to /opt/household-bot/app"

View File

@@ -1,61 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
DEPLOY_ROOT="${DEPLOY_ROOT:-/opt/household-bot}"
APP_DIR="${APP_DIR:-$DEPLOY_ROOT/app}"
ENV_DIR="${ENV_DIR:-$DEPLOY_ROOT/env}"
COMPOSE_FILE="${COMPOSE_FILE:-$APP_DIR/deploy/vps/compose.yml}"
require_file() {
local path="$1"
if [[ ! -f "$path" ]]; then
echo "Missing required file: $path" >&2
exit 1
fi
}
require_var() {
local name="$1"
if [[ -z "${!name:-}" ]]; then
echo "Missing required variable: $name" >&2
exit 1
fi
}
require_positive_int() {
local name="$1"
local value="${!name:-}"
if [[ ! "$value" =~ ^[0-9]+$ || "$value" -le 0 ]]; then
echo "Invalid positive integer for $name: $value" >&2
exit 1
fi
}
require_var BOT_IMAGE
require_var MINIAPP_IMAGE
require_file "$COMPOSE_FILE"
require_file "$ENV_DIR/bot.env"
require_file "$ENV_DIR/miniapp.env"
require_file "$ENV_DIR/caddy.env"
if [[ -n "${GHCR_USERNAME:-}" && -n "${GHCR_TOKEN:-}" ]]; then
echo "$GHCR_TOKEN" | docker login ghcr.io -u "$GHCR_USERNAME" --password-stdin
fi
export BOT_IMAGE
export MINIAPP_IMAGE
export ENV_DIR
export SCHEDULER_POLL_INTERVAL_MS="${SCHEDULER_POLL_INTERVAL_MS:-60000}"
export SCHEDULER_DUE_SCAN_LIMIT="${SCHEDULER_DUE_SCAN_LIMIT:-25}"
require_positive_int SCHEDULER_POLL_INTERVAL_MS
require_positive_int SCHEDULER_DUE_SCAN_LIMIT
mkdir -p "$DEPLOY_ROOT"
docker compose -f "$COMPOSE_FILE" pull bot miniapp scheduler migrate caddy
docker compose -f "$COMPOSE_FILE" run --rm --no-deps migrate
docker compose -f "$COMPOSE_FILE" up -d --remove-orphans bot miniapp scheduler caddy
docker compose -f "$COMPOSE_FILE" ps