- Modified `.gitignore` to exclude all files in the `/data/` directory. - Enhanced `BACKUP.md` with customization options for backup storage paths and updated database path configurations. - Updated `docker-compose.yml` to reflect new paths for database and backup storage. - Adjusted `Dockerfile` to create a dedicated backups directory. - Refactored `BackupService` to utilize environment variables for backup paths, improving flexibility and reliability. - Deleted `dev.db` as it is no longer needed in the repository.
58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
services:
|
|
towercontrol:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: runner
|
|
ports:
|
|
- "3006:3000"
|
|
environment:
|
|
NODE_ENV: production
|
|
DATABASE_URL: "file:../data/prod.db" # Prisma
|
|
BACKUP_DATABASE_PATH: "./data/prod.db" # Base de données à sauvegarder
|
|
BACKUP_STORAGE_PATH: "./data/backups" # Dossier des sauvegardes
|
|
TZ: Europe/Paris
|
|
volumes:
|
|
- ./data:/app/data # Dossier local data/ vers /app/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
towercontrol-dev:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: base
|
|
ports:
|
|
- "3005:3000"
|
|
environment:
|
|
NODE_ENV: development
|
|
DATABASE_URL: "file:../data/dev.db" # Prisma
|
|
BACKUP_DATABASE_PATH: "./data/dev.db" # Base de données à sauvegarder
|
|
BACKUP_STORAGE_PATH: "./data/backups" # Dossier des sauvegardes
|
|
TZ: Europe/Paris
|
|
volumes:
|
|
- .:/app # code en live
|
|
- /app/node_modules # vol anonyme pour ne pas écraser ceux du conteneur
|
|
- /app/.next
|
|
- ./data:/app/data # Dossier local data/ vers /app/data
|
|
command: >
|
|
sh -c "npm install &&
|
|
npx prisma generate &&
|
|
npx prisma migrate deploy &&
|
|
npm run dev"
|
|
profiles:
|
|
- dev
|
|
|
|
# 📁 Structure des données :
|
|
# ./data/ -> /app/data (bind mount)
|
|
# ├── prod.db -> Base de données production
|
|
# ├── dev.db -> Base de données développement
|
|
# └── backups/ -> Sauvegardes automatiques
|
|
#
|
|
# 🔧 Configuration via .env.docker
|
|
# 📚 Documentation : ./data/README.md |