- 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
76 lines
2.3 KiB
Markdown
76 lines
2.3 KiB
Markdown
# 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`:
|
|
|
|
```bash
|
|
./init-data.sh
|
|
```
|
|
|
|
This will:
|
|
- Create the `./data` directory structure
|
|
- Copy `./app` folder to `./data/app`
|
|
- Copy `Caddyfile` to `./data/Caddyfile`
|
|
- Set proper permissions for all files and folders
|
|
|
|
### Step 2: Start Docker Containers
|
|
|
|
```bash
|
|
docker-compose up -d --build
|
|
```
|
|
|
|
### Step 3: Run Migrations (First Time Only)
|
|
|
|
```bash
|
|
sudo bash deploy.sh
|
|
```
|
|
|
|
## Important Notes
|
|
|
|
- **./data is NOT in git**: The `./data` folder is listed in `.gitignore` and 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 `./data` folder
|
|
- **Easy troubleshooting**: Check the `./data` folder to verify all required files are present
|
|
- **Updates**: When you pull new changes, run `./init-data.sh` to 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:
|
|
```bash
|
|
ls -la data/
|
|
# Should show: app/, Caddyfile, instance/, uploads/, caddy-data/, caddy-config/
|
|
```
|
|
|
|
After deployment check data folder for:
|
|
```bash
|
|
data/instance/*.db # Database files
|
|
data/uploads/ # User uploads
|
|
data/caddy-data/*.pem # SSL certificates
|
|
```
|