Files
digiserver-v2/old_code_documentation/DATA_DEPLOYMENT.md
Quality App Developer a4262da7c9 chore: fix file permissions and ownership across project
- Changed ownership of all files to scheianu:scheianu
- Set directories to 755 permissions (rwxr-xr-x)
- Set files to 644 permissions (rw-r--r--)
- Made shell scripts executable (755)
- Allows development without requiring sudo for file modifications
- Improves development workflow and security
2026-01-15 22:39:51 +02:00

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
```