refactor: Use Docker Compose managed volume with project prefix

Changes:
- docker-compose.yml: Change from external volume to managed volume
  - Volume name: nlcc-data → data
  - Docker Compose auto-prefixes: nlcc-itinerary_data
  - Remove external: true flag
  - Volume created automatically on first up

- README.md: Update all volume references
  - Installation: Remove manual volume creation step
  - Volume name: nlcc-data → nlcc-itinerary_data
  - Add note about automatic creation
  - Update all backup/restore/inspect commands

Benefits:
- No manual volume creation required
- Docker Compose manages lifecycle automatically
- Project-scoped volume naming (nlcc-itinerary_data)
- Cleaner deployment process (one less step)
- Volume automatically created on docker-compose up
- Consistent with Docker Compose best practices

The volume will be created as "nlcc-itinerary_data" where:
- nlcc-itinerary = project directory name
- data = volume name defined in docker-compose.yml

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-05 17:57:25 -05:00
parent 85c2aeb353
commit 3e6d479ea6
2 changed files with 11 additions and 17 deletions

View File

@@ -87,16 +87,13 @@ cd nlcc-itinerary
- Configure email settings (required for password resets)
- Optionally set `ADMIN_USERNAME` and `ADMIN_PASSWORD` (otherwise auto-generated)
3. Create the external Docker volume for data persistence:
```bash
docker volume create nlcc-data
```
4. Build and run with Docker Compose:
3. Build and run with Docker Compose:
```bash
docker-compose up -d --build
```
The Docker volume will be automatically created as `nlcc-itinerary_data`.
The application will be available at `http://localhost:3002` (or your configured port)
**Important**: The `SITE_URL` must be set correctly for QR codes to work. This should be the public URL where your application is accessible (e.g., `https://church.example.com`).
@@ -315,28 +312,26 @@ docker exec -it nlcc-itinerary sh
## Data Persistence
The SQLite database is stored in a Docker named volume (`nlcc-data`) which is mounted to `/app/data` in the container. This ensures:
The SQLite database is stored in a Docker named volume (`nlcc-itinerary_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
- Automatic creation on first `docker-compose up`
**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
docker volume inspect nlcc-itinerary_data
# Backup the database
docker run --rm -v nlcc-data:/data -v $(pwd):/backup alpine tar czf /backup/nlcc-backup.tar.gz -C /data .
docker run --rm -v nlcc-itinerary_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
docker run --rm -v nlcc-itinerary_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
docker volume rm nlcc-itinerary_data
```
## License

View File

@@ -5,7 +5,7 @@ services:
ports:
- "3002:3000"
volumes:
- nlcc-data:/app/data
- data:/app/data
environment:
- NODE_ENV=production
- SITE_URL=https://church.example.com
@@ -22,5 +22,4 @@ services:
restart: unless-stopped
volumes:
nlcc-data:
external: true
data: