- Timestamp:
- 06/27/2026 09:53:29 PM (2 months ago)
- Branches:
- main
- Children:
- 907a013
- Parents:
- abdcf33
- Location:
- deploy
- Files:
-
- 4 edited
-
DEPLOY.md (modified) (1 diff)
-
backup.sh (modified) (4 diffs)
-
nginx.conf.example (modified) (3 diffs)
-
post-receive (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
deploy/DEPLOY.md
rabdcf33 rd2b7247 152 152 153 153 Now visit `https://YOUR-DOMAIN/`. You should see your site over HTTPS, with 154 HSTS active and Prutter WebSocket working (browser dev-tools → Network → 155 filter "WS" → see the `wss://YOUR-DOMAIN/ws/prutter` connection). 154 HSTS active. 156 155 157 156 --- -
deploy/backup.sh
rabdcf33 rd2b7247 1 1 #!/usr/bin/env bash 2 2 # 3 # PrutCMS v10— nightly backup script.3 # Klonkt — nightly backup script. 4 4 # 5 5 # Snapshots: … … 13 13 # 14 14 # Recommended cron: 15 # 0 3 * * * /home/robin/ prutcms/deploy/backup.sh >> /home/robin/prutcms/logs/backup.log 2>&115 # 0 3 * * * /home/robin/klonkt/deploy/backup.sh >> /home/robin/klonkt/logs/backup.log 2>&1 16 16 17 17 set -euo pipefail 18 18 19 19 # ── Config ──────────────────────────────────────────────────────── 20 APP_DIR="${APP_DIR:-/home/robin/ prutcms}"21 BACKUP_DIR="${BACKUP_DIR:-/home/robin/backups/ prutcms}"20 APP_DIR="${APP_DIR:-/home/robin/klonkt}" 21 BACKUP_DIR="${BACKUP_DIR:-/home/robin/backups/klonkt}" 22 22 KEEP_DAYS="${KEEP_DAYS:-14}" 23 23 TS="$(date +%Y%m%d-%H%M%S)" … … 35 35 36 36 # ── Tar the snapshot + storage subdirs ──────────────────────────── 37 ARCHIVE="$BACKUP_DIR/ prutcms-$TS.tar.gz"37 ARCHIVE="$BACKUP_DIR/klonkt-$TS.tar.gz" 38 38 tar -czf "$ARCHIVE" \ 39 39 -C "$BACKUP_DIR" "$(basename "$DB_SNAPSHOT")" \ … … 47 47 48 48 # ── Rotation ─────────────────────────────────────────────────────── 49 find "$BACKUP_DIR" -type f -name ' prutcms-*.tar.gz' -mtime "+$KEEP_DAYS" -delete49 find "$BACKUP_DIR" -type f -name 'klonkt-*.tar.gz' -mtime "+$KEEP_DAYS" -delete 50 50 51 51 SIZE="$(du -h "$ARCHIVE" | cut -f1)" -
deploy/nginx.conf.example
rabdcf33 rd2b7247 1 1 # ────────────────────────────────────────────────────────────────── 2 # PrutCMS v10— nginx reverse proxy2 # Klonkt — nginx reverse proxy 3 3 # 4 # Place this in /etc/nginx/sites-available/ prutcmsand symlink to4 # Place this in /etc/nginx/sites-available/klonkt and symlink to 5 5 # /etc/nginx/sites-enabled/. Replace <YOUR-DOMAIN> with the real host. 6 6 # 7 7 # Key points: 8 8 # • SSL termination here; Node listens on 127.0.0.1:3000 only. 9 # • WebSocket upgrade headers wired through ( Prutter live messaging).9 # • WebSocket upgrade headers wired through (in case any route uses WS). 10 10 # • Static assets cached aggressively (Node gives them 1y maxAge anyway). 11 11 # • Audio streaming endpoint /audio/stream/* must NOT be cached by nginx — … … 14 14 # 15 15 # After installing: 16 # sudo ln -s /etc/nginx/sites-available/ prutcms/etc/nginx/sites-enabled/16 # sudo ln -s /etc/nginx/sites-available/klonkt /etc/nginx/sites-enabled/ 17 17 # sudo nginx -t 18 18 # sudo systemctl reload nginx … … 96 96 } 97 97 98 # ── WebSocket: Prutter live chat. Long-lived connection.98 # ── WebSocket: long-lived connection (in case any route uses WS). 99 99 location /ws/ { 100 100 proxy_pass http://127.0.0.1:3000; -
deploy/post-receive
rabdcf33 rd2b7247 1 1 #!/bin/bash 2 # PrutFolio deploy-hook — werkt zoals logboek-hook.3 # Bare repo issingle source of truth.4 # /srv/prutfolio is de working tree — gevuld via "git --work-tree=..."5 # ( geen .git submap erin), zelfde patroon als logboek->celine.2 # Klonkt deploy hook — works like the logboek hook. 3 # The bare repo is the single source of truth. 4 # /srv/prutfolio is the working tree — populated via "git --work-tree=..." 5 # (no .git subdir inside), same pattern as logboek->celine. 6 6 set -e 7 7 … … 14 14 echo ">>> Deploying $newrev to $DEPLOY" 15 15 16 # 1. Heel zelden — als een eerdere bug git-internals los in $DEPLOY17 # heeft gedumpt (HEAD/objects/refs op root), eenmalig opruimen18 # zodat dit een echte working tree wordt.16 # 1. Very rarely — if an earlier bug dumped git internals loose into 17 # $DEPLOY (HEAD/objects/refs at the root), clean them up once so this 18 # becomes a real working tree. 19 19 if [ -f "$DEPLOY/HEAD" ] && [ -d "$DEPLOY/objects" ] && [ ! -d "$DEPLOY/.git" ]; then 20 20 echo " cleanup: stale bare-init artifacts in $DEPLOY" … … 24 24 fi 25 25 26 # 2. Force-checkout van bare-repo state naarworking tree.26 # 2. Force-checkout the bare-repo state into the working tree. 27 27 git --git-dir="$GIT_DIR" --work-tree="$DEPLOY" checkout -f main 28 28 29 # 3. npm install alleen als package-lock.json wijzigde.29 # 3. npm install only when package-lock.json changed. 30 30 if [ -n "$oldrev" ] && [ "$oldrev" != "0000000000000000000000000000000000000000" ]; then 31 31 if git --git-dir="$GIT_DIR" diff --name-only "$oldrev" "$newrev" | grep -q "^package-lock.json$"; then … … 38 38 pm2 reload klonkt 2>/dev/null || true 39 39 40 echo ">>> Done. App -files in $DEPLOY ongemoeid (.env, node_modules, storage)."40 echo ">>> Done. App files in $DEPLOY left untouched (.env, node_modules, storage)." 41 41 done
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)