Reiseblog mit CMS
This commit is contained in:
commit
7f820a6478
19 changed files with 600 additions and 0 deletions
17
deploy/Caddyfile
Normal file
17
deploy/Caddyfile
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# /etc/caddy/Caddyfile
|
||||
# Statische Auslieferung mit automatischem HTTPS (Let's Encrypt).
|
||||
|
||||
www.sattelfest.org {
|
||||
root * /srv/sattelfest/dist
|
||||
file_server
|
||||
encode gzip zstd
|
||||
|
||||
# Fotos dürfen lange im Browser-Cache bleiben.
|
||||
@photos path /photos/*
|
||||
header @photos Cache-Control "public, max-age=2592000"
|
||||
}
|
||||
|
||||
# Ohne "www" auf "www" weiterleiten.
|
||||
sattelfest.org {
|
||||
redir https://www.sattelfest.org{uri} permanent
|
||||
}
|
||||
15
deploy/apache-git-sattelfest.conf
Normal file
15
deploy/apache-git-sattelfest.conf
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Nur der ZUSÄTZLICHE VirtualHost für den Git-Host (Forgejo).
|
||||
# Deine bestehenden vHosts für www/apex bleiben unangetastet.
|
||||
#
|
||||
# Ablegen als: /etc/apache2/sites-available/git-sattelfest.conf
|
||||
# Aktivieren: sudo a2ensite git-sattelfest && sudo systemctl reload apache2
|
||||
# HTTPS danach mit certbot ergänzen (siehe Anleitung).
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName git.sattelfest.org
|
||||
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests Off
|
||||
ProxyPass / http://localhost:3000/
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
</VirtualHost>
|
||||
43
deploy/apache-sattelfest.conf
Normal file
43
deploy/apache-sattelfest.conf
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Apache-Vorlage – Alternative zur Caddyfile.
|
||||
# Ablegen als: /etc/apache2/sites-available/sattelfest.conf
|
||||
# Aktivieren: sudo a2ensite sattelfest && sudo systemctl reload apache2
|
||||
#
|
||||
# HTTPS fügt certbot automatisch hinzu (siehe Anleitung) – hier stehen
|
||||
# zunächst nur die HTTP-(Port-80-)VirtualHosts.
|
||||
|
||||
# --- Statische Website ---------------------------------------------------
|
||||
<VirtualHost *:80>
|
||||
ServerName www.sattelfest.org
|
||||
DocumentRoot /srv/sattelfest/dist
|
||||
|
||||
<Directory /srv/sattelfest/dist>
|
||||
Require all granted
|
||||
Options -Indexes
|
||||
AllowOverride None
|
||||
</Directory>
|
||||
|
||||
# Fotos lange im Browser-Cache halten
|
||||
<LocationMatch "^/photos/">
|
||||
Header set Cache-Control "public, max-age=2592000"
|
||||
</LocationMatch>
|
||||
|
||||
# Komprimierung
|
||||
<IfModule mod_deflate.c>
|
||||
AddOutputFilterByType DEFLATE text/html text/css application/javascript application/json image/svg+xml
|
||||
</IfModule>
|
||||
</VirtualHost>
|
||||
|
||||
# --- Ohne "www" auf "www" weiterleiten -----------------------------------
|
||||
<VirtualHost *:80>
|
||||
ServerName sattelfest.org
|
||||
Redirect permanent / https://www.sattelfest.org/
|
||||
</VirtualHost>
|
||||
|
||||
# --- Git-Host (Forgejo) – Reverse Proxy ----------------------------------
|
||||
<VirtualHost *:80>
|
||||
ServerName git.sattelfest.org
|
||||
ProxyPreserveHost On
|
||||
ProxyRequests Off
|
||||
ProxyPass / http://localhost:3000/
|
||||
ProxyPassReverse / http://localhost:3000/
|
||||
</VirtualHost>
|
||||
24
deploy/forgejo-post-receive.sh
Normal file
24
deploy/forgejo-post-receive.sh
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
# Forgejo Build-Hook für die Umgebung mit Apache.
|
||||
# Eintragen unter: Repo -> Einstellungen -> Git-Hooks -> post-receive.
|
||||
# (Voraussetzung: Admin hat Git-Hooks aktiviert, siehe Anleitung.)
|
||||
#
|
||||
# Ablauf: Code auschecken -> bauen -> Ergebnis in den Apache-DocumentRoot kopieren.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
WORKTREE=/srv/sattelfest # Arbeits-/Build-Verzeichnis (Quellcode)
|
||||
PUBLISH=/var/www/sattelfest # Apache DocumentRoot (fertige Website)
|
||||
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
||||
|
||||
git --work-tree="$WORKTREE" checkout -f main
|
||||
|
||||
cd "$WORKTREE"
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
# Fertige Dateien in den DocumentRoot spiegeln (--delete entfernt Altes).
|
||||
rsync -a --delete "$WORKTREE/dist/" "$PUBLISH/"
|
||||
|
||||
echo "✅ Deploy fertig: $(date)"
|
||||
28
deploy/post-receive
Normal file
28
deploy/post-receive
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
# Git-Hook: läuft auf dem Server nach jedem "git push".
|
||||
# Checkt den Code aus und baut die statische Seite neu.
|
||||
#
|
||||
# Installation: nach /srv/git/sattelfest.git/hooks/post-receive kopieren
|
||||
# und ausführbar machen (chmod +x).
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
GIT_DIR_PATH=/srv/git/sattelfest.git
|
||||
WORKTREE=/srv/sattelfest
|
||||
BRANCH=main
|
||||
|
||||
# Node/npm (NodeSource installiert nach /usr/bin) auffindbar machen.
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
||||
|
||||
echo "→ Code auschecken …"
|
||||
git --git-dir="$GIT_DIR_PATH" --work-tree="$WORKTREE" checkout -f "$BRANCH"
|
||||
|
||||
cd "$WORKTREE"
|
||||
|
||||
echo "→ Abhängigkeiten installieren …"
|
||||
npm ci
|
||||
|
||||
echo "→ Seite bauen …"
|
||||
npm run build
|
||||
|
||||
echo "✅ Deploy fertig: $(date)"
|
||||
Loading…
Add table
Add a link
Reference in a new issue