Final: Complete modernization - Option 1 deployment, unified persistence, migration scripts
- Implement Docker image-based deployment (Option 1) * Code immutable in image, no volume override * Eliminated init-data.sh manual step * Simplified deployment process - Unified persistence in data/ folder * Moved nginx.conf and nginx-custom-domains.conf to data/ * All runtime configs and data in single location * Clear separation: repo (source) vs data/ (runtime) - Archive legacy features * Groups blueprint and templates removed * Legacy playlist routes redirected to content area * Organized in old_code_documentation/ - Added network migration support * New migrate_network.sh script for IP changes * Regenerates SSL certs for new IP * Updates database configuration * Tested workflow: clone → deploy → migrate - Enhanced deploy.sh * Creates data directories * Copies nginx configs from repo to data/ * Validates file existence before deployment * Prevents incomplete deployments - Updated documentation * QUICK_DEPLOYMENT.md shows 4-step workflow * Complete deployment workflow documented * Migration procedures included - Production ready deployment workflow: 1. Clone & setup (.env configuration) 2. Deploy (./deploy.sh) 3. Migrate network (./migrate_network.sh if needed) 4. Normal operations (docker compose restart)
This commit is contained in:
111
old_code_documentation/NGINX_CONFIG_MIGRATION.md
Normal file
111
old_code_documentation/NGINX_CONFIG_MIGRATION.md
Normal file
@@ -0,0 +1,111 @@
|
||||
# Nginx Config Files Moved to Data Folder
|
||||
|
||||
**Date:** January 17, 2026
|
||||
**Purpose:** Complete persistence isolation - all Docker runtime files in `data/` folder
|
||||
|
||||
## What Changed
|
||||
|
||||
### Files Moved
|
||||
- `./nginx.conf` → `./data/nginx.conf`
|
||||
- `./nginx-custom-domains.conf` → `./data/nginx-custom-domains.conf`
|
||||
|
||||
### docker-compose.yml Updated
|
||||
```yaml
|
||||
volumes:
|
||||
- ./data/nginx.conf:/etc/nginx/nginx.conf:ro # ✅ NOW in data/
|
||||
- ./data/nginx-custom-domains.conf:/etc/nginx/conf.d/custom-domains.conf:rw # ✅ NOW in data/
|
||||
- ./data/nginx-ssl:/etc/nginx/ssl:ro
|
||||
- ./data/nginx-logs:/var/log/nginx
|
||||
- ./data/certbot:/var/www/certbot:ro
|
||||
```
|
||||
|
||||
## Complete Data Folder Structure (Now Unified)
|
||||
|
||||
```
|
||||
/data/
|
||||
├── app/ # Flask application (in Docker image, not mounted)
|
||||
├── instance/ # Database & config
|
||||
│ ├── digiserver.db
|
||||
│ └── server.log
|
||||
├── uploads/ # User uploads
|
||||
│ └── app/static/uploads/...
|
||||
├── nginx.conf # ✅ Nginx main config
|
||||
├── nginx-custom-domains.conf # ✅ Custom domain config
|
||||
├── nginx-ssl/ # SSL certificates
|
||||
│ ├── cert.pem
|
||||
│ └── key.pem
|
||||
├── nginx-logs/ # Nginx logs
|
||||
│ ├── access.log
|
||||
│ └── error.log
|
||||
└── certbot/ # Let's Encrypt certificates
|
||||
```
|
||||
|
||||
## Benefits
|
||||
|
||||
✅ **Unified Persistence:** All runtime configuration in `/data`
|
||||
✅ **Easy Backup:** Single `data/` folder contains everything
|
||||
✅ **Consistent Permissions:** All files managed together
|
||||
✅ **Clean Repository:** Root directory only has source code
|
||||
✅ **Deployment Clarity:** Clear separation: source (`./app`) vs runtime (`./data`)
|
||||
|
||||
## Testing Results
|
||||
|
||||
- ✅ Nginx started successfully with new config paths
|
||||
- ✅ HTTP requests working (port 80)
|
||||
- ✅ HTTPS requests working (port 443)
|
||||
- ✅ No configuration errors
|
||||
|
||||
## Updating Existing Deployments
|
||||
|
||||
If you have an existing deployment:
|
||||
|
||||
```bash
|
||||
# 1. Copy configs to data/
|
||||
cp nginx.conf data/nginx.conf
|
||||
cp nginx-custom-domains.conf data/nginx-custom-domains.conf
|
||||
|
||||
# 2. Update docker-compose.yml
|
||||
# (Already updated - change volume paths from ./ to ./data/)
|
||||
|
||||
# 3. Restart nginx
|
||||
docker-compose restart nginx
|
||||
|
||||
# 4. Verify
|
||||
curl http://localhost
|
||||
curl -k https://localhost
|
||||
```
|
||||
|
||||
## Important Notes
|
||||
|
||||
### If You Edit Nginx Config
|
||||
```bash
|
||||
# Edit the config in data/, NOT in root
|
||||
nano data/nginx.conf
|
||||
nano data/nginx-custom-domains.conf
|
||||
|
||||
# Then restart nginx
|
||||
docker-compose restart nginx
|
||||
```
|
||||
|
||||
### Root Files Now Optional
|
||||
The old `nginx.conf` and `nginx-custom-domains.conf` in the root can be:
|
||||
- **Deleted** (cleanest - all runtime files in data/)
|
||||
- **Kept** (reference/backup - but not used by containers)
|
||||
|
||||
### Recommendations
|
||||
- Delete root nginx config files for cleaner repository
|
||||
- Keep in `.gitignore` if you want to preserve them as backups
|
||||
- All active configs now in `data/` folder which can be `.gitignore`d
|
||||
|
||||
## Related Changes
|
||||
|
||||
Part of ongoing simplification:
|
||||
1. ✅ Option 1 Implementation - Dockerfile-based code deployment
|
||||
2. ✅ Groups feature archived
|
||||
3. ✅ Legacy playlist routes simplified
|
||||
4. ✅ Nginx configs now in data/ folder
|
||||
|
||||
All contributing to:
|
||||
- Cleaner repository structure
|
||||
- Complete persistence isolation
|
||||
- Production-ready deployment model
|
||||
Reference in New Issue
Block a user