-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
109 lines (103 loc) · 4.01 KB
/
docker-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
version: '2'
services:
### DB START
# This is the database to which the all the other components in the stack will connect and interact with
# (but mostly it's PostgREST that is going to be responsible for the bulk of the db traffic)
# Having the database in a container is very convenient in development but in production you will
# use a separate database instance, like Amazon RDS, i.e. in production this section will be
# commented and in the .env file you will specify the ip of your separate database instance
db:
image: postgres:${PG_VERSION}
ports:
- "5432:5432"
environment:
# env vars specific to postgres image used on first boot
- POSTGRES_USER=${SUPER_USER}
- POSTGRES_PASSWORD=${SUPER_USER_PASSWORD}
- POSTGRES_DB=${DB_NAME}
# env vars useful for our sql scripts
- SUPER_USER=${SUPER_USER}
- SUPER_USER_PASSWORD=${SUPER_USER_PASSWORD}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- DB_ANON_ROLE=${DB_ANON_ROLE}
- DEVELOPMENT=${DEVELOPMENT}
- JWT_SECRET=${JWT_SECRET}
volumes:
- "./db/src:/docker-entrypoint-initdb.d"
- "./tests/.db-data:/var/lib/postgresql/data"
### DB END
# PostgREST instance, is responsible for communicating with the database
# and providing a REST api, (almost) every request that is sent to the database goes through it
# postgrest:
# image: postgrest/postgrest
# ports:
# - "3000:3000"
# links:
# - db:db
# environment:
# - PGRST_DB_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
# - PGRST_DB_SCHEMA=${DB_SCHEMA}
# - PGRST_DB_ANON_ROLE=${DB_ANON_ROLE}
# - PGRST_DB_POOL=${DB_POOL}
# - PGRST_JWT_SECRET=${JWT_SECRET}
# - PGRST_MAX_ROWS=${MAX_ROWS}
# - PGRST_PRE_REQUEST=${PRE_REQUEST}
# - PGRST_SERVER_PROXY_URI=${SERVER_PROXY_URI}
# depends_on:
# - db
# # OpenResty (Nginx + Lua) instance that sits in front of PostgREST.
# # All the requests coming into the system are first hitting this component.
# # After some processing/checks and transformation, the request is forwarded
# # to PostgREST down the stack.
# openresty:
# image: openresty/openresty:stretch
# command: ["/usr/bin/openresty", "-g", "daemon off; error_log /dev/stderr info;"]
# ports:
# - "8080:80"
# links:
# - db:db
# # - postgrest:postgrest
# environment:
# - JWT_SECRET=${JWT_SECRET}
# - DEVELOPMENT=${DEVELOPMENT}
# - POSTGREST_HOST=${POSTGREST_HOST}
# - POSTGREST_PORT=${POSTGREST_PORT}
# - DB_HOST=${DB_HOST}
# - DB_PORT=${DB_PORT}
# - DB_NAME=${DB_NAME}
# - DB_SCHEMA=${DB_SCHEMA}
# - DB_USER=${DB_USER}
# - DB_PASS=${DB_PASS}
# volumes:
# - "./openresty/nginx:/usr/local/openresty/nginx/conf"
# - "./openresty/html:/usr/local/openresty/nginx/html"
# - "./openresty/lua:/usr/local/openresty/nginx/lua"
# depends_on:
# - db
# # pg-amqp-bridge instance is responsible for forwarding NOTIFY events in PostgreSQL
# # to RabbitMQ based on the BRIDGE_CHANNELS configuration
# pg_amqp_bridge:
# image: subzerocloud/pg-amqp-bridge
# links:
# - db
# - rabbitmq
# environment:
# - RUST_LOG=info # output forwarded messages
# - POSTGRESQL_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
# - AMQP_URI=amqp://${RABBITMQ_DEFAULT_USER}:${RABBITMQ_DEFAULT_PASS}@rabbitmq//
# - BRIDGE_CHANNELS=events:amq.topic
# depends_on:
# - db
# # RabbitMQ instance can be used to consolidate events that originated in your database/application.
# # You can connect here with different consumers and take actions based on those events (like sending signup emails)
# rabbitmq:
# image: rabbitmq:3-management
# ports:
# - "5671:5671"
# - "5672:5672"
# - "15672:15672"
# environment:
# - RABBITMQ_DEFAULT_USER=${RABBITMQ_DEFAULT_USER}
# - RABBITMQ_DEFAULT_PASS=${RABBITMQ_DEFAULT_PASS}