-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
148 lines (140 loc) · 10.7 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
# ----------------------------------------------------------------------------------------------------
# Portainer Template for Timebase Infrastructure
# Includes Timebase Historian, Explorer, Collector, Node-RED, and EMQX MQTT Broker
# ----------------------------------------------------------------------------------------------------
# References:
# - https://timebase.flow-software.com/en/knowledge-base/start-here
# - https://github.com/node-red/node-red
# - https://github.com/emqx/emqx
# ----------------------------------------------------------------------------------------------------
services:
# Timebase Historian Service
timebase-historian:
image: timebase/historian:${HISTORIAN_TAG:-latest} # Docker image for Timebase Historian with variable tag
hostname: ${HISTORIAN_HOSTNAME:-historian} # Hostname used for internal networking
container_name: ${HISTORIAN_CONTAINER_NAME:-historian} # Container name for easier management
ports:
- "${HISTORIAN_PORT:-4511}:4511" # Map the Historian REST API port
restart: unless-stopped # Automatically restart unless stopped manually
volumes:
- historian-data:/timebase/data
- historian-logs:/timebase/logs
networks:
- timebase-network # Connect to the shared application network
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/4511 || exit 1'"] # Health check for listening on port 4511
interval: 10s # Run the health check every 10 seconds
timeout: 5s # Fail the check if no response within 5 seconds
retries: 3 # Retry up to 3 times before failing
start_period: 30s # Grace period before health checks start
# Timebase Collector Service
timebase-collector:
image: timebase/collector:${COLLECTOR_TAG:-latest} # Docker image for Timebase Collector with variable tag
hostname: ${COLLECTOR_HOSTNAME:-collector} # Hostname used for internal networking
container_name: ${COLLECTOR_CONTAINER_NAME:-collector} # Container name for easier management
ports:
- "${COLLECTOR_PORT:-4521}:4521" # Map the Collector REST API port
restart: unless-stopped # Automatically restart unless stopped manually
depends_on:
timebase-historian:
condition: service_healthy # Wait until Historian service is healthy
mqtt-broker:
condition: service_healthy # Wait until MQTT Broker is healthy
volumes:
- collector-config:/timebase/config
- collector-data:/timebase/data
- collector-logs:/timebase/logs
environment:
- ACTIVE=${COLLECTOR_ACTIVE:-false} # Set the initial state of the Collector service
networks:
- timebase-network # Connect to the shared application network
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/4521 || exit 1'"] # Health check for listening on port 4521
interval: 10s # Run the health check every 10 seconds
timeout: 5s # Fail the check if no response within 5 seconds
retries: 3 # Retry up to 3 times before failing
start_period: 30s # Grace period before health checks start
# Timebase Explorer Service
timebase-explorer:
image: timebase/explorer:${EXPLORER_TAG:-latest} # Docker image for Timebase Explorer with variable tag
hostname: ${EXPLORER_HOSTNAME:-explorer} # Hostname used for internal networking
container_name: ${EXPLORER_CONTAINER_NAME:-explorer} # Container name for easier management
ports:
- "${EXPLORER_PORT:-4531}:4531" # Map the Explorer Web UI port
restart: unless-stopped # Automatically restart unless stopped manually
depends_on:
timebase-historian:
condition: service_healthy # Wait until Historian service is healthy
volumes:
- explorer-config:/timebase/config
- explorer-logs:/timebase/logs
networks:
- timebase-network # Connect to the shared application network
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/4531 || exit 1'"] # Health check for listening on port 4531
interval: 10s # Run the health check every 10 seconds
timeout: 5s # Fail the check if no response within 5 seconds
retries: 3 # Retry up to 3 times before failing
start_period: 30s # Grace period before health checks start
# Node-RED Service
node-red:
image: nodered/node-red:${NODERED_TAG:-latest} # Docker image for Node-RED with variable tag
hostname: ${NODERED_HOSTNAME:-node-red} # Hostname used for internal networking
container_name: ${NODERED_CONTAINER_NAME:-node-red} # Container name for easier management
ports:
- "${NODERED_PORT:-1880}:1880" # Map the Node-RED Web UI port
restart: unless-stopped # Automatically restart unless stopped manually
depends_on: # Ensure this service starts after its dependencies
mqtt-broker:
condition: service_healthy # Wait until MQTT Broker is healthy
volumes:
- node-red-data:/data
networks:
- timebase-network # Connect to the shared application network
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/1880 || exit 1'"] # Health check for listening on port 1880
interval: 10s # Run the health check every 10 seconds
timeout: 5s # Fail the check if no response within 5 seconds
retries: 3 # Retry up to 3 times before failing
start_period: 30s # Grace period before health checks start
# EMQX MQTT Broker Service
mqtt-broker:
image: emqx/emqx:${EMQX_TAG:-latest} # Docker image for EMQX MQTT Broker with variable tag
hostname: ${EMQX_HOSTNAME:-broker} # Hostname used for internal networking
container_name: ${EMQX_CONTAINER_NAME:-broker} # Container name for easier management
ports:
- "${EMQX_MQTT_PORT:-1883}:1883" # Map the MQTT port
- "${EMQX_WS_PORT:-8083}:8083" # Map the WebSocket port
- "${EMQX_DASHBOARD_PORT:-18083}:18083" # Map the Management Dashboard port
restart: unless-stopped # Automatically restart unless stopped manually
volumes:
- emqx-data:/opt/emqx/data
- emqx-etc:/opt/emqx/etc
- emqx-log:/opt/emqx/log
environment:
- EMQX_ALLOW_ANONYMOUS=${EMQX_ALLOW_ANONYMOUS:-true} # Allow anonymous connections to the MQTT Broker
networks:
- timebase-network # Connect to the shared application network
healthcheck:
test: ["CMD", "/opt/emqx/bin/emqx", "ctl", "status"] # Health check for EMQX service status
interval: 5s # Run the health check every 5 seconds
timeout: 30s # Fail the check if no response within 30 seconds
retries: 5 # Retry the health check up to 5 times before failing
# Volumes for persistent data storage
volumes:
historian-data: # Volume for storing Historian data
historian-logs: # Volume for storing Historian logs
explorer-config: # Volume for storing Explorer configuration
explorer-logs: # Volume for storing Explorer logs
collector-config: # Volume for storing Collector configuration
collector-data: # Volume for storing Collector data
collector-logs: # Volume for storing Collector logs
node-red-data: # Volume for storing Node-RED flows and configurations
emqx-data: # Volume for storing EMQX data
emqx-etc: # Volume for storing EMQX configuration
emqx-log: # Volume for storing EMQX logs
# Dedicated network for service communication
networks:
timebase-network:
name: timebase-network
driver: bridge