-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathdocker-compose-quick-start.yml
193 lines (185 loc) · 4.99 KB
/
docker-compose-quick-start.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
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
name: flowfuse
configs:
flowfuse:
content: |
port: 3000
host: 0.0.0.0
domain: ${DOMAIN:?error}
base_url: http://forge.${DOMAIN:?error}
api_url: http://forge:3000
db:
logging: false
type: postgres
host: postgres
database: flowfuse
user: forge
password: secret
driver:
type: docker
options:
socket: /tmp/docker.sock
broker:
url: mqtt://broker:1883
public_url: ws://mqtt.${DOMAIN:?error}
fileStore:
url: http://file-server:3001
flowfuse_broker:
content: |
per_listener_settings false
allow_anonymous false
listener 1883 0.0.0.0
listener 1884 0.0.0.0
protocol websockets
auth_plugin /mosquitto/go-auth.so
auth_opt_backends http
auth_opt_hasher bcrypt
auth_opt_cache true
auth_opt_auth_cache_seconds 30
auth_opt_acl_cache_seconds 90
auth_opt_auth_jitter_second 3
auth_opt_acl_jitter_seconds 5
auth_opt_http_host forge
auth_opt_http_port 3000
auth_opt_http_getuser_uri /api/comms/auth/client
auth_opt_http_aclcheck_uri /api/comms/auth/acl
flowfuse_storage:
content: |
port: 3001
host: 0.0.0.0
base_url: http://forge:3000
driver:
type: localfs
quota: 104857600
options:
root: var/root
context:
type: sequelize
quota: 1048576
options:
type: postgres
host: postgres
database: ff-context
username: forge
password: secret
nginx:
content: |
client_max_body_size 5m;
postgres_db_setup:
content: |
#!/bin/sh
set -e
psql -v ON_ERROR_STOP=1 -U root <<-ESQL
CREATE USER forge WITH PASSWORD 'secret';
CREATE DATABASE flowfuse;
GRANT ALL PRIVILEGES ON DATABASE flowfuse TO forge;
ESQL
postgres_context_setup:
content: |
#!/bin/sh
set -e
psql -v ON_ERROR_STOP=1 -U root <<-ESQL
SELECT 'CREATE DATABASE "ff-context"' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'ff-context')\gexec
GRANT ALL PRIVILEGES ON DATABASE "ff-context" TO "forge";
ESQL
services:
nginx:
image: nginxproxy/nginx-proxy:1.6.0
networks:
- flowforge
restart: always
volumes:
- "/var/run/docker.sock:/tmp/docker.sock:ro"
configs:
- source: nginx
target: /etc/nginx/conf.d/my_proxy.conf
ports:
- "80:80"
healthcheck:
test: "curl -s -I http://localhost | head -n 1 | grep -q 503"
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
postgres:
image: postgres:14
networks:
- flowforge
restart: always
environment:
POSTGRES_PASSWORD: secret
POSTGRES_USER: root
configs:
- source: postgres_db_setup
target: /docker-entrypoint-initdb.d/01-setup-db.sh
- source: postgres_context_setup
target: /docker-entrypoint-initdb.d/02-setup-context-db.sh
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
broker:
image: "iegomez/mosquitto-go-auth"
networks:
- flowforge
restart: always
ulimits:
nofile: 2048
environment:
- "VIRTUAL_HOST=mqtt.${DOMAIN:?error}"
- "VIRTUAL_PORT=1884"
- "LETSENCRYPT_HOST=mqtt.${DOMAIN:?error}"
configs:
- source: flowfuse_broker
target: /etc/mosquitto/mosquitto.conf
forge:
image: "flowfuse/forge-docker"
networks:
- flowforge
restart: always
environment:
- "VIRTUAL_HOST=forge.${DOMAIN:?error}"
- "LETSENCRYPT_HOST=forge.${DOMAIN:?error}"
configs:
- source: flowfuse
target: /usr/src/forge/etc/flowforge.yml
volumes:
- "/var/run/docker.sock:/tmp/docker.sock"
- flowfuse-persistent-storage:/opt/persistent-storage
depends_on:
- "postgres"
- "nginx"
- "broker"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
file-server:
image: "flowfuse/file-server"
networks:
- flowforge
restart: always
configs:
- source: flowfuse_storage
target: /usr/src/flowforge-file-server/etc/flowforge-storage.yml
volumes:
- fileStorage:/usr/src/flowforge-file-server/var/root
depends_on:
- "forge"
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://127.0.0.1:3001/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))"]
interval: 5s
timeout: 5s
retries: 3
start_period: 10s
networks:
flowforge:
volumes:
flowfuse-persistent-storage:
db:
fileStorage: