- Update docker-compose.yml to mount Caddyfile from ./data - Remove Dockerfile directory creation - handled by init-data.sh - Add init-data.sh script to initialize ./data with all required files - Add DATA_DEPLOYMENT.md documentation for deployment workflow - Update .gitignore to exclude ./data folder - All persistent data (app, config, database, uploads) now centralized in ./data
2.3 KiB
2.3 KiB
Data Folder Deployment Guide
Overview
The ./data folder is the persistent data storage for the DigiServer deployment. It is NOT committed to the repository but contains all necessary files copied from the repo during deployment.
Structure
data/
├── app/ # Complete application code (copied from ./app)
├── Caddyfile # Reverse proxy configuration (copied from root)
├── instance/ # Flask instance folder (database, configs)
├── uploads/ # User file uploads
├── caddy-data/ # Caddy SSL certificates and cache
└── caddy-config/ # Caddy configuration data
Deployment Process
Step 1: Initialize Data Folder
Run this script to copy all necessary files from the repository to ./data:
./init-data.sh
This will:
- Create the
./datadirectory structure - Copy
./appfolder to./data/app - Copy
Caddyfileto./data/Caddyfile - Set proper permissions for all files and folders
Step 2: Start Docker Containers
docker-compose up -d --build
Step 3: Run Migrations (First Time Only)
sudo bash deploy.sh
Important Notes
- ./data is NOT in git: The
./datafolder is listed in.gitignoreand will not be committed - All persistent data here: Database files, uploads, certificates, and configurations are stored in
./data - Easy backups: To backup the entire deployment, backup the
./datafolder - Easy troubleshooting: Check the
./datafolder to verify all required files are present - Updates: When you pull new changes, run
./init-data.shto update app files in./data
Deployment Checklist
✓ All volumes in docker-compose.yml point to ./data
✓ ./data folder contains: app/, Caddyfile, instance/, uploads/, caddy-data/, caddy-config/
✓ Files are copied from repository to ./data via init-data.sh
✓ Permissions are correctly set for Docker container user
Verification
Before starting:
ls -la data/
# Should show: app/, Caddyfile, instance/, uploads/, caddy-data/, caddy-config/
After deployment check data folder for:
data/instance/*.db # Database files
data/uploads/ # User uploads
data/caddy-data/*.pem # SSL certificates