-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yml
More file actions
96 lines (90 loc) · 3.08 KB
/
Copy pathcompose.yml
File metadata and controls
96 lines (90 loc) · 3.08 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
91
92
93
94
95
96
# Run the whole ghrian stack from the published images:
#
# cp .env.example .env # then fill in the generated secrets (see that file)
# docker compose up -d
#
# Then open http://localhost:3000 and create the first (admin) account. The broker
# connection is seeded from the env below on first boot, so you only need to add an
# inverter with topic ghrian/inverter/01. The agent (optional profile) publishes there.
#
# broker + web + listener start by default. The agent only starts with its
# profile (it needs a real inverter to talk to):
# docker compose --profile agent up -d
name: ghrian
configs:
mosquitto:
content: |
listener 1883
allow_anonymous true
persistence true
persistence_location /mosquitto/data/
log_dest stdout
volumes:
storage: # SQLite databases (shared by web + listener)
broker-data: # mosquitto persistence
services:
broker:
image: eclipse-mosquitto:2
restart: unless-stopped
ports:
- "1883:1883"
configs:
- source: mosquitto
target: /mosquitto/config/mosquitto.conf
volumes:
- broker-data:/mosquitto/data
healthcheck:
test: ["CMD", "mosquitto_sub", "-t", "$$SYS/broker/uptime", "-C", "1", "-W", "3"]
interval: 30s
timeout: 5s
retries: 3
start_period: 5s
web:
image: felipezavan/ghrian-server:${SERVER_TAG:-latest}
restart: unless-stopped
depends_on:
broker:
condition: service_healthy
environment: &server-env
SECRET_KEY_BASE: ${SECRET_KEY_BASE:?set it in .env (see .env.example)}
AR_ENCRYPTION_PRIMARY_KEY: ${AR_ENCRYPTION_PRIMARY_KEY:?set it in .env}
AR_ENCRYPTION_DETERMINISTIC_KEY: ${AR_ENCRYPTION_DETERMINISTIC_KEY:?set it in .env}
AR_ENCRYPTION_KEY_DERIVATION_SALT: ${AR_ENCRYPTION_KEY_DERIVATION_SALT:?set it in .env}
# Seed the MQTT connection on first boot so the listener connects with no
# UI step. Only applied when the config row is first created.
MQTT_HOST: broker
MQTT_BASE_TOPIC: ghrian
ports:
- "3000:80"
volumes:
- storage:/rails/storage
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/up"]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
listener:
image: felipezavan/ghrian-server:${SERVER_TAG:-latest}
restart: unless-stopped
command: bin/mqtt-listener
depends_on:
broker:
condition: service_healthy
web: # web migrates the DB on boot; wait for it
condition: service_healthy
environment: *server-env
volumes:
- storage:/rails/storage
agent:
image: felipezavan/ghrian-agent:${AGENT_TAG:-latest}
restart: unless-stopped
profiles: ["agent"] # only starts with: docker compose --profile agent up
depends_on:
broker:
condition: service_healthy
command:
- --device-model=${DEVICE_MODEL:-solis_s5-eh1p5k-l}
- --modbus=${MODBUS_ADDR:-192.168.1.50:502} # set MODBUS_ADDR in .env to your inverter
- --mqtt-broker=tcp://broker:1883
- --mqtt-topic=ghrian/inverter/01