forked from feynmanliang/subzero-starter-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
199 lines (175 loc) · 8.37 KB
/
Copy pathdocker-compose.yml
File metadata and controls
199 lines (175 loc) · 8.37 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
version: '2'
services:
### DB START
# This is the database to which the all the other components in the stack will connect and interact with
# 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:
- "${DB_PORT}:5432"
environment:
# the values are defined in the .env file
# 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"
### DB END
# =====================================================================================================
# Fontend & API section
# =====================================================================================================
# This is the central image that enables REST & GraphQL api over the database
# it bundles PostgREST+ and OpenResty together to simplify deployment and to achieve
# secure and fast communication between these two components over local unix sockets.
# You can see how this image is built here https://github.com/subzerocloud/subzero-container/
subzero:
# this is a development image limited to 1 database connection in the pool
image: subzerocloud/subzero-development:latest
# for selfhosting in production use the image below (you'll need a 'On Premise' subscription)
# image: registry.subzero.cloud/subzero
ports:
- "8080:80"
- "8443:443"
environment:
# the values are defined in the .env file
# postgrest specific settings
- PGRST_DB_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?application_name=subzero
- PGRST_JWT_SECRET=${JWT_SECRET}
- PGRST_DB_SCHEMA=${DB_SCHEMA}
- PGRST_DB_ANON_ROLE=${DB_ANON_ROLE}
- PGRST_SERVER_PROXY_URI=${SERVER_PROXY_URI}
# uncomment to also see postgrest output in the logs
# - PGRST_LOGFILE=/dev/fd/1
# - PGRST_LOG_LEVEL=info
# openresty
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_NAME=${DB_NAME}
- DB_SCHEMA=${DB_SCHEMA}
- DB_USER=${DB_USER}
- DB_PASS=${DB_PASS}
- JWT_SECRET=${JWT_SECRET}
- DB_ANON_ROLE=${DB_ANON_ROLE}
- DEVELOPMENT=${DEVELOPMENT}
- ENABLE_CACHE=${ENABLE_CACHE}
- ERR_LOGLEVEL=info
# oauth providers
- OAUTH_SUCCESS_URI=/rest/rpc/on_oauth_login
- OAUTH_GOOGLE_CLIENT_ID=${OAUTH_GOOGLE_CLIENT_ID}
- OAUTH_GOOGLE_CLIENT_SECRET=${OAUTH_GOOGLE_CLIENT_SECRET}
- OAUTH_GITHUB_CLIENT_ID=${OAUTH_GITHUB_CLIENT_ID}
- OAUTH_GITHUB_CLIENT_SECRET=${OAUTH_GITHUB_CLIENT_SECRET}
- OAUTH_FACEBOOK_CLIENT_ID=${OAUTH_FACEBOOK_CLIENT_ID}
- OAUTH_FACEBOOK_CLIENT_SECRET=${OAUTH_FACEBOOK_CLIENT_SECRET}
# auto-ssl list the domains separated by comma for which an ssl certificate shoudl be fetched
# - SSL_ALLOWED_DOMAINS="mydomain.com"
volumes:
- "./html:/usr/local/openresty/nginx/html"
# =====================================================================================================
# Database Event Capture components
# =====================================================================================================
# pg-event-proxy instance is responsible for forwarding NOTIFY or WAL events in PostgreSQL
# it can forward events to multiple upstreams / topics / queues at the same time
# to an upstream server, current supported upstream protocols are
# amqp 0.9 (RabbitMQ)
# mqtt (Apache ActiveMQ, Cassandana, HiveMQ, Mosquitto, RabbitMQ, AWS IoT, Amazon MQ, ...)
# redis pubsub (Redis)
# SNS (Amazon Simple Notification Service)
# SQS (Amazon Simple Queue Service)
# Lambda (AWS Lambda)
# more information about this component at https://github.com/subzerocloud/pg-event-proxy-example
# pg-event-proxy:
# container_name: pg-event-proxy
# image: subzerocloud/pg-event-proxy-development
# # for production use the image below (you'll need a 'On Premise' subscription)
# # image: registry.subzero.cloud/pg-event-proxy
# environment:
# - RUST_LOG=pg_event_proxy=info # output forwarded messages, use "debug" for more details
# # configuration using environment variables
# - PGPROXY_DATABASE-URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}
# # these configurations are only used when streaming WAL, the example below are the default values, uncomment only if you need to change them
# # - PGPROXY_DATABASE-REPLICATION_SLOT=pg_event_proxy
# # - PGPROXY_DATABASE-WAL2JSON_PARAMS=\"format-version\" '2' , \"include-types\" '0'
# # Configuration for RabbitMQ upstream
# # - PGPROXY_UPSTREAM-MYAMQP-KIND=amqp
# # - PGPROXY_UPSTREAM-MYAMQP-URI=amqp://user:pass@rabbitmq//
# # - PGPROXY_UPSTREAM-MYAMQP-BRIDGE_CHANNELS=amqpchannel->exchange:amq.topic
# # Configuration for Redis upstream
# # - PGPROXY_UPSTREAM-MYREDIS-KIND=redis
# # - PGPROXY_UPSTREAM-MYREDIS-URI=redis://default:pass@redis
# # - PGPROXY_UPSTREAM-MYREDIS-BRIDGE_CHANNELS=redischannel->topic:events
# # Configuration for MQTT upstream
# # - PGPROXY_UPSTREAM-MYMQTT-KIND=mqtt
# # - PGPROXY_UPSTREAM-MYMQTT-URI=mqtt://user:pass@mqtt:1883 # schema can be mqtt (tcp), mqtts (ssl), ws, wss
# # - PGPROXY_UPSTREAM-MYMQTT-BRIDGE_CHANNELS=mqttchannel->topic:events
# # these vars are used for AWS upstreams
# # - AWS_ACCESS_KEY_ID=key
# # - AWS_SECRET_ACCESS_KEY=secret
# # Configuration for SNS upstream
# # - PGPROXY_UPSTREAM-MYSNS-KIND=awssns
# # - PGPROXY_UPSTREAM-MYSNS-URI=aws://sqs-mock:9911 # in production replace with aws://us-east-1 (i.e. the region id)
# # - PGPROXY_UPSTREAM-MYSNS-BRIDGE_CHANNELS=snschannel->topic:arn:aws:sns:eu-west-2:123450000001:test-topic
# # Configuration for SQS upstream
# # - PGPROXY_UPSTREAM-MYSQS-KIND=awssqs
# # - PGPROXY_UPSTREAM-MYSQS-URI=aws://sqs-mock:9911 # in production replace with aws://us-east-1 (i.e. the region id)
# # - PGPROXY_UPSTREAM-MYSQS-BRIDGE_CHANNELS=sqschannel->queue:default
# # # Configuration for LAMBDA upstream
# # - PGPROXY_UPSTREAM-MYLAMBDA-KIND=awslambda
# # - PGPROXY_UPSTREAM-MYLAMBDA-URI=aws://us-east-1
# # - PGPROXY_UPSTREAM-MYLAMBDA-BRIDGE_CHANNELS=lambdachannel->function:HelloWorldFunction
# All the containers below are to facilitate local development.
# In production these would be external services,
# you can delete all of them and leave only the upstream you will be using
# rabbitmq:
# container_name: rabbitmq
# image: rabbitmq:3-management
# ports:
# - "5672:5672"
# - "15672:15672"
# environment:
# - RABBITMQ_DEFAULT_USER=user
# - RABBITMQ_DEFAULT_PASS=pass
# redis:
# container_name: redis
# image: "redis:alpine"
# ports:
# - "6379:6379"
# command: redis-server --requirepass pass
# mqtt:
# container_name: mqtt
# image: eclipse-mosquitto
# ports:
# - "1883:1883"
# - "9001:9001"
# volumes:
# - .configurations/mosquitto.conf:/mosquitto/config/mosquitto.conf
# - .configurations/mosquitto.pwd:/mosquitto/config/mosquitto.pwd
# sqs-mock:
# container_name: sqs-mock
# image: roribio16/alpine-sqs:latest
# entrypoint: sh -c "/opt/sqs-init.sh && /opt/jdk/bin/java -Dconfig.file=/opt/config/elasticmq.conf -jar /opt/elasticmq-server.jar"
# ports:
# - "9324:9324"
# - "9325:9325"
# # sns has a topic configured to forward events to sqs-mock default queue
# sns-mock:
# container_name: sns-mock
# image: s12v/sns
# volumes:
# - .configurations/sns.conf:/etc/sns/db.json
# - .configurations/wait-for-tcp.sh:/wait-for-tcp.sh
# command: chmod +x /wait-for-tcp.sh && /wait-for-tcp.sh sqs-mock 9324 -- java -jar /sns.jar
# ports:
# - "9911:9911"