184 lines
5.8 KiB
YAML
184 lines
5.8 KiB
YAML
name: Deploy CV Site (andreknie.de)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install & Build Frontend
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Copy project files to VM
|
|
uses: appleboy/scp-action@v0.1.7
|
|
with:
|
|
host: ${{ secrets.DEPLOY_SSH_HOST }}
|
|
username: ${{ secrets.DEPLOY_SSH_USER }}
|
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
source: "*,dist/**,dist/.*"
|
|
target: "/opt/orchestrator/privat/CV/andreknie.de"
|
|
|
|
- name: Execute Deployment on VM
|
|
uses: appleboy/ssh-action@v1.0.3
|
|
with:
|
|
host: ${{ secrets.DEPLOY_SSH_HOST }}
|
|
username: ${{ secrets.DEPLOY_SSH_USER }}
|
|
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
script: |
|
|
cd /opt/orchestrator/privat/CV/andreknie.de
|
|
|
|
# 1. Sichere .env aus den Gitea Secrets generieren
|
|
cat <<EOF > .env
|
|
PORT=3003
|
|
NODE_ENV=production
|
|
BASE_URL=https://andreknie.de
|
|
SMTP_HOST=smtp.ionos.de
|
|
SMTP_PORT=587
|
|
SMTP_USER=${{ secrets.SMTP_USER }}
|
|
SMTP_PASS=${{ secrets.SMTP_PASS }}
|
|
STAKEHOLDER_EMAIL=kontakt@d-hive.de
|
|
|
|
DATABASE_URL=postgresql://umami:${{ secrets.UMAMI_DB_PASS }}@umami-db:5432/umami
|
|
POSTGRES_DB=umami
|
|
POSTGRES_USER=umami
|
|
POSTGRES_PASSWORD=${{ secrets.UMAMI_DB_PASS }}
|
|
HASH_SALT=${{ secrets.UMAMI_HASH_SALT }}
|
|
EOF
|
|
|
|
# 2. Frontend-Build in den Caddy-Ordner verschieben
|
|
mkdir -p site
|
|
# Wenn dist existiert, kopiere den Inhalt
|
|
if [ -d "dist" ]; then
|
|
cp -r dist/* site/ || true
|
|
cp -r dist/.* site/ 2>/dev/null || true
|
|
else
|
|
echo "FEHLER: dist Ordner existiert nicht!"
|
|
fi
|
|
|
|
# Debugging: Zeige an, ob die Dateien wirklich da sind
|
|
echo "INHALT VON SITE:"
|
|
ls -la site/
|
|
|
|
# 3. Docker Container neustarten
|
|
docker compose up -d --build
|
|
|
|
# --- TEMPORARY PATCH FOR NOTEGRAPH & ORGMYLIFE ---
|
|
echo "Patching NoteGraph and OrgMyLife Limits..."
|
|
|
|
if [ -d "/opt/NoteGraph" ]; then
|
|
cat << 'EOF' > /opt/NoteGraph/docker-compose.yml
|
|
services:
|
|
silverbullet:
|
|
image: zefhemel/silverbullet:latest
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
environment:
|
|
SB_USER: "${SB_USER:-admin:changeme}"
|
|
volumes:
|
|
- ./notes:/space
|
|
ports:
|
|
- "3000:3000"
|
|
|
|
git-sync:
|
|
image: alpine/git:latest
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 64M
|
|
volumes:
|
|
- ./notes:/space
|
|
- ./.git:/repo-git:ro
|
|
entrypoint: /bin/sh
|
|
command: |
|
|
-c '
|
|
cd /space
|
|
git init 2>/dev/null || true
|
|
while true; do
|
|
sleep 300
|
|
cd /space
|
|
git add -A
|
|
if ! git diff --cached --quiet 2>/dev/null; then
|
|
git commit -m "auto: sync notes"
|
|
fi
|
|
done
|
|
'
|
|
|
|
ingestion:
|
|
image: notegraph-ingestion
|
|
build:
|
|
context: ./ingestion
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
ports:
|
|
- "8001:8001"
|
|
volumes:
|
|
- ./notes:/app/notes
|
|
- ./ingestion/inbox:/app/inbox
|
|
env_file:
|
|
- .env
|
|
EOF
|
|
cd /opt/NoteGraph && docker compose up -d
|
|
fi
|
|
|
|
if [ -d "/opt/OrgMyLife" ]; then
|
|
cat << 'EOF' > /opt/OrgMyLife/docker-compose.yml
|
|
version: "3.8"
|
|
services:
|
|
db:
|
|
image: postgres:16-alpine
|
|
restart: unless-stopped
|
|
command: postgres -c shared_buffers=32MB -c max_connections=20
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
environment:
|
|
POSTGRES_DB: orgmylife
|
|
POSTGRES_USER: orgmylife
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
|
volumes:
|
|
- pgdata:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
|
|
app:
|
|
build: .
|
|
restart: unless-stopped
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 256M
|
|
depends_on:
|
|
- db
|
|
ports:
|
|
- "8000:8000"
|
|
env_file:
|
|
- .env
|
|
volumes:
|
|
- ./BACKLOG.md:/app/BACKLOG.md:ro
|
|
command: >
|
|
sh -c "python -c 'from app.db.session import engine, Base; from app.models import *; Base.metadata.create_all(bind=engine)' &&
|
|
uvicorn app.main:app --host 0.0.0.0 --port 8000"
|
|
volumes:
|
|
pgdata:
|
|
EOF
|
|
cd /opt/OrgMyLife && docker compose up -d
|
|
fi
|