-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
136 lines (124 loc) · 3.23 KB
/
docker-compose.yml
File metadata and controls
136 lines (124 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Docker Compose for Labitory Production Deployment
version: '3.8'
services:
# PostgreSQL Database
db:
image: postgres:15-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-aperture_booking}
POSTGRES_USER: ${DB_USER:-aperture_booking}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backups/db:/backups
networks:
- aperture_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-aperture_booking}"]
interval: 30s
timeout: 10s
retries: 5
# Redis Cache
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
networks:
- aperture_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
# Labitory Application
app:
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
environment:
# Database settings
DB_NAME: ${DB_NAME:-aperture_booking}
DB_USER: ${DB_USER:-aperture_booking}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: db
DB_PORT: 5432
# Redis settings
REDIS_URL: redis://redis:6379/0
# Django settings
SECRET_KEY: ${SECRET_KEY}
DEBUG: ${DEBUG:-False}
ALLOWED_HOSTS: ${ALLOWED_HOSTS:-localhost,127.0.0.1}
# HTTPS settings
USE_HTTPS: ${USE_HTTPS:-False}
# Email settings
EMAIL_HOST: ${EMAIL_HOST:-localhost}
EMAIL_PORT: ${EMAIL_PORT:-587}
EMAIL_USE_TLS: ${EMAIL_USE_TLS:-True}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD:-}
DEFAULT_FROM_EMAIL: ${DEFAULT_FROM_EMAIL:-noreply@aperature-booking.com}
# Timezone
TIME_ZONE: ${TIME_ZONE:-UTC}
LANGUAGE_CODE: ${LANGUAGE_CODE:-en-gb}
# Admin settings
ADMIN_EMAIL: ${ADMIN_EMAIL:-admin@aperature-booking.com}
volumes:
- static_files:/app/staticfiles
- media_files:/app/media
- app_logs:/app/logs
- app_backups:/app/backups
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- aperture_network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health/"]
interval: 30s
timeout: 10s
retries: 5
start_period: 40s
# Backup service (optional)
backup:
image: postgres:15-alpine
restart: "no"
environment:
PGPASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data:ro
- ./backups/db:/backups
- ./deploy/backup-cron.sh:/usr/local/bin/backup-cron.sh
networks:
- aperture_network
depends_on:
- db
entrypoint: /usr/local/bin/backup-cron.sh
profiles:
- backup
# Named volumes for persistent data
volumes:
postgres_data:
driver: local
redis_data:
driver: local
static_files:
driver: local
media_files:
driver: local
app_logs:
driver: local
app_backups:
driver: local
# Custom network
networks:
aperture_network:
driver: bridge