-
Notifications
You must be signed in to change notification settings - Fork 9
/
pipeline.yaml
244 lines (230 loc) · 6.41 KB
/
pipeline.yaml
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# docker compose file for the complete ladder99 pipeline.
# can override these settings in setup-specific pipeline-overrides.yaml files.
# see sh/start for how to run
version: '3.8'
services:
# adapter - convert machine data to shdr and send to agent
adapter:
container_name: adapter
# image: ladder99/adapter:latest # use this if build docker image and push to hub
build: ../pipeline/adapter # see Dockerfile in this folder
# set this to give permission to access hardware (e.g. dymo scale in usb port).
#. security hole - leave off for now, until need dymo driver.
# privileged: true
profiles:
- all
- adapter
volumes:
- ../$SETUP:/data/setup # has setup.yaml etc
- ../modules:/data/modules # has module yamls
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# agent - take in shdr and output xml/json/html
agent:
container_name: agent
profiles:
- all
- html
- agent
image: ladder99/agent:latest
working_dir: /data/agent
command: agent debug agent.cfg
volumes:
- ../$SETUP/volumes/agent:/data/agent # should have agent.cfg, agent.xml
ports:
- 5000:5000
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# grafana - show real-time data from the database, handle notifications
grafana:
container_name: grafana
image: grafana/grafana:8.2.2
profiles:
- all
- dashboard
- grafana
ports:
- $GRAFANA_PORT:3000/tcp
environment:
# need these for provisioning datasources
#. don't use PGPASSWORD - how use .pgpass file with grafana tho?
PGHOST:
PGPORT:
PGDATABASE:
PGUSER:
PGPASSWORD:
# INFLUXDB_DB:
# INFLUXDB_USER:
# INFLUXDB_PASSWORD:
# grafana will download and install these automatically
# https://grafana.com/docs/grafana/latest/installation/docker/#install-plugins-in-the-docker-container
GF_INSTALL_PLUGINS: natel-discrete-panel,natel-plotly-panel,michaeldmoore-scatter-panel
volumes:
# note: grafana.ini is located in /etc/grafana by default -
# other folders are specified there.
- ../$SETUP/volumes/grafana/etc:/etc/grafana
- ../$SETUP/volumes/grafana/var:/var/lib/grafana
- ../dashboards/grafana:/etc/dashboards
# as of v7.3, the Grafana Docker image runs with the root group (id 0) instead
# of the grafana group (id 472), for better compatibility with OpenShift.
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# mosquitto - get mqtt data from devices and publish to mtconnect adapter
mosquitto:
container_name: mosquitto
image: eclipse-mosquitto
profiles:
- all
- mosquitto
ports:
- 1883:1883
volumes:
- ../$SETUP/volumes/mosquitto:/mosquitto # has config/mosquitto.conf
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# pgadmin - admin console for postgres database
pgadmin:
container_name: pgadmin
image: biarms/pgadmin4:latest
profiles:
- all
- pgadmin
ports:
- '5050:5050/tcp'
restart: always
networks:
- ladder99
deploy:
restart_policy:
condition: on-failure
# play - playback device recordings
play:
container_name: play
profiles:
- play
build: ../pipeline/recorder
command: recorder --mode play
ports:
- 8080:8080
volumes:
- ../$SETUP:/data/setup # has setup-specific recordings folder
- ../modules:/data/modules # has module-specific recordings folder
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# portainer - docker container viewer/management
portainer:
container_name: portainer
image: portainer/portainer-ce
profiles:
- all
- portainer
ports:
- '9001:9000' #.... changed from 9000:9000 - make envar
volumes:
# - /etc/localtime:/etc/localtime:ro
# - /etc/timezone:/etc/timezone:ro
- /var/run/docker.sock:/var/run/docker.sock
- ../$SETUP/volumes/portainer/data:/data
restart: always
networks:
- ladder99
logging:
driver: 'none'
# postgres - store structure and time-series data
postgres:
container_name: postgres
image: timescale/timescaledb:2.3.0-pg13
ports:
- $PGPORT:5432/tcp
profiles:
- all
- dashboard
- postgres
# init: true
#. don't use PGPASSWORD - see https://stackoverflow.com/a/6405162/243392
# https://www.postgresql.org/docs/9.1/libpq-pgpass.html
environment:
POSTGRES_DB: $PGDATABASE
POSTGRES_USERNAME: $PGUSER
POSTGRES_PASSWORD: $PGPASSWORD
volumes:
- ../$SETUP/volumes/postgres/data:/var/lib/postgresql/data
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# record - record device messages for future playback
record:
container_name: record
profiles:
- record
build: ../pipeline/recorder
command: recorder --mode record
volumes:
- ../$SETUP:/data/setup # has setup-specific recordings folder
- ../modules:/data/modules # has module-specific recordings folder
restart: always
networks:
- ladder99
logging:
options:
max-size: '10m'
# relay - fetch data from agent and send to db
relay:
container_name: relay
build: ../pipeline/relay
profiles:
- all
- dashboard
- relay
init: true
environment:
# override these as needed in pipeline-overrides.yaml
AGENT_ENDPOINTS: http://agent:5000
FETCH_INTERVAL: 2000
FETCH_COUNT: 800
PGHOST:
PGPORT:
PGDATABASE:
PGUSER:
PGPASSWORD:
# this fixes a problem on ubuntu - works on mac okay also
#. but not on friendlywrt - host-gateway doesn't exist, or need docker>=20.10
# see https://stackoverflow.com/a/67158212/243392
# and https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts
extra_hosts:
- 'host.docker.internal:host-gateway'
restart: always
networks:
- ladder99
# volumes:
# - ../pipeline/relay:/home/node/app # has source code
logging:
options:
max-size: '10m'
# superset - a sql-based dashboard application
networks:
ladder99:
name: ladder99