forked from ankane/pgsync
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
59 lines (59 loc) · 1.71 KB
/
docker-compose.yml
File metadata and controls
59 lines (59 loc) · 1.71 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
version: '3'
services:
db1:
image: postgres:9.5
ports:
- "5433:5432"
environment:
POSTGRES_DB: ${SRC_DB}
POSTGRES_USER: ${SRC_USER}
POSTGRES_PASSWORD: ${SRC_PASS}
volumes:
- "./add-data.sql:/docker-entrypoint-initdb.d/add-data.sql"
- "db1-pgdata:/var/lib/postgresql/data"
db2:
image: postgres:10
ports:
- "5434:5432"
environment:
POSTGRES_DB: ${DEST_DB}
POSTGRES_USER: ${DEST_USER}
POSTGRES_PASSWORD: ${DEST_PASS}
volumes:
- "db2-pgdata:/var/lib/postgresql/data"
db-sync:
build: ../..
links:
- db1:db1
- db2:db2
environment:
FROM_USER: ${SRC_USER}
FROM_PASS: ${SRC_PASS}
FROM_HOST: db1
FROM_PORT: 5432
FROM_DB: ${SRC_DB}
TO_USER: ${DEST_USER}
TO_PASS: ${DEST_PASS}
TO_HOST: db2
TO_PORT: 5432
TO_DB: ${DEST_DB}
# uncomment and add your DSN to enable Sentry.io reporting. A simple way
# to trigger an error is to change TO_HOST: db99 (invalid hostname).
# SENTRY_DSN: 'https://11111111111111111111111111111111@o222222.ingest.sentry.io/3333333'
# note: don't override the entrypoint when using this container, this is just for a demo to run SQL after the sync
entrypoint: |
/bin/sh -c "
echo 'waiting for DBs' && \
sleep 10 && \
SCHEMA_ONLY=1 /bin/sh /app/run.sh && \
/bin/sh /app/run.sh && \
sleep 1 && \
PGPASSWORD=pass psql -h db2 -U user -d db2 -c 'select * from blah;' && \
echo 'Now running under cron every minute, use ctrl+c to exit' && \
CRON_SCHEDULE='* * * * *' exec /app/entrypoint.sh"
depends_on:
- db1
- db2
volumes:
db1-pgdata:
db2-pgdata: