-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose.yml
140 lines (131 loc) · 3.92 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
version: "3.3"
services:
prometheus:
build:
context: ./prometheus
dockerfile: Dockerfile
cache_from:
- 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/prometheus:${IMAGE_TAG}
image: 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/prometheus:${IMAGE_TAG}
ports:
- 9090:9090
volumes:
- ../storage-node-data/prometheus_data:/prometheus
entrypoint: ./prometheus/entrypoint.sh ${ADMIN_USER} ${ADMIN_PASSWORD}
# nginx will be listening on port 12321
# must create /etc/nginx/sites-available/prometheus-proxy, symbolically link it in /etc/nginx/sites-enabled,
# and restart nginx. More info in README.
networks:
- promnet
influxdb:
build:
context: ./influxdb
dockerfile: Dockerfile
cache_from:
- 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/influxdb:${IMAGE_TAG}
image: 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/influxdb:${IMAGE_TAG}
networks:
- promnet
ports:
- 8083:8083
- 8086:8086
- 8090:8090
restart: "always"
volumes:
- ../storage-node-data/influxdb_data:/var/lib/influxdb
environment:
- INFLUXDB_DB=prometheus
- INFLUXDB_ADMIN_USER=${ADMIN_USER}
- INFLUXDB_ADMIN_PASSWORD=${ADMIN_PASSWORD}
- INFLUXDB_USER=${ADMIN_USER}
- INFLUXDB_USER_PASSWORD=${ADMIN_PASSWORD}
- INFLUXDB_READ_USER=${ADMIN_USER}
- INFLUXDB_READ_USER_PASSWORD=${ADMIN_PASSWORD}
# Explore current machine metric for prometheus to scrape.
node-exporter:
image: prom/node-exporter
ports:
- 9100:9100
networks:
- promnet
# If we decide to turn on our own grafana dashboard
# grafana:
# image: grafana/grafana
# environment:
# - GF_SECURITY_ADMIN_PASSWORD=<your_password>
# - GF_SERVER_HTTP_PORT=3100
# depends_on:
# - prometheus
# ports:
# - 3100:3100
# volumes:
# - ../storage-node-data/grafana_data:/var/lib/grafana
# networks:
# - promnet
storage-node:
build:
context: "."
cache_from:
- 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/storage-node:${IMAGE_TAG}
image: 174232317769.dkr.ecr.${AWS_REGION}.amazonaws.com/storage-node:${IMAGE_TAG}
restart: "always"
ports:
- ${APP_PORT:-3000}:3000
env_file:
- ".env"
depends_on:
- "db"
volumes:
- "../storage-node-data/badger/prod:/var/lib/badger/prod"
- "../storage-node-data/badger/test:/var/lib/badger/test"
working_dir: "/go/src/github.com/opacity/storage-node"
command: >
bash -c "
echo waiting for db...;
while ! nc -z db 3306;
do
sleep 0.5;
free -m;
done;
echo ${DEBUG}
if [ -z ${DEBUG} ]; then
echo \"Starting Storage node in PROD mode\";
go build -ldflags='-X main.GO_ENV=${GO_ENV} -X main.VERSION=${VERSION}' -o ./bin/storage-node && chmod +x ./bin/storage-node;
./bin/storage-node;
else
go get -d github.com/codegangsta/gin
echo \"Starting Storage node in DEV mode\";
gin --buildArgs \"-ldflags '-X main.GO_ENV=${GO_ENV} -X main.VERSION=${VERSION}'\" run main.go
fi
"
networks:
- promnet
- dbnet
db:
container_name: mysql
image: mysql:5.7
restart: "always"
command: --sql_mode=''
# command: mysqld --sql_mode=''
environment:
- MYSQL_DATABASE=test
- MYSQL_ROOT_USER=root
- MYSQL_ROOT_PASSWORD=secret
ports:
- "33060:3306"
volumes:
- "../storage-node-data/db/mysql:/var/lib/mysql"
networks:
- dbnet
# In order for each service to connect to each other, They need to be on the same
# network and use name like "storage-node", "db", "prometheus" for reference. Ex: "db:3306", "storage-node:3000".
networks:
promnet:
driver: bridge
dbnet:
driver: bridge
volumes:
prometheus_data: {}
influxdb_data: {}
prometheus_data: {}
# grafana_data: {}