# CoopCredits Infrastructure Configuration Summary ## Your Server Infrastructure | 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 | | 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 - `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 ## Network Architecture ``` Internet │ HTTPS ▼ ┌─────────────┐ │ Nginx │ (80/443) - SSL termination, rate limiting └──────┬──────┘ │ ┌───┴───┐ ▼ ▼ ┌──────┐ ┌──────┐ │Frontend│ │Backend│ │:3000 │ │:3001 │ └──────┘ └───┬───┘ │ ┌──────┼──────┐ ▼ ▼ ▼ ┌────────┐ ┌────┐ ┌──────┐ │PostgreSQL│ │Redis│ │External│ │:5432 │ │:6379│ │Network │ └────────┘ └────┘ └───┬───┘ │ ┌─────────────┼─────────────┐ ▼ ▼ ▼ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ Plex │ │Tautulli │ │ Overseer│ │172.20.1.│ │172.20.1.│ │172.20.1.│ │ 220 │ │ 255 │ │ 225 │ └─────────┘ └─────────┘ └─────────┘ ``` ## Quick Deployment Commands ```bash # 1. Setup infrastructure npm run setup:infra # 2. Edit .env with your API keys nano .env # 3. Setup Solana npm run setup:solana # 4. Deploy npm run deploy:prod # 5. Check health npm run health # 6. Watch mode monitoring npm run health -- --watch ``` ## Integration Points ### Tautulli → CoopCredits - **Trigger**: Watch events - **Webhook URL**: `https://coop.hobokenchicken.com/webhooks/tautulli` - **Action**: Mint $COOP tokens ### Overseer → CoopCredits - **Trigger**: Request approval/decline - **Webhook URL**: `https://coop.hobokenchicken.com/webhooks/overseer` - **Action**: Burn/spend $COOP tokens ### Plex → CoopCredits - **Trigger**: User login - **Method**: OAuth via plex.tv - **Action**: Authenticate users ## Security Features 1. **SSL/TLS**: Let's Encrypt or custom certificates 2. **Rate Limiting**: Nginx level protection 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 ## Monitoring ```bash # Health check ./deployment/health-check.sh # Watch mode (continuous) ./deployment/health-check.sh --watch # Docker logs docker-compose -f docker-compose.prod.yml logs -f # Specific service docker-compose -f docker-compose.prod.yml 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 # 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` 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` ## Troubleshooting | Issue | Solution | |-------|----------| | Cannot reach local services | Check Docker network: `docker network ls` | | Webhook not received | Check Nginx logs: `docker/nginx/logs/access.log` | | Database connection failed | Verify `.env` DATABASE_URL | | SSL error | Check certificate paths in nginx config | | CORS errors | Verify CORS_ORIGINS in `.env` | ## Support Resources - **Setup Guide**: `docs/SETUP-INFRASTRUCTURE.md` - **Architecture**: `docs/INFRASTRUCTURE.md` - **Health Check**: `npm run health` - **Logs**: `npm run docker:prod:logs`