-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yml
82 lines (71 loc) · 2.29 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
---
# This docker-compose file has two purposes:
# - it shows how to create a postgres-s3 container
# - it provides regression tests
version: "2"
services:
# source-db is the 'master' database.
source-db:
image: postgres:9.5
environment:
POSTGRES_DB: source
POSTGRES_USER: source_user
POSTGRES_PASSWORD: source_pass
# postgres-s3 is the basic backup/restore tool for source-db
postgres-s3:
build: postgres-s3
links:
- "source-db:database" # target database should always be called `database`
- "fake-s3:fake-s3" # we fake the endpoint
environment:
POSTGRES_DB: source
POSTGRES_USER: source_user
POSTGRES_PASSWORD: source_pass
S3_BUCKET: s3://backup.bucket
S3_ENDPOINT: http://fake-s3:4569 # See http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region for a list of valid endpoints
S3_REGION: eu-central-1
AWS_ACCESS_KEY_ID: FAKE
AWS_SECRET_ACCESS_KEY: ALSO_FAKE
# target-db is an empty database we want to restore to
target-db:
image: postgres:9.5
environment:
POSTGRES_DB: target
POSTGRES_USER: target_user
POSTGRES_PASSWORD: target_pass
# postgres-s3 can read from arbitrary S3 files
postgres-s3-target:
build: postgres-s3
links:
- "target-db:database" # target database should always be called `database`
- "fake-s3:fake-s3" # we fake the endpoint
environment:
POSTGRES_DB: target
POSTGRES_USER: target_user
POSTGRES_PASSWORD: target_pass
S3_BUCKET: s3://backup.bucket
S3_ENDPOINT: http://fake-s3:4569
S3_REGION: eu-central-1
S3_FILE: source.pgdump
AWS_ACCESS_KEY_ID: FAKE
AWS_SECRET_ACCESS_KEY: ALSO_FAKE
PG_RESTORE_ARGS: --no-acl --no-owner
# fake-s3 is a fake S3 provider so we can test for free
fake-s3:
image: lphoward/fake-s3
# the tests container contains Roundup tests
tests:
build: ./tests
environment:
SOURCE_DB: source
SOURCE_USER: source_user
SOURCE_PASSWORD: source_pass
TARGET_DB: target
TARGET_USER: target_user
TARGET_PASSWORD: target_pass
links:
- "source-db:source-db"
- "target-db:target-db"
- "fake-s3:fake-s3"
- "postgres-s3:postgres-s3"
- "postgres-s3-target:postgres-s3-target"