forked from SINDAN/sindan-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
149 lines (141 loc) · 3.68 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
140
141
142
143
144
145
146
147
148
149
version: '3.7'
x-healthcheck:
&default-healthcheck
interval: "5s"
timeout: "1s"
retries: 3
start_period: "20s"
x-logging:
&default-logging
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
services:
fluentd:
image: sindan/fluentd:v1.6-1-rev1-rpi
build:
context: ./fluentd
hostname: sindan-fluentd
restart: always
depends_on:
- mysql
ports:
- "8080:8080"
- "8888:8888"
secrets:
- db_password
env_file:
- .env
environment:
DB_HOST: mysql
DB_PASSWORD_FILE: "/run/secrets/db_password"
healthcheck:
<<: *default-healthcheck
test: wget --spider http://127.0.0.1:8080/ || exit 1
logging: *default-logging
volumes:
- ./fluentd/fluent.conf:/fluentd/etc/fluent.conf
- fluentd-data:/fluentd/log
labels:
com.sindan-net.description: "Receive logs from sindan-clients and forward them to MySQL"
mysql:
image: hypriot/rpi-mysql
hostname: sindan-mysql
restart: always
expose:
- "3306"
secrets:
- db_password
environment:
# MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_ROOT_PASSWORD: "change_this"
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_GRANTED_USER}
MYSQL_PASSWORD_FILE: "/run/secrets/db_password"
healthcheck:
<<: *default-healthcheck
test: mysqladmin ping -h 127.0.0.1 -u $$MYSQL_USER --password=$$(cat $$MYSQL_PASSWORD_FILE)
logging: *default-logging
volumes:
- ./mysql/dump_database.sh:/dump_database.sh
- ./mysql/restore_database.sh:/restore_database.sh
- mysql-data:/var/lib/mysql
labels:
com.sindan-net.description: "Storing diagnosis logs for sindan-visualization"
visualization:
image: sindan/visualization:2.6.3-rpi
build:
context: ./visualization
target: production
hostname: sindan-visualization
restart: always
depends_on:
- mysql
ports:
- "3000:3000"
secrets:
- db_password
- rails_secret_key_base
- accounts
env_file:
- .env
environment:
DB_HOST: mysql
DB_PASSWORD_FILE: "/run/secrets/db_password"
RAILS_SECRETKEY_FILE: "/run/secrets/rails_secret_key_base"
ACCOUNTS_FILE: "/run/secrets/accounts"
command: bundle exec rails s -p 3000 -b '0.0.0.0'
healthcheck:
<<: *default-healthcheck
test: wget --spider http://127.0.0.1:3000/ || exit 1
timeout: "2s"
logging: *default-logging
volumes:
- visualization-data:/app
labels:
com.sindan-net.description: "Web frontend to manage diagnosis logs"
grafana:
image: sindan/grafana:6.5.0-rev1-rpi
build:
context: ./grafana
hostname: sindan-grafana
restart: always
depends_on:
- mysql
ports:
- "3001:3000"
secrets:
- db_password
- gf_user
- gf_password
logging: *default-logging
environment:
GF_PATHS_CONFIG: "/etc/grafana/config.ini"
GF_INSTALL_PLUGINS: "grafana-clock-panel"
GF_SECURITY_ADMIN_USER__FILE: "/run/secrets/gf_user"
GF_SECURITY_ADMIN_PASSWORD__FILE: "/run/secrets/gf_password"
healthcheck:
<<: *default-healthcheck
test: wget --spider http://127.0.0.1:3000/api/health || exit 1
timeout: "2s"
volumes:
- grafana-data:/var/lib/grafana
labels:
com.sindan-net.description: "Grafana dashboard"
secrets:
db_password:
file: .secrets/db_password.txt
rails_secret_key_base:
file: .secrets/rails_secret_key_base.txt
accounts:
file: .secrets/accounts.yml
gf_user:
file: .secrets/gf_user.txt
gf_password:
file: .secrets/gf_password.txt
volumes:
fluentd-data:
mysql-data:
visualization-data:
grafana-data: