forked from letsgetrusty/live-bootcamp-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yml
123 lines (116 loc) · 3.31 KB
/
compose.yml
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
services:
app-service:
container_name: app_service
image: luiscarlosjayk/app-service # specify name of image on Docker Hub
restart: "unless-stopped" # automatically restart container when server crashes
environment: # set up environment variables
BASE_PATH: ${BASE_PATH}
DROPLET_IP: ${DROPLET_IP}
ENVIRONMENT: remote
ports:
- "8000:8000" # expose port 8000 so that applications outside the container can connect to it
depends_on: # only run app-service after auth-service has started
auth-service:
condition: service_started
networks:
- certs-network
auth-service:
container_name: auth_service
image: luiscarlosjayk/auth-service
restart: "unless-stopped" # automatically restart container when server crashes
ports:
- "3000:3000" # expose port 3000 so that applications outside the container can connect to it
networks:
- certs-network
- db
- redis
environment:
ENVIRONMENT: remote
BASE_PATH: ${BASE_PATH}
RECAPTCHA_SECRET: ${RECAPTCHA_SECRET}
JWT_SECRET: ${JWT_SECRET}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DROPLET_IP: ${DROPLET_IP}
DATABASE_URL: postgres://postgres:${POSTGRES_PASSWORD}@db:5432
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
EMAIL_SENDER: ${EMAIL_SENDER}
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
reverse-proxy:
container_name: nginx
image: nginx:latest
restart: "unless-stopped" # automatically restart container when server crashes
ports:
- 80:80
- 443:443
volumes:
- ./proxy/templates:/etc/nginx/templates
- web-root:/var/www/html
- certbot-etc:/etc/letsencrypt
- certbot-var:/var/lib/letsencrypt
environment:
NGINX_HOST: localhost
NGINX_PORT: 80
NGINX_HTTPS_PORT: 443
AUTH_SERVICE_PORT: 3000
APP_SERVICE_PORT: 8000
DOMAIN: livebootcamp.luiscarlosjayk.com
depends_on:
auth-service:
condition: service_started
app-service:
condition: service_started
networks:
- certs-network
certbot:
image: certbot/certbot
container_name: certbot
volumes:
- web-root:/var/www/html
- certbot-etc:/etc/letsencrypt
- certbot-var:/var/lib/letsencrypt
depends_on:
- reverse-proxy
command: certonly --webroot --webroot-path=/var/www/html --email luiscarlosjayk@gmail.com --agree-tos --no-eff-email --force-renewal -d livebootcamp.luiscarlosjayk.com -d www.livebootcamp.luiscarlosjayk.com
db:
image: postgres:15.2-alpine
restart: always
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "5432:5432"
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- db
redis:
image: redis:7.0-alpine
restart: always
ports:
- "6379:6379"
networks:
- redis
volumes:
certbot-etc:
certbot-var:
web-root:
driver: local
db:
driver: local
networks:
certs-network:
driver: bridge
db:
driver: bridge
redis:
driver: bridge