-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
121 lines (117 loc) · 4.32 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
version: '3.1'
services:
postgres-fed:
image: postgres:9.6-alpine
restart: unless-stopped
volumes:
- ./pg_data:/var/lib/postgresql/data
- ./scripts/initdb.d:/docker-entrypoint-initdb.d
env_file: .env
environment:
- POSTGRES_USER=${FEDERATION_USER}
- POSTGRES_PASSWORD=${FEDERATION_PASSWORD}
- POSTGRES_DB=${FEDERATION_DB:-8800}
networks:
- catcat-unicorn-network
dns:
- 172.16.238.2
- 172.16.238.3
entrypoint: ""
command:
- /bin/sh
- -c
- |
# this command will automatically register the vault UI app as a consul service
set -ex
[ -d /consul ] || mkdir -p /consul/config /consul/data
[ -f /consul/config/postgres-fed.json ] || echo '{"service": {"name": "postgres-fed", "tags": [], "port": ${PORT}}}' > /consul/config/postgres-fed.json
type -p curl || (
until apk update; do sleep 3; done
# chmod 755 consul
until apk add curl; do sleep 3; done
)
grep consul /etc/group || addgroup -g 8000 -S consul
grep consul /etc/passwd || adduser -u 8000 -G consul -h /consul -S consul
type -p consul || (
cd /usr/local/bin
until echo 'f97996296ef3905c38c504b35035fb731d3cfd9cad129c9523402a4229c709c5 consul_1.2.3_linux_amd64.zip' | sha256sum -c -; do
curl -LO https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip
sleep 3
done
unzip consul_1.2.3_linux_amd64.zip
chmod 755 consul
rm consul_1.2.3_linux_amd64.zip
)
type -p consul-template || (
cd /usr/local/bin
until curl -L https://releases.hashicorp.com/consul-template/0.19.5/consul-template_0.19.5_linux_amd64.tgz | tar -xz; do
sleep 3
done
)
chown -R consul. /consul
su - -s /bin/sh consul -c /bin/sh -c 'nohup consul agent -join consul -config-dir=/consul/config -data-dir=/consul/data &'
# start the service
docker-entrypoint.sh postgres
federation-service:
container_name: catcat-federation-service
build:
context: .
dockerfile: Dockerfile
env_file: .env
restart: unless-stopped
environment:
- PORT=${PORT:-3000}
- FED_PORT=${FED_PORT:-3001}
image: catcatio/catcat-federation
working_dir: /usr/app
# ports:
# - "${PORT}:${PORT}"
# - "${FED_PORT}:${FED_PORT}"
volumes:
- .:/usr/app
depends_on:
- postgres-fed
networks:
- catcat-unicorn-network
dns:
- 172.16.238.2
- 172.16.238.3
entrypoint: ""
command:
- /bin/sh
- -c
- |
# this command will automatically register the vault UI app as a consul service
set -ex
[ -d /consul ] || mkdir -p /consul/config /consul/data
[ -f /consul/config/federation.json ] || echo '{"service": {"name": "federation", "tags": [], "port": ${PORT}}}' > /consul/config/federation.json
type -p curl || (
until apk update; do sleep 3; done
# chmod 755 consul
until apk add curl; do sleep 3; done
)
grep consul /etc/group || addgroup -g 8000 -S consul
grep consul /etc/passwd || adduser -u 8000 -G consul -h /consul -S consul
type -p consul || (
cd /usr/local/bin
until echo 'f97996296ef3905c38c504b35035fb731d3cfd9cad129c9523402a4229c709c5 consul_1.2.3_linux_amd64.zip' | sha256sum -c -; do
curl -LO https://releases.hashicorp.com/consul/1.2.3/consul_1.2.3_linux_amd64.zip
sleep 3
done
unzip consul_1.2.3_linux_amd64.zip
chmod 755 consul
rm consul_1.2.3_linux_amd64.zip
)
type -p consul-template || (
cd /usr/local/bin
until curl -L https://releases.hashicorp.com/consul-template/0.19.5/consul-template_0.19.5_linux_amd64.tgz | tar -xz; do
sleep 3
done
)
chown -R consul. /consul
su - -s /bin/sh consul -c /bin/sh -c 'nohup consul agent -join consul -config-dir=/consul/config -data-dir=/consul/data &'
# start the service
sh /usr/app/scripts/startup.sh
networks:
catcat-unicorn-network:
external: true