diff --git a/README.md b/README.md index 4610b0f..b829879 100644 --- a/README.md +++ b/README.md @@ -44,19 +44,206 @@ Die Seite ist dann unter `http://localhost:4321` verfügbar. ### Produktions-Deployment +#### Voraussetzungen + +- Ubuntu/Debian server +- Node.js 18+ +- Nginx +- Domain +- SSL Zertifikat + +#### Installationsschritte + +##### 1. Vorbereitung + ```bash -# Build erstellen -npm install && npm run build +# Klonen des Repositorys +git clone https://git.cc24.dev/mstoeck3/cc24-hub +cd cc24-hub + +# Abhängigkeiten installieren +npm install + +# Production-Build anstoßen +npm run build ``` -Die statische Seite wird im `dist/` Verzeichnis generiert und kann in die Webroot des Webservers kopiert werden. +##### 2. Webroot vorbereiten -### Verfügbare Scripts +```bash +# Webroot erstellen und Berechtigungen setzen +sudo mkdir -p /var/www/cc24-hub +sudo chown $USER:$USER /var/www/cc24-hub + +# Build in Webroot kopieren +cp -r ./dist/* /var/www/cc24-hub/ +cp package.json /var/www/cc24-hub/ + +# Prod-Abhängigkeiten installieren +cd /var/www/cc24-hub +npm install --production + +# Berechtigungen setzen +sudo chown -R www-data:www-data /var/www/cc24-hub +``` + +##### 3. Umgebungsvariablen setzen + +Erstelle `/var/www/cc24-hub/.env`: + +```bash +# AI Konfiguration +AI_API_ENDPOINT=https://llm.mikoshi.de # hier geeigneten Endpunkt setzen +AI_API_KEY=your_ai_api_key +AI_MODEL=mistral/mistral-small-latest # hier geeignetes KI-Modell wählen + +# Authentifizierung ("false" setzen für Tests, oder wenn kostenlose KI verwendet wird) +AUTHENTICATION_NECESSARY=true +OIDC_ENDPOINT=https://cloud.cc24.dev +OIDC_CLIENT_ID=your_oidc_client_id +OIDC_CLIENT_SECRET=your_oidc_client_secret +AUTH_SECRET=your_super_secret_jwt_key_min_32_chars + +# Public Configuration +PUBLIC_BASE_URL=https://your-domain.com # hier die URL setzen, mit der von außen zugegriffen wird +``` + +```bash +# .env sichern +sudo chmod 600 /var/www/cc24-hub/.env +sudo chown www-data:www-data /var/www/cc24-hub/.env +``` + +##### 4. Systemd-Service erstellen + +Create `/etc/systemd/system/cc24-hub.service`: + +```ini +[Unit] +Description=CC24-Hub DFIR Tool Directory +After=network.target +Wants=network.target + +[Service] +Type=simple +User=www-data +Group=www-data +WorkingDirectory=/var/www/cc24-hub +ExecStart=/usr/bin/node server/entry.mjs +Restart=always +RestartSec=5 +StartLimitInterval=60s +StartLimitBurst=3 + +# Environment +Environment=NODE_ENV=production +Environment=PORT=3000 + +# Security +NoNewPrivileges=true +PrivateTmp=true +ProtectSystem=strict +ReadWritePaths=/var/www/cc24-hub + +# Logging +StandardOutput=journal +StandardError=journal +SyslogIdentifier=cc24-hub + +[Install] +WantedBy=multi-user.target +``` + +##### 5. Nginx Reverse Proxy konfigurieren + +Erstelle `/etc/nginx/sites-available/cc24-hub`: + +```nginx +server { + listen 80; + server_name your-domain.com; + return 301 https://$server_name$request_uri; +} + +server { + listen 443 ssl http2; + server_name your-domain.com; + + # SSL Configuration (adjust paths for your certificates) + ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; + + # SSL Security + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384; + ssl_prefer_server_ciphers off; + + # Security Headers + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; + + # Proxy to Node.js application + location / { + proxy_pass http://localhost:3000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_cache_bypass $http_upgrade; + proxy_read_timeout 300s; + proxy_connect_timeout 75s; + } + + # Optional: Serve static assets directly (performance optimization) + location /_astro/ { + proxy_pass http://localhost:3000; + expires 1y; + add_header Cache-Control "public, immutable"; + } +} +``` + +##### 6. Daemon starten und Autostart setzen + +```bash +# Enable Nginx site +sudo ln -s /etc/nginx/sites-available/cc24-hub /etc/nginx/sites-enabled/ +sudo nginx -t +sudo systemctl reload nginx + +# Enable and start CC24-Hub service +sudo systemctl daemon-reload +sudo systemctl enable cc24-hub +sudo systemctl start cc24-hub + +# Check status +sudo systemctl status cc24-hub +``` + +##### 7. Deployment verifizieren + +```bash +# Check application logs +sudo journalctl -u cc24-hub -f + +# Check if app is responding +curl http://localhost:3000 + +# Check external access +curl https://your-domain.com +``` + +#### OIDC Konfigurieren + +Nextcloud OIDC Einstellungen (sollte auch mit anderen OIDC-Anwendungen klappen): +- **Redirect URI**: `https://your-domain.com/auth/callback` +- **Logout URI**: `https://your-domain.com` -- `npm run dev` - Development Server -- `npm run build` - Produktions-Build -- `npm run preview` - Vorschau des Builds -- `npm run deploy:static` - Statisches Deployment (Script) ## 📁 Projektstruktur diff --git a/src/components/AIQueryInterface.astro b/src/components/AIQueryInterface.astro index bba6332..336757c 100644 --- a/src/components/AIQueryInterface.astro +++ b/src/components/AIQueryInterface.astro @@ -368,6 +368,8 @@ Beispiele: