forked from gocardless/pgsql-cluster-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart
More file actions
executable file
·32 lines (27 loc) · 961 Bytes
/
start
File metadata and controls
executable file
·32 lines (27 loc) · 961 Bytes
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
#!/usr/bin/env bash
# Starts a cluster, booting into a bash session inside pg01. Logging into other
# machines can be done using docker exec:
#
# $ docker exec -it pg0X /bin/bash
# run-container => prints <container-id>
function run-container() {
docker run \
--name "$1" \
--hostname "$1" \
--privileged \
--detach \
--publish-all \
--volume "$(git rev-parse --show-toplevel):/pgsql-cluster-manager:v1" \
--volume "/var/run/docker.sock:/var/run/docker.sock" \
gocardless/postgres-member \
sh -c "while :; do sleep 1; done"
}
docker build -t gocardless/postgres-member .
docker rm -f pg01 pg02 pg03
PG01=$(run-container pg01)
PG02=$(run-container pg02)
PG03=$(run-container pg03)
docker exec --detach pg01 /bin/start-cluster "$PG01" "$PG02" "$PG03"
docker exec --detach pg02 /bin/start-cluster "$PG01" "$PG02" "$PG03"
docker exec --detach pg03 /bin/start-cluster "$PG01" "$PG02" "$PG03"
docker exec -it pg01 /bin/bash