Build and Deploy to Synology NAS / test (push) Failing after 1h20m56s
Build and Deploy to Synology NAS / build (push) Failing after 11m7s
Build and Deploy to Synology NAS / deploy (push) Has been cancelled
Build and Deploy to Synology NAS / notify (push) Has been cancelled
- Add Gitea Actions workflow for automated build and deployment - Add deployment script for Synology NAS - Add Docker Compose configurations for production deployment - Add Gitea runner setup - Add comprehensive documentation for CI/CD setup - Add health check endpoint for deployment verification - Update .gitignore for CI/CD artifacts
211 lines
6.0 KiB
Markdown
211 lines
6.0 KiB
Markdown
# Deployment Files Übersicht
|
|
|
|
Diese Datei gibt einen Überblick über alle Dateien, die für das automatisierte Deployment auf deiner Synology NAS erstellt wurden.
|
|
|
|
## 📋 Erstelle Dateien
|
|
|
|
### 1. CI/CD Workflow
|
|
- **`.gitea/workflows/deploy-synology.yml`**
|
|
- Gitea Actions Workflow für automatisches Build & Deployment
|
|
- Führt Tests aus, baut Docker Image, deployt auf NAS
|
|
- Triggert bei Push auf `main` oder `develop`
|
|
|
|
### 2. Docker Konfiguration
|
|
- **`docker-compose.synology.yml`**
|
|
- Docker Compose für Synology NAS Deployment
|
|
- Definiert Laravel App + PostgreSQL Datenbank
|
|
- Mit persistenten Volumes und Health Checks
|
|
|
|
- **`docker-compose.gitea-runner.yml`**
|
|
- Docker Compose für Gitea Runner
|
|
- Ermöglicht automatische Workflows
|
|
|
|
- **`Dockerfile`**
|
|
- Bereits vorhanden, wird verwendet für Image-Build
|
|
- Multi-stage Build für optimale Image-Größe
|
|
|
|
### 3. Environment Konfiguration
|
|
- **`.env.synology.example`**
|
|
- Beispiel-Environment für Synology Deployment
|
|
- Muss kopiert werden zu `.env.synology`
|
|
- Enthält alle notwendigen Variablen
|
|
|
|
- **`.env.gitea-runner.example`**
|
|
- Beispiel-Environment für Gitea Runner
|
|
- Muss kopiert werden zu `.env.gitea-runner`
|
|
|
|
### 4. Deployment Scripts
|
|
- **`scripts/deploy-synology.sh`**
|
|
- Automatisches Deployment-Script
|
|
- Läuft auf der Synology NAS
|
|
- Handhabt Backup, Deployment, Rollback, Health Checks
|
|
|
|
### 5. Dokumentation
|
|
- **`SYNOLOGY_DEPLOYMENT.md`**
|
|
- Vollständige Anleitung für manuelles Deployment
|
|
- Inklusive CI/CD Setup Abschnitt
|
|
- Troubleshooting Tipps
|
|
|
|
- **`GITEA_RUNNER_SETUP.md`**
|
|
- Detaillierte Anleitung für Gitea Runner Setup
|
|
- Secrets-Konfiguration
|
|
- Monitoring & Troubleshooting
|
|
|
|
- **`CI_CD_README.md`**
|
|
- Schnellstart-Anleitung für CI/CD
|
|
- Übersicht über alle Features
|
|
- Wichtige Befehle
|
|
|
|
- **`DEPLOYMENT_FILES_OVERVIEW.md`** (diese Datei)
|
|
- Übersicht über alle erstellten Dateien
|
|
|
|
### 6. Application Code
|
|
- **`routes/web.php`**
|
|
- Health Check Endpoint hinzugefügt (`/health`)
|
|
- Wird für automatische Health Checks verwendet
|
|
|
|
### 7. Git Konfiguration
|
|
- **`.gitignore`**
|
|
- Erweitert um CI/CD spezifische Dateien
|
|
- `.env.synology` und `.env.gitea-runner` ignoriert
|
|
- Build-Artefakte ignoriert
|
|
|
|
## 🔧 Verwendung der Dateien
|
|
|
|
### Einmalige Einrichtung
|
|
|
|
1. **Gitea Runner deployen:**
|
|
```bash
|
|
# Auf Synology NAS
|
|
cp .env.gitea-runner.example .env.gitea-runner
|
|
# Bearbeite .env.gitea-runner mit deinen Werten
|
|
docker-compose -f docker-compose.gitea-runner.yml up -d
|
|
```
|
|
|
|
2. **Repository Secrets in Gitea setzen:**
|
|
- `SYNOLOGY_HOST`
|
|
- `SYNOLOGY_USER`
|
|
- `SYNOLOGY_SSH_KEY`
|
|
- `APP_KEY`
|
|
|
|
3. **Workflow-Dateien committen:**
|
|
```bash
|
|
git add .gitea/
|
|
git commit -m "ci: add automated deployment"
|
|
git push origin main
|
|
```
|
|
|
|
### Manuelles Deployment
|
|
|
|
Falls du manuell deployen möchtest (ohne CI/CD):
|
|
|
|
```bash
|
|
# Auf Synology NAS
|
|
cd /volume1/docker/laravel-app
|
|
cp .env.synology.example .env.synology
|
|
# Bearbeite .env.synology
|
|
docker-compose -f docker-compose.synology.yml up -d --build
|
|
```
|
|
|
|
## 📊 Datei-Abhängigkeiten
|
|
|
|
```
|
|
.gitea/workflows/deploy-synology.yml
|
|
├── docker-compose.synology.yml
|
|
├── scripts/deploy-synology.sh
|
|
├── .env.synology (zu erstellen)
|
|
└── Dockerfile
|
|
|
|
docker-compose.gitea-runner.yml
|
|
└── .env.gitea-runner (zu erstellen)
|
|
```
|
|
|
|
## ✅ Checkliste für Deployment
|
|
|
|
### Vor dem ersten Deployment:
|
|
|
|
- [ ] Gitea Runner deployed (`docker-compose.gitea-runner.yml`)
|
|
- [ ] Runner in Gitea registriert
|
|
- [ ] Repository Secrets gesetzt
|
|
- [ ] `.env.synology` auf NAS erstellt und konfiguriert
|
|
- [ ] SSH-Keys für Deployment eingerichtet
|
|
- [ ] Projekt-Verzeichnis auf NAS: `/volume1/docker/laravel-app`
|
|
|
|
### Vor jedem Push:
|
|
|
|
- [ ] Tests lokal ausgeführt (`php artisan test`)
|
|
- [ ] Conventional Commit Message verwendet
|
|
- [ ] Code reviewed
|
|
|
|
### Nach dem Deployment:
|
|
|
|
- [ ] Workflow Status in Gitea Actions überprüft
|
|
- [ ] Health Check erfolgreich: `curl http://nas-ip:8080/health`
|
|
- [ ] Anwendung erreichbar: `http://nas-ip:8080`
|
|
- [ ] Logs prüfen: `docker logs laravel_app`
|
|
|
|
## 🔐 Sicherheit
|
|
|
|
### Dateien die NICHT committet werden sollten:
|
|
|
|
- `.env.synology` - Enthält Produktions-Secrets
|
|
- `.env.gitea-runner` - Enthält Runner-Token
|
|
- `kubeconfig` - Falls verwendet
|
|
- `*.tar.gz` - Build-Artefakte
|
|
- SSH Private Keys
|
|
|
|
Diese Dateien sind bereits in `.gitignore` eingetragen!
|
|
|
|
### Dateien die committet werden sollten:
|
|
|
|
- `.env.synology.example` - Template für andere Entwickler
|
|
- `.env.gitea-runner.example` - Template für Runner
|
|
- Alle `docker-compose*.yml` Dateien
|
|
- Alle Dokumentations-Dateien
|
|
- Workflow-Dateien in `.gitea/workflows/`
|
|
- Deployment-Scripts in `scripts/`
|
|
|
|
## 🚀 Nächste Schritte
|
|
|
|
1. **Lies die Dokumentation:**
|
|
- Start mit [CI_CD_README.md](CI_CD_README.md) für Schnellstart
|
|
- Dann [GITEA_RUNNER_SETUP.md](GITEA_RUNNER_SETUP.md) für Runner-Setup
|
|
- Bei Problemen: [SYNOLOGY_DEPLOYMENT.md](SYNOLOGY_DEPLOYMENT.md)
|
|
|
|
2. **Setup durchführen:**
|
|
- Folge der Anleitung in [GITEA_RUNNER_SETUP.md](GITEA_RUNNER_SETUP.md)
|
|
- Konfiguriere Secrets in Gitea
|
|
- Teste mit einem Push
|
|
|
|
3. **Deployment testen:**
|
|
- Mache eine kleine Änderung
|
|
- Committe mit Conventional Commit
|
|
- Push und beobachte Workflow in Gitea Actions
|
|
|
|
4. **Optional: Erweitere Workflow:**
|
|
- Füge Notifications hinzu (Email, Telegram, Discord)
|
|
- Konfiguriere mehrere Environments (Staging, Production)
|
|
- Füge weitere Tests hinzu
|
|
|
|
## 📝 Hinweise
|
|
|
|
- Alle Scripts sind für **Synology DSM 7.x** optimiert
|
|
- Docker und Docker Compose müssen auf der NAS installiert sein
|
|
- Gitea Actions muss in Gitea aktiviert sein
|
|
- PHP 8.4 und Laravel 12 werden verwendet
|
|
|
|
## 🆘 Support
|
|
|
|
Bei Fragen oder Problemen:
|
|
|
|
1. Prüfe die Troubleshooting-Sektionen in den Dokumentations-Dateien
|
|
2. Prüfe Logs: `docker logs gitea-runner` und `docker logs laravel_app`
|
|
3. Verifiziere alle Secrets und Environment-Variablen
|
|
4. Stelle sicher, dass alle Ports verfügbar sind
|
|
|
|
---
|
|
|
|
**Erstellt am:** 2025-12-17
|
|
**Version:** 1.0
|
|
**Für:** Synology NAS Deployment mit Gitea Actions
|