docs: Organize documentation into structured folders
Some checks failed
CI/CD Pipeline / Backend Tests (push) Has been cancelled
CI/CD Pipeline / Frontend Tests (push) Has been cancelled
CI/CD Pipeline / Build Docker Images (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled

Organized documentation into cleaner structure:

Root directory (user-facing):
- README.md - Main documentation
- CLAUDE.md - AI context (referenced by system)
- QUICKSTART.md - Quick start guide

docs/ (technical documentation):
- CASL_AUTHORIZATION.md - Authorization guide
- ERROR_HANDLING.md - Error handling patterns
- REQUIREMENTS.md - Project requirements

docs/deployment/ (production deployment):
- HTTPS_SETUP.md - SSL/TLS setup
- PRODUCTION_ENVIRONMENT_TEMPLATE.md - Env vars template
- PRODUCTION_VERIFICATION_CHECKLIST.md - Deployment checklist

Removed:
- DOCKER_TROUBLESHOOTING.md - Outdated (referenced Google OAuth, old domain)

Updated references:
- Fixed links to moved files in CASL_AUTHORIZATION.md
- Fixed links to moved files in ERROR_HANDLING.md
- Removed reference to deleted BUILD_STATUS.md in QUICKSTART.md

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-31 17:13:47 +01:00
parent e8987d5970
commit 440884666d
8 changed files with 3 additions and 182 deletions

View File

@@ -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.

View File

@@ -230,7 +230,7 @@ Ready to deploy:
**Need Help?** **Need Help?**
- Check [CLAUDE.md](CLAUDE.md) for comprehensive documentation - 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 [backend/README.md](backend/README.md) for API docs
- Check [frontend/README.md](frontend/README.md) for frontend docs - Check [frontend/README.md](frontend/README.md) for frontend docs

View File

@@ -645,6 +645,6 @@ console.log('User abilities:', ability.rules);
**Last Updated:** 2026-01-25 **Last Updated:** 2026-01-25
**See also:** **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 - [ERROR_HANDLING.md](./ERROR_HANDLING.md) - Error handling guide
- [CASL Documentation](https://casl.js.org/) - Official CASL docs - [CASL Documentation](https://casl.js.org/) - Official CASL docs

View File

@@ -334,4 +334,4 @@ this.logger.log(`User login: ${email} with password ${password}`); // Never log
--- ---
**Last Updated:** 2026-01-25 **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