From c8b729beb6db6f6e2ca95a2a746f7df183e75ee5 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 2 Aug 2026 10:32:41 -0400 Subject: [PATCH] Migrate deployment from DigitalOcean to Unraid Remove: - .do/app.yaml, .do/deploy.template.yaml - .github/workflows/deploy.yml (DO App Platform pipeline) Add: - deploy.sh (SCP-based deploy to Unraid nginx) New stack: - Gitea bare repo on Unraid (/mnt/cache/docker/gitea) - Ruby container builds Jekyll on push via post-receive hook - Nginx serves static site on port 8100 - Caddy proxies simcoetradesjournal.krisforbes.ca + simcoetradesjournal.ca --- .do/app.yaml | 9 ---- .do/deploy.template.yaml | 9 ---- .github/workflows/deploy.yml | 91 ------------------------------------ deploy.sh | 19 ++++++++ 4 files changed, 19 insertions(+), 109 deletions(-) delete mode 100644 .do/app.yaml delete mode 100644 .do/deploy.template.yaml delete mode 100644 .github/workflows/deploy.yml create mode 100644 deploy.sh diff --git a/.do/app.yaml b/.do/app.yaml deleted file mode 100644 index 38005f8..0000000 --- a/.do/app.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: simcoetradesjournal2 -static_sites: -- name: simcoetradesjournal - build_command: JEKYLL_ENV=production bundle exec jekyll build - output_dir: _site - github: - branch: main - deploy_on_push: true - repo: krisf/simcoetradesjournal diff --git a/.do/deploy.template.yaml b/.do/deploy.template.yaml deleted file mode 100644 index 1416caf..0000000 --- a/.do/deploy.template.yaml +++ /dev/null @@ -1,9 +0,0 @@ -spec: - name: simcoetradesjournal - static_sites: - - name: simcoetradesjournal - build_command: JEKYLL_ENV=production bundle exec jekyll build - output_dir: _site - git: - branch: main - repo_clone_url: https://github.com/krisf/simcoetradesjournal.git diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 441d4c8..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Build & Deploy Jekyll Site - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.3' - bundler-cache: true - - - name: Build site with Jekyll - run: | - JEKYLL_ENV=production bundle exec jekyll build - env: - JEKYLL_ENV: production - - - name: Deploy to DigitalOcean App Platform - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - run: | - set -euo pipefail - TOKEN="$DIGITALOCEAN_TOKEN" - - # List all apps with full details - echo "=== Fetching apps from DO API ===" - APPS_JSON=$(curl -s -w "\n%{http_code}" \ - -H "Authorization: Bearer $TOKEN" \ - -H "Content-Type: application/json" \ - "https://api.digitalocean.com/v2/apps?page=1&page_limit=20") - - HTTP_CODE=$(echo "$APPS_JSON" | tail -1) - BODY=$(echo "$APPS_JSON" | sed '$d') - - echo "HTTP Status: $HTTP_CODE" - if [ "$HTTP_CODE" != "200" ]; then - echo "ERROR: DO API returned $HTTP_CODE" - echo "Response: $BODY" - exit 1 - fi - - # Show all app names for debugging - echo "=== All apps found ===" - echo "$BODY" | jq -r '.apps[] | " - \(.spec.name) (id: \(.id))"' - - # Find app ID — try exact name match first, then partial - APP_ID=$(echo "$BODY" | jq -r '.apps[] | select(.spec.name == "simcoetradesjournal2") | .id' | head -1) - - if [ -z "$APP_ID" ] || [ "$APP_ID" = "null" ]; then - echo "ERROR: Could not find DO app named 'simcoetradesjournal2'" - echo "Full response:" - echo "$BODY" | jq . - exit 1 - fi - - echo "=== Found DO app ID: $APP_ID ===" - - # Trigger deployment (Static Sites use /deployments, not /deploy) - echo "=== Triggering deployment ===" - DEPLOY_JSON=$(curl -s -w "\n%{http_code}" -X POST \ - -H "Authorization: Bearer $TOKEN" \ - -H "Content-Type: application/json" \ - "https://api.digitalocean.com/v2/apps/$APP_ID/deployments") - - DEPLOY_HTTP=$(echo "$DEPLOY_JSON" | tail -1) - DEPLOY_BODY=$(echo "$DEPLOY_JSON" | sed '$d') - - echo "Deploy HTTP Status: $DEPLOY_HTTP" - if [ "$DEPLOY_HTTP" != "200" ]; then - echo "ERROR: Deploy API returned $DEPLOY_HTTP" - echo "Response: $DEPLOY_BODY" - exit 1 - fi - - DEPLOY_ID=$(echo "$DEPLOY_BODY" | jq -r '.deployments[0].id // empty') - echo "=== Deployment triggered successfully ===" - echo "Deploy ID: $DEPLOY_ID" - env: - DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }} diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..c85fade --- /dev/null +++ b/deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Deploy simcoetradesjournal to Unraid via SCP +set -e + +REPO_DIR="$(cd "$(dirname "$0")" && pwd)" +REMOTE="root@192.168.0.123" +REMOTE_DIR="/mnt/better/appdata/simcoetradesjournal" + +echo "🔨 Building Jekyll site..." +cd "$REPO_DIR" +bundle exec jekyll build + +echo "📦 Syncing to Unraid..." +rsync -av --delete \ + --exclude '.git' \ + "$REPO_DIR/_site/" \ + "$REMOTE:$REMOTE_DIR/" + +echo "✅ Deployed. Site live at https://simcoetradesjournal.krisforbes.ca"