7f59b94dcf
Rebrand repository from "Re:Link" to "Startover" across the codebase. Updates include package names and scopes (@relink/* -> @startover/*), import paths, Next.js transpile settings, vitest name, UI text and docs, Dockerfile and CI/workflow names, deploy scripts and repo paths, and example/production env values. Also add auth-related env vars, an apps/web .env symlink, and small formatting/typing cleanups in several TSX/TS files and tests to accommodate the rename.
90 lines
3.2 KiB
Bash
90 lines
3.2 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# ===========================================
|
|
# Startover IDC Server Setup Script
|
|
# Run once on the IDC server to initialize
|
|
# ===========================================
|
|
|
|
echo "=== Startover Server Setup ==="
|
|
|
|
# 1. Install Docker Compose V2 plugin
|
|
echo "[1/5] Installing Docker Compose V2 plugin..."
|
|
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
|
mkdir -p "$DOCKER_CONFIG/cli-plugins"
|
|
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
|
|
curl -SL "https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-linux-x86_64" -o "$DOCKER_CONFIG/cli-plugins/docker-compose"
|
|
chmod +x "$DOCKER_CONFIG/cli-plugins/docker-compose"
|
|
echo "Docker Compose $(docker compose version) installed."
|
|
|
|
# 2. Install Gitea Act Runner
|
|
echo "[2/5] Installing Gitea Act Runner..."
|
|
ACT_RUNNER_VERSION="0.2.11"
|
|
curl -SL "https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64" -o /usr/local/bin/act_runner || {
|
|
# Fallback: download to home dir if no sudo
|
|
curl -SL "https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/act_runner-${ACT_RUNNER_VERSION}-linux-amd64" -o "$HOME/act_runner"
|
|
chmod +x "$HOME/act_runner"
|
|
echo "act_runner installed to $HOME/act_runner"
|
|
}
|
|
chmod +x /usr/local/bin/act_runner 2>/dev/null || true
|
|
echo "Act Runner v${ACT_RUNNER_VERSION} installed."
|
|
|
|
# 3. Create app directory
|
|
echo "[3/5] Creating application directory..."
|
|
APP_DIR="$HOME/startover"
|
|
mkdir -p "$APP_DIR"
|
|
cd "$APP_DIR"
|
|
|
|
# 4. Generate runner config
|
|
echo "[4/5] Generating runner config..."
|
|
act_runner generate-config > "$APP_DIR/runner-config.yaml" 2>/dev/null || "$HOME/act_runner" generate-config > "$APP_DIR/runner-config.yaml" 2>/dev/null || true
|
|
|
|
# 5. Create systemd service for act_runner
|
|
echo "[5/5] Creating systemd service..."
|
|
RUNNER_BIN=$(which act_runner 2>/dev/null || echo "$HOME/act_runner")
|
|
|
|
sudo tee /etc/systemd/system/gitea-runner.service > /dev/null << SERVICEEOF
|
|
[Unit]
|
|
Description=Gitea Act Runner
|
|
After=network.target docker.service
|
|
Requires=docker.service
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=$(whoami)
|
|
WorkingDirectory=${APP_DIR}
|
|
ExecStart=${RUNNER_BIN} daemon --config ${APP_DIR}/runner-config.yaml
|
|
Restart=always
|
|
RestartSec=10
|
|
Environment=DOCKER_HOST=unix:///var/run/docker.sock
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
SERVICEEOF
|
|
|
|
echo ""
|
|
echo "=== Setup Complete ==="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo "1. Register the runner with Gitea:"
|
|
echo " cd $APP_DIR"
|
|
echo " act_runner register \\"
|
|
echo " --instance http://39.117.244.52:3000 \\"
|
|
echo " --token <REGISTRATION_TOKEN> \\"
|
|
echo " --name startover-runner \\"
|
|
echo " --labels ubuntu-latest:host"
|
|
echo ""
|
|
echo "2. Start the runner service:"
|
|
echo " sudo systemctl daemon-reload"
|
|
echo " sudo systemctl enable gitea-runner"
|
|
echo " sudo systemctl start gitea-runner"
|
|
echo ""
|
|
echo "3. Create .env.production in $APP_DIR:"
|
|
echo " cp .env.production.example .env.production"
|
|
echo " # Edit with real values"
|
|
echo ""
|
|
echo "4. Add secrets in Gitea repository settings:"
|
|
echo " - DB_USER, DB_PASSWORD, DB_NAME"
|
|
echo " - REDIS_PASSWORD"
|
|
echo " - NEXTAUTH_URL, NEXTAUTH_SECRET"
|