-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
128 lines (120 loc) · 3.52 KB
/
docker-compose.yml
File metadata and controls
128 lines (120 loc) · 3.52 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
services:
gateway:
image: nginx:stable-alpine
container_name: gateway
volumes:
- ./gateway/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./services:/var/www/html
ports:
- "8080:80"
depends_on:
- user-service
- order-service
- notification-service
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_USER:-guest}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_PASSWORD:-guest}
ports:
- "15672:15672" # Web UI
- "5672:5672" # AMQP port
healthcheck:
test: [ "CMD", "rabbitmqctl", "status" ]
interval: 30s
timeout: 10s
retries: 3
user-service:
build: ./services/user-service
container_name: user-service
env_file:
- .env
- ./services/user-service/.env
volumes:
- ./services/user-service:/var/www/html
- ./shared:/var/www/html/shared
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@user-db:5432/${USER_DB_NAME}?serverVersion=15&charset=utf8
- MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages
depends_on:
- user-db
- rabbitmq
expose:
- "9000"
order-service:
build: ./services/order-service
container_name: order-service
env_file:
- .env
- ./services/order-service/.env
volumes:
- ./services/order-service:/var/www/html
- ./shared:/var/www/html/shared
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@order-db:5432/${ORDER_DB_NAME}?serverVersion=15&charset=utf8
depends_on:
- order-db
expose:
- "9000"
notification-service:
build: ./services/notification-service
container_name: notification-service
env_file:
- .env
- ./services/notification-service/.env
volumes:
- ./services/notification-service:/var/www/html
- ./shared:/var/www/html/shared
environment:
- DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@notification-db:5432/${NOTIFICATION_DB_NAME}?serverVersion=15&charset=utf8
- MESSENGER_TRANSPORT_DSN=amqp://${RABBITMQ_USER}:${RABBITMQ_PASSWORD}@rabbitmq:5672/%2f/messages
depends_on:
- notification-db
- rabbitmq
expose:
- "9000"
# Databases
user-db:
image: postgres:15
container_name: user-db
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${USER_DB_NAME}
volumes:
- user_data:/var/lib/postgresql/data
- ./postgres-init:/docker-entrypoint-initdb.d:ro
ports:
- "${USER_DB_PORT}:5432"
order-db:
image: postgres:15
container_name: order-db
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${ORDER_DB_NAME}
volumes:
- order_data:/var/lib/postgresql/data
- ./postgres-init:/docker-entrypoint-initdb.d:ro
ports:
- "${ORDER_DB_PORT}:5432"
notification-db:
image: postgres:15
container_name: notification-db
env_file: .env
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${NOTIFICATION_DB_NAME}
volumes:
- notification_data:/var/lib/postgresql/data
- ./postgres-init:/docker-entrypoint-initdb.d:ro
ports:
- "${NOTIFICATION_DB_PORT}:5432"
volumes:
user_data:
order_data:
notification_data: