Add: Feedback-System, GitHub Actions Deploy, Assets-Demo User-Suche

This commit is contained in:
2026-06-01 21:04:20 +02:00
parent 8023765e6c
commit a4685c09b8
8 changed files with 2158 additions and 0 deletions

64
.github/workflows/README.md vendored Normal file
View File

@@ -0,0 +1,64 @@
# GitHub Actions — Deploy Workflow
## Übersicht
Der Workflow `deploy.yml` läuft automatisch bei jedem Push auf `main`.
- **Job 1 `build`**: Installiert Dependencies und baut das Frontend — rein zum Kompilierungs-Check.
- **Job 2 `deploy`**: Kopiert den Quellcode per SCP auf den Server und startet Docker neu. **Erfordert manuellen Approval** über das GitHub Environment `production`.
---
## 1. SSH Key als Secret hinterlegen
### SSH Key generieren (falls noch kein dedizierter Key vorhanden)
```bash
ssh-keygen -t ed25519 -C "github-actions-itnexus" -f ~/.ssh/github_actions_itnexus
```
Den Public Key auf dem Server hinterlegen:
```bash
cat ~/.ssh/github_actions_itnexus.pub | ssh root@192.168.0.194 "cat >> ~/.ssh/authorized_keys"
```
### Secrets in GitHub eintragen
Gehe zu: **Repository → Settings → Secrets and variables → Actions → New repository secret**
| Secret Name | Wert |
|---|---|
| `SSH_PRIVATE_KEY` | Inhalt von `~/.ssh/github_actions_itnexus` (Private Key, beginnt mit `-----BEGIN OPENSSH PRIVATE KEY-----`) |
| `SERVER_IP` | `192.168.0.194` |
---
## 2. Production Environment mit Required Reviewer einrichten
### Environment erstellen
1. Gehe zu: **Repository → Settings → Environments**
2. Klicke auf **New environment**
3. Name: `production` (exakt so, wie im Workflow hinterlegt)
4. Klicke auf **Configure environment**
### Required Reviewers setzen
1. Aktiviere **Required reviewers**
2. Füge `Simon Grüssing` (GitHub-Username) als Reviewer hinzu
3. Optional: **Prevent self-review** aktivieren wenn ein weiterer Reviewer vorhanden ist
4. Speichern mit **Save protection rules**
---
## 3. Approval-Prozess
1. Push auf `main` → Job `build` startet automatisch und läuft durch.
2. Nach erfolgreichem Build: Job `deploy` wartet auf Approval.
3. GitHub schickt eine **E-Mail-Benachrichtigung** an alle eingetragenen Reviewer.
4. Reviewer klickt in der E-Mail oder direkt im GitHub Actions Tab auf den Workflow-Run.
5. Unter **"This workflow run is waiting for a required review"** → **Review deployments** → Haken bei `production` setzen → **Approve and deploy**.
6. Erst dann startet der Deployment-Job.
> Tipp: Den Workflow-Status siehst du unter **Repository → Actions**.

59
.github/workflows/deploy.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: IT Nexus Deploy
on:
push:
branches:
- main
jobs:
build:
name: Build Frontend
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: frontend
run: npm install
- name: Build frontend
working-directory: frontend
run: npm run build
deploy:
name: Deploy to Production
runs-on: ubuntu-latest
needs: build
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Deploy frontend/src to server
run: |
scp -r frontend/src root@${{ secrets.SERVER_IP }}:/opt/it-nexus/frontend/src
- name: Deploy backend/src to server
run: |
scp -r backend/src root@${{ secrets.SERVER_IP }}:/opt/it-nexus/backend/src
- name: Rebuild and restart Docker containers
run: |
ssh root@${{ secrets.SERVER_IP }} "cd /opt/it-nexus && docker compose build frontend backend && docker compose up -d frontend backend"