docs: add live ftp deploy
This commit is contained in:
@@ -1,42 +1,82 @@
|
||||
# Deployment
|
||||
|
||||
Dieses Repository ist fuer Auto-Deployment von `main` auf die Synology-Testumgebung vorbereitet.
|
||||
Dieses Repository enthaelt eine statische Website direkt im Repo-Root. Es gibt aktuell keinen Build-Schritt und keinen `dist`- oder `build`-Ordner.
|
||||
|
||||
## Ziel
|
||||
## Live-Deployment
|
||||
|
||||
- Repo-Pfad auf Synology: `/volume2/webssd/fabiennefoehn`
|
||||
- Webroot auf Synology: `/volume2/webssd/fabiennefoehn`
|
||||
- Branch: `main`
|
||||
- Repo-Owner: `admin_hz2`
|
||||
- Webserver-User: `http`
|
||||
- Protokoll: `FTP`
|
||||
- Host: `194.230.87.205`
|
||||
- Port: `21`
|
||||
- Zielverzeichnis auf dem Server: `/httpdocs/`
|
||||
- Webroot: `httpdocs`
|
||||
|
||||
## Dateien
|
||||
Die Live-Website wird nicht als komplettes Repository deployed, sondern als statische Dateimenge.
|
||||
|
||||
- `deploy-staging.sh`: wird serverseitig per Webhook ausgefuehrt
|
||||
- `deploy.php`: Gitea-Webhook-Endpunkt im Webroot
|
||||
## Was hochgeladen wird
|
||||
|
||||
## Gitea Webhook
|
||||
Diese Dateien und Ordner werden nach `httpdocs/` hochgeladen:
|
||||
|
||||
- URL: `https://fabienne.imhochrain.ch/deploy.php`
|
||||
- Content Type: `application/json`
|
||||
- Secret: in DSM/Apache als `GITEA_WEBHOOK_SECRET` setzen
|
||||
- Event: `Push Events`
|
||||
- Branch-Filter: `main`
|
||||
- `index.html`
|
||||
- `styles.css`
|
||||
- `script.js`
|
||||
- `lupe.svg`
|
||||
- `media/` komplett
|
||||
|
||||
## Synology sudoers
|
||||
## Was nicht hochgeladen wird
|
||||
|
||||
Datei in `/etc/sudoers.d/fabiennefoehn`:
|
||||
Diese Dateien und Ordner bleiben lokal im Repository:
|
||||
|
||||
```sudoers
|
||||
http ALL=(admin_hz2) NOPASSWD: /bin/bash /volume2/webssd/fabiennefoehn/deploy-staging.sh
|
||||
- `.git/`
|
||||
- `.gitignore`
|
||||
- `AGENTS.md`
|
||||
- `README.md`
|
||||
- `DEPLOYMENT.md`
|
||||
- `deploy.php`
|
||||
- `deploy-staging.sh`
|
||||
- `scripts/`
|
||||
- sonstige lokale Hilfs- oder Repo-Dateien
|
||||
|
||||
## Manueller Upload
|
||||
|
||||
Der Upload kann direkt per `curl` ueber FTP erfolgen. Beispiel fuer einzelne Root-Dateien:
|
||||
|
||||
```bash
|
||||
curl --user 'USER:PASS' -T index.html ftp://HOST:21/httpdocs/index.html
|
||||
curl --user 'USER:PASS' -T styles.css ftp://HOST:21/httpdocs/styles.css
|
||||
curl --user 'USER:PASS' -T script.js ftp://HOST:21/httpdocs/script.js
|
||||
curl --user 'USER:PASS' -T lupe.svg ftp://HOST:21/httpdocs/lupe.svg
|
||||
```
|
||||
|
||||
## Apache / Web Station
|
||||
Beispiel fuer den Ordner `media/`:
|
||||
|
||||
Der Webserver muss die Umgebungsvariable setzen:
|
||||
|
||||
```apache
|
||||
SetEnv GITEA_WEBHOOK_SECRET "nsR7MKmnsHeKpuMUj6baP8CVsjAvo5GmRrPwaTbtswswNiyN7gPu8Wfq1IJn"
|
||||
```bash
|
||||
find media -type f ! -name '.DS_Store' | while IFS= read -r f; do
|
||||
curl --user 'USER:PASS' --ftp-create-dirs -T "$f" "ftp://HOST:21/httpdocs/$f"
|
||||
done
|
||||
```
|
||||
|
||||
Danach Webserver neu laden.
|
||||
## Verifikation
|
||||
|
||||
Nach dem Upload sollte mindestens geprueft werden, ob diese Dateien remote vorhanden sind:
|
||||
|
||||
- `httpdocs/index.html`
|
||||
- `httpdocs/styles.css`
|
||||
- `httpdocs/script.js`
|
||||
- `httpdocs/lupe.svg`
|
||||
- `httpdocs/media/*`
|
||||
|
||||
Optional kann die Dateiliste per FTP geprueft werden:
|
||||
|
||||
```bash
|
||||
curl --disable-epsv --user 'USER:PASS' --list-only ftp://HOST:21/httpdocs/
|
||||
curl --disable-epsv --user 'USER:PASS' --list-only ftp://HOST:21/httpdocs/media/
|
||||
```
|
||||
|
||||
## Hinweis zum Alt-Setup
|
||||
|
||||
Im Repository liegen noch Dateien fuer ein frueheres Synology-/Webhook-Setup:
|
||||
|
||||
- `deploy.php`
|
||||
- `deploy-staging.sh`
|
||||
|
||||
Dieses Setup ist fuer den aktuellen Live-Upload nicht noetig. Massgeblich ist derzeit der manuelle FTP-Upload nach `httpdocs/`.
|
||||
|
||||
Reference in New Issue
Block a user