docker-templates.yml 6.82 KB
Newer Older
1
version: "3.5"
2
3
4

networks:
    habnet:
5
        name: habnet
6
7
8
9
        driver: overlay
        attachable: true

configs:
Dobli's avatar
Dobli committed
10
11
    backup_config:
        file: ./volumerize/backup_config.json
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    sftp_config:
        file: ./ssh/sshd_config
    sftp_users:
        file: ./ssh/sftp_users.conf
    sftp_key_ed:
        file: ./ssh/ssh_host_ed25519_key
    sftp_id_pub:
        file: ./ssh/id_rsa.pub
    sftp_id_key:
        file: ./ssh/id_rsa
    sftp_known_hosts:
        file: ./ssh/known_hosts
    traefik_config:
        file: ./traefik/traefik.toml
    traefik_users:
        file: ./traefik/traefik_users
    nodered_settings:
        file: ./nodered/nodered_settings.js
    nodered_package:
        file: ./nodered/nodered_package.json
    mosquitto_passwords:
        file: ./mosquitto/mosquitto_passwords
    mosquitto_settings:
        file: ./mosquitto/mosquitto.conf
dobli's avatar
dobli committed
36
37
38
39
    postgres_user:
        file: ./postgres/user
    postgres_passwd:
        file: ./postgres/passwd
dobli's avatar
dobli committed
40
41
42
43
    landing_logo:
        file: ./pb-framr/logo.svg
    landing_pages:
        file: ./pb-framr/pages.json
Dobli's avatar
Dobli committed
44
45
    filebrowser:
        file: ./filebrowser/filebrowser.json
46
47
48
49
50
51

volumes:
    backup_data:
    backup_cache:

services:
Dobli's avatar
Dobli committed
52
    backup:
53
54
55
56
57
        image: blacklabelops/volumerize
        volumes:
            - "backup_cache:/volumerize-cache"
            - "backup_data:/backup"
        configs:
58
            - source: backup_config
59
60
61
62
63
64
65
66
67
              target: /backup_config.json
            - source: sftp_id_key
              target: /root/.ssh/id_rsa
              mode: 0400
            - source: sftp_known_hosts
              target: /root/.ssh/known_hosts
              mode: 0400
        environment:
            - VOLUMERIZE_SOURCE=/source
dobli's avatar
dobli committed
68
            - VOLUMERIZE_TARGET=multi:///backup_config.json?mode=mirror&onfail=abort
69
70
71
72
73
74
75
            - VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-oStrictHostKeyChecking=no"
        networks:
            - habnet
        deploy:
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
76
    sftp:
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
        image: "atmoz/sftp"
        volumes:
            - "backup_data:/home/ohadmin/backup_data"
        configs:
            - source: sftp_config
              target: /etc/ssh/sshd_config
            - source: sftp_users
              target: /etc/sftp/users.conf
            - source: sftp_key_ed
              target: /etc/ssh/ssh_host_ed25519_key
              mode: 0400
            - source: sftp_id_key
              target: /home/ohadmin/.ssh/id_rsa
              uid: '9001'
              mode: 0400
            - source: sftp_id_pub
              target: /home/ohadmin/.ssh/keys/sync.pub
        networks:
            - habnet
        deploy:
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
100
    openhab:
101
102
103
104
        image: "openhab/openhab:2.4.0-amd64-debian"
        volumes:
            - "/etc/localtime:/etc/localtime:ro"
            - "/etc/timezone:/etc/timezone:ro"
dobli's avatar
dobli committed
105
106
107
            - "addons:/openhab/addons"
            - "conf:/openhab/conf"
            - "userdata:/openhab/userdata"
108
109
110
        environment:
            OPENHAB_HTTP_PORT: "8181"
            OPENHAB_HTTPS_PORT: "8443"
dobli's avatar
dobli committed
111
            EXTRA_JAVA_OPTS: '-Dgnu.io.rxtx.SerialPorts=/dev/zwave_stick'
112
113
114
115
        networks:
            - habnet
        deploy:
            labels:
116
                - "traefik.docker.network=habnet"
117
118
119
120
                - "traefik.port=8181"
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
121
    nodered:
122
123
        image: "nodered/node-red-docker"
        volumes:
dobli's avatar
dobli committed
124
            - "data:/data"
125
126
127
128
129
130
131
132
133
134
        networks:
            - habnet
        configs:
            - source: nodered_package
              target: /data/package.json
            - source: nodered_settings
              target: /data/settings.js
        deploy:
            labels:
                - "traefik.port=1880"
135
                - "traefik.docker.network=habnet"
136
137
138
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
139
    mqtt:
140
141
        image: "eclipse-mosquitto"
        volumes:
dobli's avatar
dobli committed
142
            - "data:/mosquitto/data"
143
144
145
146
147
148
149
150
151
152
153
154
        ports:
        configs:
            - source: mosquitto_passwords
              target: /mosquitto/config/passwd
            - source: mosquitto_settings
              target: /mosquitto/config/mosquitto.conf
        networks:
            - habnet
        deploy:
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
155
    db:
156
157
        image: "influxdb"
        volumes:
dobli's avatar
dobli committed
158
            - "data:/var/lib/influxdb"
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
        configs:
            - source: influx_init
              target: /init-influxdb.sh
              mode: 0555
            - source: influx_user
              target: /run/secrets/influx_user
        environment:
            INFLUXDB_HTTP_AUTH_ENABLED: "true"
            INFLUXDB_DB: "openhab"
            INFLUXDB_ADMIN_USER: "ohadmin"
            INFLUXDB_ADMIN_PASSWORD: "ohadmin"
            INFLUXDB_USER: "ohadmin"
            INFLUXDB_USER_PASSWORD: "ohtest"
        networks:
            - habnet
        deploy:
            placement:
                constraints:
                    - node.labels.building == X
Dobli's avatar
Dobli committed
178
    postgres:
dobli's avatar
dobli committed
179
180
        image: "postgres"
        volumes:
dobli's avatar
dobli committed
181
            - "data:/var/lib/postgresql/data/pgdata"
dobli's avatar
dobli committed
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
        configs:
            - source: postgres_user
              target: /run/secrets/postgres_user
            - source: postgres_passwd
              target: /run/secrets/postgres_passwd
        environment:
            PGDATA: "/var/lib/postgresql/data/pgdata"
            POSTGRES_USER_FILE: "/run/secrets/postgres_user"
            POSTGRES_PASSWORD_FILE: "/run/secrets/postgres_passwd"
            POSTGRES_DB: "openhab"
        networks:
            - habnet
        deploy:
            placement:
                constraints:
                    - node.labels.building == X
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
    proxy:
        image: "traefik"
        command: --api --docker --docker.swarmMode --logLevel="DEBUG"
        volumes:
            - "/var/run/docker.sock:/var/run/docker.sock"
        ports:
            - "8080:8080"
            - "80:80"
        networks:
            - habnet
        configs:
            - source: traefik_config
              target: /etc/traefik/traefik.toml
            - source: traefik_users
              target: /etc/traefik/traefik_users
        deploy:
            mode: global
            placement:
                constraints:
                    - node.role == manager
218
219
220
    files:
        image: filebrowser/filebrowser
        volumes:
Dobli's avatar
Dobli committed
221
222
223
        configs:
            - source: filebrowser
              target: /.filebrowser.json
224
225
226
227
228
229
230
231
232
        networks:
            - habnet
        deploy:
            labels:
                - "traefik.port=80"
                - "traefik.docker.network=habnet"
            placement:
                constraints:
                    - node.labels.building == X