Commit ac243b0d authored by Dobli's avatar Dobli
Browse files

preparing docker yaml templates

parent 6abdce18
version: "3.3"
# demo credentials
# user: ohuser
# password: ohpass
networks:
habnet:
driver: overlay
attachable: true
configs:
backup_config_b1:
file: ./configs/volumerize/backup_config_b1.json
backup_config_b2:
file: ./configs/volumerize/backup_config_b2.json
backup_config_b3:
file: ./configs/volumerize/backup_config_b3.json
sftp_config:
file: ./custom_configs/ssh/sshd_config
sftp_users:
file: ./custom_configs/ssh/sftp_users.conf
sftp_key_ed:
file: ./custom_configs/ssh/ssh_host_ed25519_key
sftp_id_pub:
file: ./custom_configs/ssh/id_rsa.pub
sftp_id_key:
file: ./custom_configs/ssh/id_rsa
sftp_known_hosts:
file: ./custom_configs/ssh/known_hosts
traefik_config:
file: ./custom_configs/traefik/traefik.toml
traefik_users:
file: ./custom_configs/traefik/traefik_users
nodered_settings:
file: ./custom_configs/nodered/nodered_settings.js
nodered_package:
file: ./custom_configs/nodered/nodered_package.json
mosquitto_passwords:
file: ./custom_configs/mosquitto/mosquitto_passwords
mosquitto_settings:
file: ./custom_configs/mosquitto/mosquitto.conf
influx_init:
file: ./configs/influxdb/init-influxdb.sh
influx_user:
file: ./configs/influxdb/influxdb_user
volumes:
openhab_addons:
openhab_conf:
openhab_userdata:
nodered_data:
mosquitto_data:
influxdb_data:
unison_data:
backup_data:
backup_cache:
services:
backup1:
image: blacklabelops/volumerize
volumes:
- "openhab_userdata:/source/openhab_userdata"
- "openhab_conf:/source/openhab_conf"
- "openhab_addons:/source/openhab_addons"
- "nodered_data:/source/nodered_data"
- "influxdb_data:/source/influxdb_data"
- "backup_cache:/volumerize-cache"
- "backup_data:/backup"
configs:
- source: backup_config_b1
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
- VOLUMERIZE_TARGET='multi:///backup_config.json?mode=mirror&onfail=abort'
- VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-oStrictHostKeyChecking=no"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b1
backup2:
image: blacklabelops/volumerize
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "openhab_userdata:/source/openhab_userdata"
- "openhab_conf:/source/openhab_conf"
- "openhab_addons:/source/openhab_addons"
- "backup_cache:/volumerize-cache"
- "backup_data:/backup"
configs:
- source: backup_config_b2
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
- VOLUMERIZE_TARGET='multi:///backup_config.json?mode=mirror&onfail=abort'
- VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-oStrictHostKeyChecking=no"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b2
backup3:
image: blacklabelops/volumerize
volumes:
- "openhab_userdata:/source/openhab_userdata"
- "openhab_conf:/source/openhab_conf"
- "openhab_addons:/source/openhab_addons"
- "backup_cache:/volumerize-cache"
- "backup_data:/backup"
configs:
- source: backup_config_b3
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
- VOLUMERIZE_TARGET='multi:///backup_config.json?mode=mirror&onfail=abort'
- VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-oStrictHostKeyChecking=no"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b3
sftp:
image: "doblix/sftp-unison"
volumes:
- "openhab_userdata:/home/ohuser/openhab_userdata"
- "openhab_conf:/home/ohuser/openhab_conf"
- "nodered_data:/home/ohuser/nodered_data"
- "backup_data:/home/ohuser/backup_data"
- "unison_data:/home/ohuser/.unison"
ports:
- "2222:22"
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/ohuser/.ssh/id_rsa
uid: '9001'
mode: 0400
- source: sftp_id_pub
target: /home/ohuser/.ssh/keys/sync.pub
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b1
sftp2:
image: "doblix/sftp-unison"
volumes:
- "openhab_conf:/home/ohuser/openhab_conf"
- "backup_data:/home/ohuser/backup_data"
- "unison_data:/home/ohuser/.unison"
ports:
- "2223:22"
configs:
- 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/ohuser/.ssh/id_rsa
uid: '9001'
mode: 0400
- source: sftp_id_pub
target: /home/ohuser/.ssh/keys/sync.pub
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b2
sftp3:
image: "doblix/sftp-unison"
volumes:
- "openhab_conf:/home/ohuser/openhab_conf"
- "backup_data:/home/ohuser/backup_data"
- "unison_data:/home/ohuser/.unison"
ports:
- "2224:22"
configs:
- 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/ohuser/.ssh/id_rsa
uid: '9001'
mode: 0400
- source: sftp_id_pub
target: /home/ohuser/.ssh/keys/sync.pub
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b3
openhab:
image: "openhab/openhab:2.4.0-amd64-debian"
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "openhab_addons:/openhab/addons"
- "openhab_conf:/openhab/conf"
- "openhab_userdata:/openhab/userdata"
environment:
OPENHAB_HTTP_PORT: "8181"
OPENHAB_HTTPS_PORT: "8443"
networks:
- habnet
deploy:
labels:
- "backup=b1"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.port=8181"
- "traefik.backend=openhab"
- "traefik.frontend.rule=HostRegexp:bau1.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == b1
openhab2:
image: "openhab/openhab:2.4.0-amd64-debian"
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "openhab_addons:/openhab/addons"
- "openhab_conf:/openhab/conf"
- "openhab_userdata:/openhab/userdata"
environment:
OPENHAB_HTTP_PORT: "8282"
OPENHAB_HTTPS_PORT: "8444"
networks:
- habnet
deploy:
labels:
- "backup=b2"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.port=8282"
- "traefik.backend=openhab2"
- "traefik.frontend.rule=HostRegexp:bau2.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == b2
openhab3:
image: "openhab/openhab:2.4.0-amd64-debian"
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "openhab_addons:/openhab/addons"
- "openhab_conf:/openhab/conf"
- "openhab_userdata:/openhab/userdata"
environment:
OPENHAB_HTTP_PORT: "8383"
OPENHAB_HTTPS_PORT: "8445"
networks:
- habnet
deploy:
labels:
- "backup=b3"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.port=8383"
- "traefik.backend=openhab3"
- "traefik.frontend.rule=HostRegexp:bau3.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == b3
nodered:
image: "nodered/node-red-docker"
volumes:
- "nodered_data:/data"
networks:
- habnet
configs:
- source: nodered_package
target: /data/package.json
- source: nodered_settings
target: /data/settings.js
deploy:
labels:
- "backup=b1"
- "traefik.port=1880"
- "traefik.backend=nodered"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.frontend.rule=HostRegexp:rules.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == b1
mqtt:
image: "eclipse-mosquitto"
volumes:
- "mosquitto_data:/mosquitto/data"
ports:
- "9001:9001"
- "1883:1883"
configs:
- source: mosquitto_passwords
target: /mosquitto/config/passwd
- source: mosquitto_settings
target: /mosquitto/config/mosquitto.conf
networks:
- habnet
db:
image: "influxdb"
volumes:
- "influxdb_data:/var/lib/influxdb"
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: "ohuser"
INFLUXDB_USER_PASSWORD: "ohtest"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == b1
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
version: "3.3"
networks:
habnet:
driver: overlay
attachable: true
configs:
backup_config_X:
file: ./configs/volumerize/backup_config_X.json
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
volumes:
openhab_addons:
openhab_conf:
openhab_userdata:
nodered_data:
mosquitto_data:
influxdb_data:
unison_data:
backup_data:
backup_cache:
services:
backup_X:
image: blacklabelops/volumerize
volumes:
- "openhab_userdata:/source/openhab_userdata"
- "openhab_conf:/source/openhab_conf"
- "openhab_addons:/source/openhab_addons"
- "nodered_data:/source/nodered_data"
- "influxdb_data:/source/influxdb_data"
- "backup_cache:/volumerize-cache"
- "backup_data:/backup"
configs:
- source: backup_config_X
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
- VOLUMERIZE_TARGET='multi:///backup_config.json?mode=mirror&onfail=abort'
- VOLUMERIZE_DUPLICITY_OPTIONS=--ssh-options "-oStrictHostKeyChecking=no"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == X
sftp_X:
image: "doblix/sftp-unison"
volumes:
- "openhab_userdata:/home/ohuser/openhab_userdata"
- "openhab_conf:/home/ohuser/openhab_conf"
- "nodered_data:/home/ohuser/nodered_data"
- "backup_data:/home/ohuser/backup_data"
- "unison_data:/home/ohuser/.unison"
ports:
- "2222:22"
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/ohuser/.ssh/id_rsa
uid: '9001'
mode: 0400
- source: sftp_id_pub
target: /home/ohuser/.ssh/keys/sync.pub
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == X
openhab_X:
image: "openhab/openhab:2.4.0-amd64-debian"
volumes:
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"
- "openhab_addons:/openhab/addons"
- "openhab_conf:/openhab/conf"
- "openhab_userdata:/openhab/userdata"
environment:
OPENHAB_HTTP_PORT: "8181"
OPENHAB_HTTPS_PORT: "8443"
networks:
- habnet
deploy:
labels:
- "backup=X"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.port=8181"
- "traefik.backend=openhab"
- "traefik.frontend.rule=HostRegexp:X.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == X
nodered_X:
image: "nodered/node-red-docker"
volumes:
- "nodered_data:/data"
networks:
- habnet
configs:
- source: nodered_package
target: /data/package.json
- source: nodered_settings
target: /data/settings.js
deploy:
labels:
- "backup=X"
- "traefik.port=1880"
- "traefik.backend=nodered"
- "traefik.docker.network=ohSwarmTest_habnet"
- "traefik.frontend.rule=HostRegexp:rules.{domain:[a-zA-z0-9-]+}"
placement:
constraints:
- node.labels.building == X
mqtt_X:
image: "eclipse-mosquitto"
volumes:
- "mosquitto_data:/mosquitto/data"
ports:
- "9001:9001"
- "1883:1883"
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
db_X:
image: "influxdb"
volumes:
- "influxdb_data:/var/lib/influxdb"
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: "ohuser"
INFLUXDB_USER_PASSWORD: "ohtest"
networks:
- habnet
deploy:
placement:
constraints:
- node.labels.building == X
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
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"description": "A Node-RED Project", "description": "A Node-RED Project",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"node-red-contrib-openhab2": "~1.1.3" "node-red-contrib-openhab2": "~1.1.4",
"node-red-contrib-openhab-v2": "~1.4.0"
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment