# LCC Table Tennis Booking - Production Setup ## Quick Start Your production environment is configured for domain: **lcc-tt-booking.mikicvi.com** ### 1. Deploy the Application ```bash # Make deployment script executable (if not already done) chmod +x deploy.sh # Deploy to production ./deploy.sh ``` ### 2. Set Up Cloudflare Tunnel ```bash # Run the tunnel setup script ./setup-tunnel.sh # Follow the instructions provided by the script ``` ## Configuration Files Created ### Environment Configuration - **`.env.production`** - Production environment variables - **`docker-compose.production.yml`** - Production Docker Compose configuration - **`Dockerfile.production`** - Optimized production Docker build ### Security & Secrets - **NEXTAUTH_SECRET**: `qHYNaq516ByAY6H4HdxacMICd05I1DqvrTitIuVtT20=` (pre-generated) - **Domain**: `lcc-tt-booking.mikicvi.com` - **Admin Email**: `admin@lcc-tt-booking.mikicvi.com` ### Scripts & Automation - **`deploy.sh`** - One-command production deployment - **`setup-tunnel.sh`** - Cloudflare Tunnel setup assistant - **`cloudflare-tunnel-config.yml`** - Tunnel configuration template ### Health & Monitoring - **`/api/health`** - Health check endpoint with database connectivity and memory usage - **Automated backups** - Daily SQLite backups (30-day retention) - **Log rotation** - Automatic log management ## Production Checklist ### Before Going Live: - [ ] Update email credentials in `.env.production` - [ ] Change admin password from default - [ ] Set up Cloudflare Tunnel - [ ] Test health check endpoint - [ ] Verify SSL certificate is working ### After Deployment: - [ ] Test all booking functionality - [ ] Verify admin panel access - [ ] Check automated backups are working - [ ] Set up monitoring alerts (optional) ## Management Commands ```bash # View application logs docker-compose -f docker-compose.production.yml logs -f tt-booking # Restart application docker-compose -f docker-compose.production.yml restart tt-booking # Stop all services docker-compose -f docker-compose.production.yml down # Update and redeploy ./deploy.sh # Access database backup ls -la backups/ # Check application health curl http://localhost:3000/api/health ``` ## Directory Structure ``` /Users/mikicv/Documents/tt-booking/ ├── .env.production # Production environment variables ├── docker-compose.production.yml # Production Docker Compose ├── Dockerfile.production # Production Docker build ├── deploy.sh # Deployment script ├── setup-tunnel.sh # Cloudflare Tunnel setup ├── cloudflare-tunnel-config.yml # Tunnel configuration ├── data/ # SQLite database storage ├── backups/ # Automated backups └── logs/ # Application logs ``` ## Default Admin Access - **URL**: https://lcc-tt-booking.mikicvi.com/admin - **Email**: admin@lcc-tt-booking.mikicvi.com - **Password**: ChangeMeInProduction123! (⚠️ CHANGE THIS!) ## Support & Troubleshooting ### Common Issues: 1. **Container won't start**: Check `docker-compose -f docker-compose.production.yml logs` 2. **Database issues**: Ensure `data/` directory permissions are correct 3. **Tunnel not working**: Verify Cloudflare DNS settings and tunnel configuration ### Health Check: The health endpoint (`/api/health`) provides: - Application status - Database connectivity - Memory usage - Uptime information ### Backup Verification: ```bash # List all backups ls -la backups/ # Check latest backup size du -h backups/sqlite-$(date +%Y%m%d)*.db | tail -1 ``` ## Production Features Included: - ✅ Automated daily backups (30-day retention) - ✅ Health monitoring endpoint - ✅ Log rotation and management - ✅ Multi-stage Docker optimization - ✅ Security hardening - ✅ Rate limiting configured - ✅ SSL-ready with Cloudflare integration Your LCC Table Tennis Booking System is ready for production! 🏓