docs: update all documentation to reflect current project state

This commit is contained in:
2026-04-23 14:35:08 -04:00
parent 8b31045dcf
commit 3029ce7053
9 changed files with 566 additions and 639 deletions
+48 -57
View File
@@ -5,25 +5,22 @@
| Service | IP Address | Port | Integration Role |
|----------|----------------|------|--------------------------------|
| Plex | 172.20.1.220 | 32400| User authentication, content |
| Overseer | 172.20.1.225 | 5055 | Content requests, $COOP spend |
| Overseer | 172.20.1.225 | 5055 | Content requests, disk space |
| Tautulli | 172.20.1.255 | 8181 | Watch tracking, $COOP earn |
| Website | coop.hobokenchicken.com | 443 | User dashboard, admin panel |
## Files Created/Updated
### Configuration Files
- `.env.production` - Production environment template
- `.env` - Production environment
- `docker-compose.yml` - Docker orchestration
- `docker-compose.prod.yml` - Production Docker orchestration
- `docker/nginx/nginx.prod.conf` - Nginx reverse proxy config
### Deployment Scripts
- `deployment/setup-infrastructure.sh` - Initial infrastructure setup
- `deployment/deploy-production.sh` - Production deployment
- `deployment/health-check.sh` - Service health monitoring
### Documentation
- `docs/SETUP-INFRASTRUCTURE.md` - Step-by-step setup guide
- `docs/INFRASTRUCTURE.md` - Architecture and network documentation
- `docs/CADDY-CONFIG.md` - Reverse proxy configuration
- `docs/TROUBLESHOOTING.md` - Common issues and fixes
## Network Architecture
@@ -32,14 +29,15 @@ Internet
│ HTTPS
┌─────────────┐
Nginx │ (80/443) - SSL termination, rate limiting
Caddy │ (443) - SSL termination
└──────┬──────┘
┌───┴───┐
▼ ▼
┌──────┐ ┌──────┐
│Frontend│ │Backend
:3000 │ │:3001
│Front-│ │Back-
end │ │end
│:3000 │ │:3002 │
└──────┘ └───┬───┘
┌──────┼──────┐
@@ -61,23 +59,18 @@ Internet
## Quick Deployment Commands
```bash
# 1. Setup infrastructure
npm run setup:infra
# 1. Setup
cp .env.example .env
# Edit .env with your API keys
# 2. Edit .env with your API keys
nano .env
# 2. Deploy
docker-compose up -d --build
# 3. Setup Solana
npm run setup:solana
# 3. Initialize database (first time only)
docker exec coop-backend npx prisma db push --accept-data-loss
# 4. Deploy
npm run deploy:prod
# 5. Check health
npm run health
# 6. Watch mode monitoring
npm run health -- --watch
# 4. Check health
curl https://coop.hobokenchicken.com/health
```
## Integration Points
@@ -85,84 +78,82 @@ npm run health -- --watch
### Tautulli → CoopCredits
- **Trigger**: Watch events
- **Webhook URL**: `https://coop.hobokenchicken.com/webhooks/tautulli`
- **Action**: Mint $COOP tokens
- **Action**: Create WatchEvent + Transaction (EARN), update user balance
### Overseer → CoopCredits
### Overseer → CoopCredits
- **Trigger**: Request approval/decline
- **Webhook URL**: `https://coop.hobokenchicken.com/webhooks/overseer`
- **Action**: Burn/spend $COOP tokens
- **Action**: Update ContentRequest status (refund if declined)
### Plex → CoopCredits
- **Trigger**: User login
- **Method**: OAuth via plex.tv
- **Action**: Authenticate users
- **Action**: Authenticate users, create session
### Ko-fi → CoopCredits
- **Trigger**: Store purchase
- **Webhook URL**: `https://coop.hobokenchicken.com/webhooks/kofi`
- **Action**: Create KofiPayment, credit user if email matches
## Security Features
1. **SSL/TLS**: Let's Encrypt or custom certificates
2. **Rate Limiting**: Nginx level protection
1. **SSL/TLS**: Caddy with Let's Encrypt
2. **Rate Limiting**: 1000 req/15min per IP
3. **Firewall**: UFW rules for local network
4. **Secrets**: Encrypted in `.env` file
5. **Wallet Keys**: AES-256-GCM encrypted in database
6. **CORS**: Configured for your domain
7. **JWT**: Secure session tokens
4. **Secrets**: In `.env` file (gitignored)
5. **CORS**: Configured for your domain
6. **JWT**: Secure session tokens
7. **Ko-fi Verification**: Token check on webhook
## Monitoring
```bash
# Health check
./deployment/health-check.sh
# Watch mode (continuous)
./deployment/health-check.sh --watch
curl https://coop.hobokenchicken.com/health
# Docker logs
docker-compose -f docker-compose.prod.yml logs -f
docker-compose logs -f
# Specific service
docker-compose -f docker-compose.prod.yml logs -f backend
docker-compose logs -f backend
```
## Backup Strategy
```bash
# Database backup
docker-compose -f docker-compose.prod.yml exec -T postgres pg_dump -U coop coop_credits > backup_$(date +%Y%m%d).sql
docker exec -T coop-postgres pg_dump -U coop coop_credits > backup_$(date +%Y%m%d).sql
# Environment backup
cp .env .env.backup.$(date +%Y%m%d)
# Wallet keys (secure offsite storage)
# - Solana mint authority keypair
# - Encryption key from .env
```
## Next Steps
1. **Run setup**: `npm run setup:infra`
1. **Run setup**: `cp .env.example .env` and edit
2. **Get API keys**:
- Tautulli: http://172.20.1.255:8181 → Settings → API
- Overseer: http://172.20.1.225:5055 → Settings → General
- Plex: https://plex.tv/claim
3. **Edit .env** with your keys
4. **Setup Solana**: `npm run setup:solana`
5. **Deploy**: `npm run deploy:prod`
6. **Configure webhooks** in Tautulli and Overseer
7. **Test**: `npm run health`
3. **Deploy**: `docker-compose up -d --build`
4. **Configure webhooks** in Tautulli, Overseer, and Ko-fi
5. **Set admin**: `UPDATE users SET is_admin = true WHERE ...`
6. **Test**: `curl https://coop.hobokenchicken.com/health`
## Troubleshooting
| Issue | Solution |
|-------|----------|
| Cannot reach local services | Check Docker network: `docker network ls` |
| Webhook not received | Check Nginx logs: `docker/nginx/logs/access.log` |
| Cannot reach local services | Check backend `network_mode: host` |
| Webhook not received | Check Caddy routes to port 3002 |
| Database connection failed | Verify `.env` DATABASE_URL |
| SSL error | Check certificate paths in nginx config |
| SSL error | Check Caddy certificate status |
| CORS errors | Verify CORS_ORIGINS in `.env` |
| Request stuck PENDING | Use admin **SYNC** button or check Overseer webhook |
## Support Resources
- **Setup Guide**: `docs/SETUP-INFRASTRUCTURE.md`
- **Architecture**: `docs/INFRASTRUCTURE.md`
- **Health Check**: `npm run health`
- **Logs**: `npm run docker:prod:logs`
- **Troubleshooting**: `docs/TROUBLESHOOTING.md`
- **Caddy Config**: `docs/CADDY-CONFIG.md`