pounce/DEPLOYMENT_INSTRUCTIONS.md
Yves Gugger 5e0d4c6590 fix(scraping): real auctions only + cleanup
- Remove seed/demo auction endpoint + scripts (no mock data)
- Rebuild AuctionScraper: strict validation (no -- bids, requires end_time)
- Add robust sources:
  - ExpiredDomains provider auction pages (GoDaddy/Namecheap/Sedo)
  - Park.io auctions table
  - Sav load_domains_ajax table
- Simplify hidden API scrapers to Dynadot only
- Add unique index on (platform, domain) + safe upsert
- Update deployment/docs to reflect real scraping
2025-12-11 21:50:33 +01:00

222 lines
5.0 KiB
Markdown

# 🚀 Deployment Instructions für pounce.ch
## Server Setup
### 1. Code auf den Server pullen
```bash
cd /path/to/server
git clone https://git.6bit.ch/yvg/pounce.git
cd pounce
```
### 2. Environment Dateien einrichten
#### Backend (.env)
```bash
# Kopiere DEPLOY_backend.env nach backend/.env
cp DEPLOY_backend.env backend/.env
```
**Wichtige Anpassungen für Production:**
- `DATABASE_URL`: Wenn du PostgreSQL verwendest, passe die Connection-String an
- `CORS_ORIGINS`: Stelle sicher, dass deine Domain(s) enthalten sind
- `ENVIRONMENT=production`
- `DEBUG=false`
#### Frontend (.env.local)
```bash
# Kopiere DEPLOY_frontend.env nach frontend/.env.local
cp DEPLOY_frontend.env frontend/.env.local
```
**Wichtig:** `NEXT_PUBLIC_API_URL` muss auf deine Backend-URL zeigen (z.B. `https://pounce.ch/api/v1`)
### 3. Backend Setup
```bash
cd backend
# Python Virtual Environment erstellen
python3 -m venv venv
source venv/bin/activate
# Dependencies installieren
pip install -r requirements.txt
# Datenbank initialisieren
python init_db.py
# TLD Preise seeden
python seed_tld_prices.py
# Auctions initial scrapen (echte Daten, keine Demo-Daten)
python scripts/scrape_auctions.py
# Stripe Produkte erstellen
python -c "
from app.services.stripe_service import create_stripe_products
import asyncio
asyncio.run(create_stripe_products())
"
```
### 4. Frontend Setup
```bash
cd ../frontend
# Node.js Dependencies installieren
npm install
# Production Build
npm run build
```
### 5. Server starten
#### Option A: Mit PM2 (empfohlen)
```bash
# Backend
pm2 start backend/ecosystem.config.js
# Frontend
pm2 start frontend/ecosystem.config.js
# Prozesse speichern
pm2 save
pm2 startup
```
#### Option B: Mit systemd
Siehe `deploy.sh` Skript für systemd Service-Konfiguration.
#### Option C: Docker
```bash
docker-compose up -d
```
### 6. Nginx Reverse Proxy (empfohlen)
```nginx
# /etc/nginx/sites-available/pounce.ch
upstream backend {
server 127.0.0.1:8000;
}
upstream frontend {
server 127.0.0.1:3000;
}
server {
listen 80;
listen [::]:80;
server_name pounce.ch www.pounce.ch;
# Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name pounce.ch www.pounce.ch;
# SSL Certificates (Let's Encrypt)
ssl_certificate /etc/letsencrypt/live/pounce.ch/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/pounce.ch/privkey.pem;
# Backend API
location /api/ {
proxy_pass http://backend;
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;
}
# Frontend
location / {
proxy_pass http://frontend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
```
### 7. SSL Zertifikate (Let's Encrypt)
```bash
sudo certbot --nginx -d pounce.ch -d www.pounce.ch
```
### 8. Cronjobs einrichten
Für automatische TLD-Preis-Updates und Domain-Checks:
```bash
crontab -e
```
```cron
# Täglich um 3:00 Uhr TLD Preise aktualisieren
0 3 * * * cd /path/to/pounce/backend && source venv/bin/activate && python -c "from app.services.tld_scraper import scrape_all_tlds; import asyncio; asyncio.run(scrape_all_tlds())"
# Stündlich Auctions scrapen
0 * * * * cd /path/to/pounce/backend && source venv/bin/activate && python -c "from app.services.auction_scraper import auction_scraper; from app.database import AsyncSessionLocal; import asyncio; async def run(): async with AsyncSessionLocal() as db: await auction_scraper.scrape_all_platforms(db); asyncio.run(run())"
```
**Hinweis:** Die Domain-Checks laufen automatisch über den internen Scheduler (APScheduler), keine Cronjobs nötig!
## Wichtige Checks nach Deployment
1. ✅ Backend läuft: `curl https://pounce.ch/api/v1/health`
2. ✅ Frontend läuft: Browser öffnen zu `https://pounce.ch`
3. ✅ Datenbank funktioniert: Login/Register testen
4. ✅ Email-Versand funktioniert: Password Reset testen
5. ✅ Stripe funktioniert: Checkout Flow testen
6. ✅ OAuth funktioniert: Google/GitHub Login testen
## Monitoring
```bash
# PM2 Logs ansehen
pm2 logs
# PM2 Status
pm2 status
# PM2 Restart (bei Problemen)
pm2 restart all
```
## Backup
```bash
# Datenbank Backup (SQLite)
cp backend/domainwatch.db backend/domainwatch.db.backup.$(date +%Y%m%d)
# Oder mit PostgreSQL
pg_dump pounce > pounce_backup_$(date +%Y%m%d).sql
```
## Support
Bei Fragen oder Problemen:
- Email: hello@pounce.ch
- GitHub Issues: https://git.6bit.ch/yvg/pounce
---
**Neue Preise (aktualisiert):**
- Scout: Free
- Trader: $9/mo
- Tycoon: $29/mo
**Währung:** USD (aktualisiert)