QR-master/DEPLOYMENT_CHECKLIST.md

270 lines
6.4 KiB
Markdown

# 🚀 Deployment Checklist für QR Master
Diese Checkliste enthält alle notwendigen Änderungen vor dem Push nach Gitea und dem Production Deployment.
---
## ✅ 1. Environment Variables (.env)
### Basis URLs ändern
```bash
# Von:
NEXT_PUBLIC_APP_URL=http://localhost:3050
NEXTAUTH_URL=http://localhost:3050
# Zu:
NEXT_PUBLIC_APP_URL=https://www.qrmaster.net
NEXTAUTH_URL=https://www.qrmaster.net
```
### Secrets generieren (falls noch nicht geschehen)
```bash
# NEXTAUTH_SECRET (für JWT/Session Encryption)
openssl rand -base64 32
# IP_SALT (für DSGVO-konforme IP-Hashing)
openssl rand -base64 32
```
Bereits generiert:
- ✅ NEXTAUTH_SECRET: `PT8XVydC4v7QluCz/mV1yb7Y3docSFZeFDioJz4ZE98=`
- ✅ IP_SALT: `j/aluIpzsgn5Z6cbF4conM6ApK5cj4jDagkswzfgQPc=`
### Database URLs
```bash
# Development (localhost):
DATABASE_URL="postgresql://postgres:postgres@localhost:5435/qrmaster?schema=public"
DIRECT_URL="postgresql://postgres:postgres@localhost:5435/qrmaster?schema=public"
# Production (anpassen an deinen Server):
DATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/qrmaster?schema=public"
DIRECT_URL="postgresql://USER:PASSWORD@HOST:5432/qrmaster?schema=public"
```
---
## 🔐 2. Google OAuth Configuration
### Redirect URIs in Google Cloud Console hinzufügen
1. Gehe zu: https://console.cloud.google.com/apis/credentials
2. Wähle deine OAuth 2.0 Client ID: `683784117141-ci1d928jo8f9g6i1isrveflmrinp92l4.apps.googleusercontent.com`
3. Füge folgende **Authorized redirect URIs** hinzu:
```
https://www.qrmaster.net/api/auth/callback/google
```
**Optional** (für Staging/Testing):
```
http://localhost:3050/api/auth/callback/google
https://staging.qrmaster.net/api/auth/callback/google
```
---
## 💳 3. Stripe Configuration
### ⚠️ WICHTIG: Von Test Mode zu Live Mode wechseln
#### Current (Test Mode):
```bash
STRIPE_SECRET_KEY=sk_test_51QYL7gP9xM...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_51QYL7gP9xM...
```
#### Production (Live Mode):
1. Gehe zu: https://dashboard.stripe.com/
2. Wechsle von **Test Mode** zu **Live Mode** (Toggle oben rechts)
3. Hole dir die **Live Keys**:
- `API Keys``Secret key` (beginnt mit `sk_live_`)
- `API Keys``Publishable key` (beginnt mit `pk_live_`)
```bash
# Production Keys:
STRIPE_SECRET_KEY=sk_live_XXXXX
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_live_XXXXX
```
#### Webhook Secret (Production)
1. Erstelle einen neuen Webhook Endpoint: https://dashboard.stripe.com/webhooks
2. Endpoint URL: `https://www.qrmaster.net/api/webhooks/stripe`
3. Events to listen:
- `checkout.session.completed`
- `customer.subscription.updated`
- `customer.subscription.deleted`
- `invoice.payment_succeeded`
- `invoice.payment_failed`
4. Kopiere den **Signing Secret** (beginnt mit `whsec_`)
```bash
STRIPE_WEBHOOK_SECRET=whsec_XXXXX
```
#### Price IDs aktualisieren
Erstelle Produkte und Preise in **Live Mode**:
1. https://dashboard.stripe.com/products
2. Erstelle "Pro" und "Business" Pläne
3. Kopiere die Price IDs (beginnen mit `price_`)
```bash
STRIPE_PRICE_ID_PRO_MONTHLY=price_XXXXX
STRIPE_PRICE_ID_PRO_YEARLY=price_XXXXX
STRIPE_PRICE_ID_BUSINESS_MONTHLY=price_XXXXX
STRIPE_PRICE_ID_BUSINESS_YEARLY=price_XXXXX
```
---
## 📧 4. Resend Email Configuration
### Domain Verification
1. Gehe zu: https://resend.com/domains
2. Füge Domain hinzu: `qrmaster.net`
3. Konfiguriere DNS Records (SPF, DKIM, DMARC)
4. Warte auf Verification
### From Email anpassen
Aktuell verwendet alle Emails: `onboarding@resend.dev` (Resend's Test Domain)
Nach Domain Verification in `src/lib/email.ts` ändern:
```typescript
// Von:
from: 'Timo from QR Master <onboarding@resend.dev>',
// Zu:
from: 'Timo from QR Master <hello@qrmaster.net>',
// oder
from: 'Timo from QR Master <noreply@qrmaster.net>',
```
---
## 🔍 5. SEO Configuration
### Bereits korrekt konfiguriert ✅
```bash
NEXT_PUBLIC_INDEXABLE=true # ✅ Bereits gesetzt
```
### Sitemap & robots.txt prüfen
- Sitemap: `https://www.qrmaster.net/sitemap.xml`
- Robots: `https://www.qrmaster.net/robots.txt`
Nach Deployment testen!
---
## 📊 6. PostHog Analytics (Optional)
Falls du PostHog nutzt:
```bash
NEXT_PUBLIC_POSTHOG_KEY=phc_XXXXX
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
```
---
## 🐳 7. Docker Deployment
### docker-compose.yml prüfen
Stelle sicher, dass alle ENV Variables korrekt gemappt sind:
```yaml
environment:
NEXTAUTH_URL: https://www.qrmaster.net
NEXT_PUBLIC_APP_URL: https://www.qrmaster.net
# ... weitere vars
```
### Deployment Commands
```bash
# Build & Deploy
docker-compose up -d --build
# Database Migration (nach erstem Deploy)
docker-compose exec web npm run db:migrate
# Logs checken
docker-compose logs -f web
# Health Check
curl https://www.qrmaster.net
```
---
## 🔒 8. Security Checklist
- [ ] ✅ NEXTAUTH_SECRET ist gesetzt und sicher (32+ Zeichen)
- [ ] ✅ IP_SALT ist gesetzt und sicher
- [ ] ⚠️ Stripe ist auf **Live Mode** umgestellt
- [ ] ⚠️ Google OAuth Redirect URIs enthalten Production URL
- [ ] ⚠️ Resend Domain ist verifiziert
- [ ] ⚠️ Webhook Secrets sind für Production gesetzt
- [ ] ⚠️ Database URLs zeigen auf Production DB
- [ ] ⚠️ Keine Test/Dev Secrets in Production
---
## 📝 9. Vor dem Git Push
### Files prüfen
```bash
# .env sollte NICHT committet werden!
git status
# Falls .env in Git ist:
git rm --cached .env
echo ".env" >> .gitignore
```
### Sensible Daten entfernen
- [ ] Keine API Keys im Code
- [ ] Keine Secrets in Config Files
- [ ] `.env` ist in `.gitignore`
---
## 🎯 10. Nach dem Deployment testen
### Funktionen testen
1. **Google OAuth Login**: https://www.qrmaster.net/login
2. **QR Code erstellen**: https://www.qrmaster.net/create
3. **Stripe Checkout**: Testprodukt kaufen mit echten Stripe Test Cards
4. **Email Delivery**: Password Reset testen
5. **Analytics**: PostHog Events tracken
### Monitoring
```bash
# Server Logs
docker-compose logs -f
# Database Status
docker-compose exec db psql -U postgres -d qrmaster -c "SELECT COUNT(*) FROM \"User\";"
# Redis Status
docker-compose exec redis redis-cli PING
```
---
## 📞 Support Kontakte
- **Stripe Support**: https://support.stripe.com
- **Google Cloud Support**: https://support.google.com/cloud
- **Resend Support**: https://resend.com/docs
- **Next.js Docs**: https://nextjs.org/docs
---
## ✨ Deployment erfolgreich!
Nach erfolgreichem Deployment:
1. ✅ Teste alle wichtigen Features
2. ✅ Monitor Logs für Fehler
3. ✅ Prüfe Analytics Dashboard
4. ✅ Backup der Production Database erstellen
**Good luck! 🚀**