Files
boc/quixzoom-shop/DEPLOY.md
T

136 lines
2.7 KiB
Markdown
Raw Normal View History

# quiXzoom Shop — Produktionsdeployment
## Förutsättningar
- Server med nginx installerat
- PostgreSQL körande på localhost:5432
- Redis körande på localhost:6379
- Python 3.9+ installerat
- Certbot (Let's Encrypt) installerat
## 1. Databas
```bash
# Skapa databas (om inte redan gjort)
psql -U postgres -c "CREATE DATABASE quixzoom_shop;"
```
## 2. Miljövariabler
Skapa `/home/bernt/.openclaw/workspace/quixzoom-shop/.env`:
```bash
PORT=8087
HOST=127.0.0.1
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/quixzoom_shop
REDIS_URL=redis://localhost:6379/0
JWT_SECRET=din-jwt-secret-här
SHOP_MISSION_THRESHOLD=10
VERIFIED_MISSION_THRESHOLD=100
VERIFIED_APPROVAL_RATE=0.95
# Stripe (test-nycklar för utveckling, byt till live för produktion)
STRIPE_SECRET_KEY=sk_test_...
STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
```
## 3. Systemd Service
```bash
# Kopiera service-filen
sudo cp quixzoom-shop.service /etc/systemd/system/
# Uppdatera med rätt miljövariabler
sudo systemctl edit --full quixzoom-shop
# Aktivera och starta
sudo systemctl daemon-reload
sudo systemctl enable quixzoom-shop
sudo systemctl start quixzoom-shop
# Kontrollera status
sudo systemctl status quixzoom-shop
```
## 4. Nginx
```bash
# Kopiera konfiguration
sudo cp nginx-shop.conf /etc/nginx/conf.d/
# Testa konfiguration
sudo nginx -t
# Ladda om
sudo nginx -s reload
```
## 5. SSL (Let's Encrypt)
```bash
# Skapa certifikat
sudo certbot --nginx -d shop.quixzoom.com
# Auto-förnya (testa)
sudo certbot renew --dry-run
```
## 6. Stripe Webhook
1. Gå till [Stripe Dashboard](https://dashboard.stripe.com/webhooks)
2. Skapa ny endpoint: `https://shop.quixzoom.com/api/payment/webhook`
3. Välj events:
- `payment_intent.succeeded`
- `payment_intent.payment_failed`
4. Kopiera "Signing secret" till `STRIPE_WEBHOOK_SECRET`
## 7. Verifiera
```bash
# Health check
curl https://shop.quixzoom.com/health
# Testa produkter
curl https://shop.quixzoom.com/api/products
# Testa verifiering
curl https://shop.quixzoom.com/verify/QZ-TEST123
```
## 8. Övervakning
```bash
# Loggar
sudo journalctl -u quixzoom-shop -f
# Nginx access log
tail -f /var/log/nginx/access.log
# Nginx error log
tail -f /var/log/nginx/error.log
```
## 9. Uppdateringar
```bash
# Pulla senaste kod
cd /home/bernt/.openclaw/workspace/quixzoom-shop
git pull
# Installera nya dependencies
pip install -r requirements.txt
# Starta om
sudo systemctl restart quixzoom-shop
```
## URL:er
| Tjänst | URL |
|--------|-----|
| Shop | `https://shop.quixzoom.com` |
| API | `https://shop.quixzoom.com/api/` |
| Verifiering | `https://shop.quixzoom.com/verify/{id}` |
| Health | `https://shop.quixzoom.com/health` |