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
This commit is contained in:
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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 }}
|
|
||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user