diff --git a/DOCKER_TROUBLESHOOTING.md b/DOCKER_TROUBLESHOOTING.md deleted file mode 100644 index 39b4e2f..0000000 --- a/DOCKER_TROUBLESHOOTING.md +++ /dev/null @@ -1,179 +0,0 @@ -# Docker Container Stopping Issues - Troubleshooting Guide - -## 🚨 Issue Observed - -During development, we encountered issues where Docker containers would hang during the stopping process, requiring forceful termination. This is concerning for production stability. - -## 🔍 Current System Status - -**✅ All containers are currently running properly:** -- Backend: http://localhost:3000 (responding correctly) -- Frontend: http://localhost:5173 -- Database: PostgreSQL on port 5432 -- Redis: Running on port 6379 - -**Docker Configuration:** -- Storage Driver: overlay2 -- Logging Driver: json-file -- Cgroup Driver: systemd -- Cgroup Version: 2 - -## 🛠️ Potential Causes & Solutions - -### 1. **Graceful Shutdown Issues** -**Problem:** Applications not handling SIGTERM signals properly -**Solution:** Ensure applications handle shutdown gracefully - -**For Node.js apps (backend/frontend):** -```javascript -// Add to your main application file -process.on('SIGTERM', () => { - console.log('SIGTERM received, shutting down gracefully'); - server.close(() => { - console.log('Process terminated'); - process.exit(0); - }); -}); - -process.on('SIGINT', () => { - console.log('SIGINT received, shutting down gracefully'); - server.close(() => { - console.log('Process terminated'); - process.exit(0); - }); -}); -``` - -### 2. **Docker Compose Configuration** -**Current issue:** Using obsolete `version` attribute -**Solution:** Update docker-compose.dev.yml - -```yaml -# Remove this line: -# version: '3.8' - -# And ensure proper stop configuration: -services: - backend: - stop_grace_period: 30s - stop_signal: SIGTERM - - frontend: - stop_grace_period: 30s - stop_signal: SIGTERM -``` - -### 3. **Resource Constraints** -**Problem:** Insufficient memory/CPU causing hanging -**Solution:** Add resource limits - -```yaml -services: - backend: - deploy: - resources: - limits: - memory: 512M - reservations: - memory: 256M -``` - -### 4. **Database Connection Handling** -**Problem:** Open database connections preventing shutdown -**Solution:** Ensure proper connection cleanup - -```javascript -// In your backend application -process.on('SIGTERM', async () => { - console.log('Closing database connections...'); - await database.close(); - await redis.quit(); - process.exit(0); -}); -``` - -## 🔧 Immediate Fixes to Implement - -### 1. Update Docker Compose File -```bash -cd /home/kyle/Desktop/vip-coordinator -# Remove the version line and add stop configurations -``` - -### 2. Add Graceful Shutdown to Backend -```bash -# Update backend/src/index.ts with proper signal handling -``` - -### 3. Monitor Container Behavior -```bash -# Use these commands to monitor: -docker-compose -f docker-compose.dev.yml logs --follow -docker stats -``` - -## 🚨 Emergency Commands - -If containers hang during stopping: - -```bash -# Force stop all containers -docker-compose -f docker-compose.dev.yml kill - -# Remove stopped containers -docker-compose -f docker-compose.dev.yml rm -f - -# Clean up system -docker system prune -f - -# Restart fresh -docker-compose -f docker-compose.dev.yml up -d -``` - -## 📊 Monitoring Commands - -```bash -# Check container status -docker-compose -f docker-compose.dev.yml ps - -# Monitor logs in real-time -docker-compose -f docker-compose.dev.yml logs -f backend - -# Check resource usage -docker stats - -# Check for hanging processes -docker-compose -f docker-compose.dev.yml top -``` - -## 🎯 Prevention Strategies - -1. **Regular Health Checks** - - Implement health check endpoints - - Monitor container resource usage - - Set up automated restarts for failed containers - -2. **Proper Signal Handling** - - Ensure all applications handle SIGTERM/SIGINT - - Implement graceful shutdown procedures - - Close database connections properly - -3. **Resource Management** - - Set appropriate memory/CPU limits - - Monitor disk space usage - - Regular cleanup of unused images/containers - -## 🔄 Current OAuth2 Status - -**✅ OAuth2 is now working correctly:** -- Simplified implementation without Passport.js -- Proper domain configuration for bsa.madeamess.online -- Environment variables correctly set -- Backend responding to auth endpoints - -**Next steps for OAuth2:** -1. Update Google Cloud Console with redirect URI: `https://bsa.madeamess.online:3000/auth/google/callback` -2. Test the full OAuth flow -3. Integrate with frontend - -The container stopping issues are separate from the OAuth2 functionality and should be addressed through the solutions above. diff --git a/QUICKSTART.md b/QUICKSTART.md index 8b334db..f48b395 100644 --- a/QUICKSTART.md +++ b/QUICKSTART.md @@ -230,7 +230,7 @@ Ready to deploy: **Need Help?** - Check [CLAUDE.md](CLAUDE.md) for comprehensive documentation -- Check [BUILD_STATUS.md](BUILD_STATUS.md) for what's implemented +- Check [README.md](README.md) for detailed feature overview - Check [backend/README.md](backend/README.md) for API docs - Check [frontend/README.md](frontend/README.md) for frontend docs diff --git a/CASL_AUTHORIZATION.md b/docs/CASL_AUTHORIZATION.md similarity index 99% rename from CASL_AUTHORIZATION.md rename to docs/CASL_AUTHORIZATION.md index 701c9be..1e824e5 100644 --- a/CASL_AUTHORIZATION.md +++ b/docs/CASL_AUTHORIZATION.md @@ -645,6 +645,6 @@ console.log('User abilities:', ability.rules); **Last Updated:** 2026-01-25 **See also:** -- [CLAUDE.md](./CLAUDE.md) - General project documentation +- [CLAUDE.md](../CLAUDE.md) - General project documentation - [ERROR_HANDLING.md](./ERROR_HANDLING.md) - Error handling guide - [CASL Documentation](https://casl.js.org/) - Official CASL docs diff --git a/ERROR_HANDLING.md b/docs/ERROR_HANDLING.md similarity index 99% rename from ERROR_HANDLING.md rename to docs/ERROR_HANDLING.md index bf712e5..699741e 100644 --- a/ERROR_HANDLING.md +++ b/docs/ERROR_HANDLING.md @@ -334,4 +334,4 @@ this.logger.log(`User login: ${email} with password ${password}`); // Never log --- **Last Updated:** 2026-01-25 -**See also:** [CLAUDE.md](./CLAUDE.md) for general project documentation +**See also:** [CLAUDE.md](../CLAUDE.md) for general project documentation diff --git a/REQUIREMENTS.md b/docs/REQUIREMENTS.md similarity index 100% rename from REQUIREMENTS.md rename to docs/REQUIREMENTS.md diff --git a/HTTPS_SETUP.md b/docs/deployment/HTTPS_SETUP.md similarity index 100% rename from HTTPS_SETUP.md rename to docs/deployment/HTTPS_SETUP.md diff --git a/PRODUCTION_ENVIRONMENT_TEMPLATE.md b/docs/deployment/PRODUCTION_ENVIRONMENT_TEMPLATE.md similarity index 100% rename from PRODUCTION_ENVIRONMENT_TEMPLATE.md rename to docs/deployment/PRODUCTION_ENVIRONMENT_TEMPLATE.md diff --git a/PRODUCTION_VERIFICATION_CHECKLIST.md b/docs/deployment/PRODUCTION_VERIFICATION_CHECKLIST.md similarity index 100% rename from PRODUCTION_VERIFICATION_CHECKLIST.md rename to docs/deployment/PRODUCTION_VERIFICATION_CHECKLIST.md