-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (125 loc) · 4.27 KB
/
docker-compose.yml
File metadata and controls
125 lines (125 loc) · 4.27 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
services:
autocert-api:
build:
context: .
dockerfile: ./Dockerfile
volumes:
# Important to bind/mount codebase dir to /app dir for live reload
- ./:/app
ports:
- 8080:8080
environment:
DB_HOST: psql-db
depends_on:
rabbitmq:
condition: service_healthy
psql-db:
condition: service_healthy
command: ["air", "-c", ".air.toml"]
autocert-cert-worker:
build:
context: .
dockerfile: ./Dockerfile
volumes:
# Important to bind/mount codebase dir to /worker dir for live reload
- ./:/app
environment:
DB_HOST: psql-db
RABBITMQ_HOST: rabbitmq
depends_on:
rabbitmq:
condition: service_healthy
psql-db:
condition: service_healthy
command: ["go", "run", "./cmd/cert_consumer"]
# command: ["air", "-c", ".air.cert_consumer.toml"]
autocert-mail-worker:
build:
context: .
dockerfile: ./Dockerfile
volumes:
# Important to bind/mount codebase dir to /worker dir for live reload
- ./:/app
environment:
DB_HOST: psql-db
RABBITMQ_HOST: rabbitmq
depends_on:
rabbitmq:
condition: service_healthy
psql-db:
condition: service_healthy
command: ["go", "run", "./cmd/mail_consumer"]
# command: ["air", "-c", ".air.mail_consumer.toml"]
psql-db:
image: postgres
environment:
# Automatically create database based on the name of the database in .env file
POSTGRES_DB: ${DB_DATABASE}
POSTGRES_USER: ${DB_USERNAME}
POSTGRES_PASSWORD: ${DB_PASSWORD}
ports:
# host port: postgres tcp port
- "5432:5432"
volumes:
# Mount database data so that even if the container got deleted, the volume would still be there unless deleted by us
- psql_db_data:/var/lib/postgresql
# Uncomment below if you want to use an initialization script
# - "./_sql_file_name_here>.sql:/docker-entrypoint-initdb.d/1.sql"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME}"]
interval: 10s
timeout: 5s
retries: 5
# Service name should be use '-' instead of '_'
# See: https://github.com/minio/minio/issues/15006#issuecomment-1141639468
s3-minio:
image: minio/minio:latest
ports:
# MinIO API endpoint
- "9000:9000"
# MinIO Console (optional)
- "9001:9001"
volumes:
- minio_data:/data
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER}
# The command starts MinIO in server mode, and the console is available on port 9001.
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD}
# Can remove if prod
command: "server /data --console-address :9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 10s
retries: 3
# extra_hosts:
# - "host.docker.internal:host-gateway"
# https://medium.com/@kaloyanmanev/how-to-run-rabbitmq-in-docker-compose-e5baccc3e644
rabbitmq:
image: rabbitmq:latest
restart: always
ports:
- "5672:5672" # RabbitMQ default port
- "15672:15672" # RabbitMQ management console
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD}
configs:
- source: rabbitmq-plugins
target: /etc/rabbitmq/enabled_plugins
volumes:
- rabbitmq-lib:/var/lib/rabbitmq/
- rabbitmq-log:/var/log/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "status"]
interval: 10s
timeout: 5s
retries: 5
configs:
rabbitmq-plugins:
content: "[rabbitmq_management]."
volumes:
psql_db_data:
minio_data:
rabbitmq-lib:
rabbitmq-log: