-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
90 lines (84 loc) · 3.22 KB
/
Copy pathdocker-compose.yml
File metadata and controls
90 lines (84 loc) · 3.22 KB
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
# Reusable block of DB connection env vars shared by every machine service.
# This is a top-level extension field (must live OUTSIDE `services:`), anchored
# with &machine-env and referenced below with *machine-env.
x-machine-env: &machine-env
PGHOST: postgres
PGPORT: "5432"
PGDATABASE: plant
PGUSER: sensors
PGPASSWORD: sensors_pw
services:
# ---------------------------------------------------------------------------
# The "data warehouse": a plain Postgres instance the sensors write into and
# Metabase reads from. In a real plant this is your IT/cloud landing zone.
# ---------------------------------------------------------------------------
postgres:
image: postgres:16
environment:
POSTGRES_USER: sensors
POSTGRES_PASSWORD: sensors_pw
POSTGRES_DB: plant
ports:
- "5432:5432" # exposed so you can also query with psql / DBeaver
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sensors -d plant"]
interval: 5s
timeout: 3s
retries: 12
# ---------------------------------------------------------------------------
# Metabase: the open-source BI layer. Open http://localhost:3000 after start.
# It keeps its own app state in a small embedded DB on the named volume; the
# ANALYTICS data lives in Postgres, which you add as a data source in the UI.
# ---------------------------------------------------------------------------
metabase:
image: metabase/metabase:latest
ports:
- "3000:3000"
volumes:
- mbdata:/metabase-data
environment:
MB_DB_FILE: /metabase-data/metabase.db
depends_on:
postgres:
condition: service_healthy
# ---------------------------------------------------------------------------
# Three "machines" from ONE image. Same build, same script; only the CMD
# arguments differ. This is the entrypoint/CMD pattern you asked for: the
# `command:` here is appended after the Dockerfile ENTRYPOINT and replaces
# the Dockerfile CMD. Each backfills history then streams live.
# ---------------------------------------------------------------------------
machine-cnc01:
build: ./sensor
environment: *machine-env
command: ["--machine-id", "CNC-01", "--machine-type", "L",
"--interval", "0.2", "--ideal-cycle-time", "30",
"--backfill", "2000", "--seed", "1"]
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
machine-cnc02:
build: ./sensor
environment: *machine-env
command: ["--machine-id", "CNC-02", "--machine-type", "M",
"--interval", "0.2", "--ideal-cycle-time", "25",
"--down-prob", "0.04", "--backfill", "2000", "--seed", "2"]
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
machine-press01:
build: ./sensor
environment: *machine-env
command: ["--machine-id", "PRESS-01", "--machine-type", "H",
"--interval", "0.2", "--ideal-cycle-time", "40",
"--defect-prob", "0.06", "--backfill", "2000", "--seed", "3"]
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
volumes:
pgdata:
mbdata: