-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (77 loc) · 1.96 KB
/
docker-compose.yml
File metadata and controls
82 lines (77 loc) · 1.96 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
version: "3.9"
services:
db:
image: postgres:16-alpine
container_name: db
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: app
POSTGRES_DB: app
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U app -d app"]
interval: 5s
timeout: 3s
retries: 20
mqtt:
image: eclipse-mosquitto:2
container_name: mqtt
ports:
- "1883:1883"
volumes:
- ./mqtt/mosquitto.conf:/mosquitto/config/mosquitto.conf:ro
healthcheck:
test: ["CMD-SHELL", "mosquitto_pub -h localhost -p 1883 -t '__health__' -m 'ok'"]
interval: 5s
timeout: 3s
retries: 20
migrate:
image: migrate/migrate:v4.17.1
container_name: migrate
depends_on:
db:
condition: service_healthy
volumes:
- ./api/migrations:/migrations:ro
command: ["-path", "/migrations", "-database", "postgres://app:app@db:5432/app?sslmode=disable", "up"]
restart: on-failure
api:
container_name: api
build: ./api
environment:
APP_ENV: development
HTTP_PORT: "8080"
DATABASE_URL: "postgres://app:app@db:5432/app?sslmode=disable"
CORS_ORIGIN: "http://localhost:3000"
MQTT_BROKER: "tcp://mqtt:1883"
MQTT_CLIENT_ID: "api"
MQTT_TELEMETRY_TOPIC: "iot/+/telemetry"
MQTT_HEARTBEAT_TOPIC: "iot/+/heartbeat"
MQTT_CMD_TOPIC_FMT: "iot/%s/cmd"
MQTT_ACK_TOPIC_FMT: "iot/%s/cmd_ack"
ports:
- "8080:8080"
depends_on:
mqtt:
condition: service_healthy
db:
condition: service_healthy
migrate:
condition: service_started
web:
container_name: web
build:
context: ./web
target: base
ports:
- "3000:3000"
environment:
- REACT_APP_API_SERVER=http://localhost:8080/api
tty: true
volumes:
- ./web:/workspace:cached
working_dir: /workspace
command: ["sh", "-c", "npm install && npm start"]
depends_on:
- api