chore: update backup configurations and directory structure
- 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.
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
towercontrol:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: runner
|
||||
ports:
|
||||
- "3006:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- DATABASE_URL=file:/app/data/prod.db
|
||||
- TZ=Europe/Paris
|
||||
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:
|
||||
# Volume persistant pour la base SQLite
|
||||
- sqlite_data:/app/data
|
||||
# Monter ta DB locale (décommente pour utiliser tes données locales)
|
||||
- ./prisma/dev.db:/app/data/prod.db
|
||||
- ./backups:/app/backups
|
||||
- ./data:/app/data # Dossier local data/ vers /app/data
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/api/health || exit 1"]
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:3000/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
|
||||
# Service de développement (optionnel)
|
||||
towercontrol-dev:
|
||||
build:
|
||||
context: .
|
||||
@@ -34,20 +30,29 @@ services:
|
||||
ports:
|
||||
- "3005:3000"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DATABASE_URL=file:/app/data/dev.db
|
||||
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
|
||||
- /app/node_modules
|
||||
- .:/app # code en live
|
||||
- /app/node_modules # vol anonyme pour ne pas écraser ceux du conteneur
|
||||
- /app/.next
|
||||
- sqlite_data_dev:/app/data
|
||||
command: sh -c "npm install && npx prisma generate && npx prisma migrate deploy && npm run dev"
|
||||
- ./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
|
||||
|
||||
volumes:
|
||||
sqlite_data:
|
||||
driver: local
|
||||
sqlite_data_dev:
|
||||
driver: local
|
||||
|
||||
# 📁 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
|
||||
Reference in New Issue
Block a user