This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
129 lines (110 loc) · 4.85 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
version: '2'
services:
# pg-event-proxy instance is responsible for forwarding NOTIFY or WAL events in PostgreSQL
# to and upstream server, current supported upstream protocols are
# amqp 0.9 (RabbitMQ)
# mqtt (Apache ActiveMQ, Cassandana, HiveMQ, Mosquitto, RabbitMQ, AWS IoT, Amazon MQ, ...)
# redis
# awslambda, awssqs, awssns
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
depends_on:
- postgres
- rabbitmq
- redis
- mosquitto
- sqs-mock
- sns-mock
# configuration using a file
# volumes:
# - "./config_example.ini:/config.ini"
# command: /usr/bin/pg-event-proxy /config.ini
environment:
- RUST_LOG=pg_event_proxy=info # output forwarded messages, use "debug" for more details
# these vars are used for AWS upstream
- AWS_ACCESS_KEY_ID=key
- AWS_SECRET_ACCESS_KEY=secret
# configuration using environment variables
- PGPROXY_DATABASE-URI=postgres://user:pass@postgres:5432/app
# 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//
# format of "BRIDGE_CHANNELS" config is as follows
# pgchannel1->exchange:topic_exchange_name, pgchannel2->queue:queue_name, pgchannel3->topic:topic_name
# "wal2json" has a special meaning when used as a value for pgchannel
# in this case the replication events (WAL) will be streamed (as opposed to events from NOTIFY wal2json, ... query)
# for example "wal2json->exchange:amqp.topic" will stream WAL to "amqp.topic" exchange
# when streaming WAL, the database user needs to have REPLICATION privilege (see db/src/authorization/roles.sql)
- 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@mosquitto:1883 # schema can be mqtt (tcp), mqtts (ssl), ws, wss
- PGPROXY_UPSTREAM-MYMQTT-BRIDGE_CHANNELS=mqttchannel->topic:events
# 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
postgres:
image: subzerocloud/postgres_with_wal2json:12
ports:
- "5432:5432"
environment:
- POSTGRES_USER=user
- POSTGRES_PASSWORD=pass
- POSTGRES_DB=app
volumes:
- "./postgres:/docker-entrypoint-initdb.d"
rabbitmq:
image: rabbitmq:3-management
ports:
- "5672:5672"
- "15672:15672"
environment:
- RABBITMQ_DEFAULT_USER=user
- RABBITMQ_DEFAULT_PASS=pass
redis:
image: "redis:alpine"
ports:
- "6379:6379"
command: redis-server --appendonly yes --requirepass pass
mosquitto:
image: eclipse-mosquitto:1.6
ports:
- "1883:1883"
- "9001:9001"
volumes:
- ./mosquitto.conf:/mosquitto/config/mosquitto.conf
- ./mosquitto.pwd:/mosquitto/config/mosquitto.pwd
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:
image: s12v/sns
volumes:
- ./sns.conf:/etc/sns/db.json
- ./wait-for-tcp.sh:/wait-for-tcp.sh
command: /wait-for-tcp.sh sqs-mock 9324 -- java -jar /sns.jar
ports:
- "9911:9911"