forked from stefanprodan/gomicro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainers-up.sh
59 lines (53 loc) · 1.33 KB
/
containers-up.sh
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
#!/bin/bash
set -e
image="gomicro"
network="gomicro-net"
# build image
if [ ! "$(docker images -q $image)" ];then
docker build -t $image ./src/gomicro
fi
# create network
if [ ! "$(docker network ls --filter name=$network -q)" ];then
docker network create $network
fi
# start workers
docker run -d -p 3020:3000 \
--name "${image}-worker" \
--network "$network" \
--restart unless-stopped \
-e "SERVICE_NAME=${image}-worker" \
-e "SERVICE_TAGS=gomicro,production" \
-e SERVICE_CHECK_HTTP="/ping" \
-e SERVICE_CHECK_INTERVAL="15s" \
-e ENV="PROD" \
-e ROLE="worker" \
-e PORT="3000" \
$image
# start proxy
docker run -d -p 3010:3000 \
--name "${image}-proxy" \
--network "$network" \
--restart unless-stopped \
-e "SERVICE_NAME=${image}-proxy" \
-e "SERVICE_TAGS=gomicro,production" \
-e SERVICE_CHECK_HTTP="/ping" \
-e SERVICE_CHECK_INTERVAL="15s" \
-e ENV="PROD" \
-e ROLE="proxy" \
-e PORT="3000" \
-e ENDPOINTS="http://${image}-worker:3000" \
$image
# start monitor
docker run -d -p 3030:3000 \
--name "${image}-monitor" \
--network "$network" \
--restart unless-stopped \
-e "SERVICE_NAME=${image}-monitor" \
-e "SERVICE_TAGS=gomicro,production" \
-e SERVICE_CHECK_HTTP="/ping" \
-e SERVICE_CHECK_INTERVAL="15s" \
-e ENV="PROD" \
-e ROLE="monitor" \
-e PORT="3000" \
-e ENDPOINTS="http://${image}-worker:3000,http://${image}-proxy:3000" \
$image