Files
tt-booking/docker-compose.production.yml
T
mikicv 2d31c49235 Refactor production setup and database management
- Updated Dockerfile for production to ensure proper database permissions and improved startup script.
- Removed outdated PRODUCTION_README.md and consolidated relevant information into other documentation.
- Enhanced deploy.sh script to fix database permissions and streamline deployment process.
- Modified docker-compose configuration to use a dedicated production file and adjusted port mappings.
- Removed legacy docker-compose.yml file to avoid confusion.
- Improved session management by refining secure cookie settings based on environment variables.
- Deleted obsolete Nginx configuration and old seed scripts to clean up the project structure.
- Updated database setup scripts to reflect new structure and removed old seed data scripts.
- Adjusted reset-db script to use environment variable for database path.
- Enhanced setup-database script to provide dynamic admin credentials in the summary.
- Removed unnecessary backup file for SQLite database.
2025-09-28 16:32:31 +01:00

89 lines
2.4 KiB
YAML

services:
tt-booking:
build:
context: .
dockerfile: Dockerfile.production
container_name: lcc-tt-booking
user: "1000:1000"
ports:
- '3036:3000'
env_file:
- .env.production
environment:
# Container-specific override
- PORT=3000
volumes:
- ./data:/app/data
- ./backups:/app/backups
restart: unless-stopped
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3000/api/health']
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- lcc-network
# Automated backup service
backup:
image: alpine:latest
container_name: lcc-backup
volumes:
- ./data:/data:ro
- ./backups:/backups
environment:
- TZ=Europe/Dublin
command: >
sh -c "
apk add --no-cache tzdata &&
while true; do
timestamp=$$(date +%Y%m%d-%H%M%S)
echo \"Creating backup at $$timestamp\"
cp /data/sqlite.db \"/backups/sqlite-$$timestamp.db\" 2>/dev/null || echo 'No database file found yet'
# Keep backups for 30 days
find /backups -name 'sqlite-*.db' -mtime +30 -delete 2>/dev/null || true
echo \"Backup completed, sleeping for 24 hours\"
sleep 86400
done"
restart: unless-stopped
depends_on:
- tt-booking
networks:
- lcc-network
# Log rotation service
logrotate:
image: alpine:latest
container_name: lcc-logrotate
volumes:
- ./logs:/logs
command: >
sh -c "
apk add --no-cache logrotate &&
echo '/logs/*.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
}' > /etc/logrotate.d/app &&
while true; do
logrotate /etc/logrotate.d/app
sleep 86400
done"
restart: unless-stopped
networks:
- lcc-network
networks:
lcc-network:
driver: bridge
volumes:
lcc-data:
driver: local
lcc-backups:
driver: local