diff --git a/README.md b/README.md index 961695f..11793a6 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,12 @@ cd nlcc-itinerary - Configure email settings (required for password resets) - Optionally set `ADMIN_USERNAME` and `ADMIN_PASSWORD` (otherwise auto-generated) -3. Build and run with Docker Compose: +3. Create the external Docker volume for data persistence: +```bash +docker volume create nlcc-data +``` + +4. Build and run with Docker Compose: ```bash docker-compose up -d --build ``` @@ -310,7 +315,29 @@ docker exec -it nlcc-itinerary sh ## Data Persistence -The SQLite database is stored in the `./data` directory, which is mounted as a volume in Docker. This ensures sermon data persists across container restarts. +The SQLite database is stored in a Docker named volume (`nlcc-data`) which is mounted to `/app/data` in the container. This ensures: +- Data persists across container restarts and rebuilds +- Better portability across different environments +- Easier backup and restore operations +- Managed by Docker volume system + +**Volume Management Commands**: +```bash +# Create the volume (required before first run) +docker volume create nlcc-data + +# Inspect volume location and details +docker volume inspect nlcc-data + +# Backup the database +docker run --rm -v nlcc-data:/data -v $(pwd):/backup alpine tar czf /backup/nlcc-backup.tar.gz -C /data . + +# Restore from backup +docker run --rm -v nlcc-data:/data -v $(pwd):/backup alpine tar xzf /backup/nlcc-backup.tar.gz -C /data + +# Remove volume (WARNING: deletes all data!) +docker volume rm nlcc-data +``` ## License diff --git a/docker-compose.yml b/docker-compose.yml index 3318ee2..03ff03c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: ports: - "3002:3000" volumes: - - ./data:/app/data + - nlcc-data:/app/data environment: - NODE_ENV=production - SITE_URL=https://nlcc.rydertech.us @@ -20,3 +20,7 @@ services: - EMAIL_PASSWORD=your-email-password - EMAIL_FROM=New Life Christian Church restart: unless-stopped + +volumes: + nlcc-data: + external: true