debian-domoticz v1.0 (with letsencrypt and Toon API)

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

Post Reply
BPMb
Posts: 10
Joined: Thursday 27 April 2017 0:55
Target OS: Linux
Domoticz version: master
Contact:

debian-domoticz v1.0 (with letsencrypt and Toon API)

Post by BPMb »

I was using the Linuxserver docker image but I needed Toonapilib4domoticz to be included and installing it afterwards is not how it should be done.. So, I decided to make my own Domoticz docker image with Toonapilib4domoticz preinstalled.

Toonapilib4domoticz: https://github.com/JohnvandeVrugt/toonapilib4domoticz
Github: https://github.com/bpmb82/debian-domoticz
Dockerhub: https://hub.docker.com/r/bpmbee/debian-domoticz

I would like to share a docker-compose.yml that includes nginx-proxy and letsencrypt for valid certificates that auto-renew. I'm hoping someone finds this useful, it should get you up and running with Domoticz in a matter of minutes!

I'll be looking into making separate builds for the master and development versions of Domoticz next.

UPDATE: If you're using Cloudflare as DNS, you can include this docker image to update your Dynamic IP: https://hub.docker.com/r/bpmbee/cloudflare-dns-updater

Don't forget to edit the below file with the correct local paths and hostnames

Code: Select all

version: '3.3'

services:

  proxy:
    image: jwilder/nginx-proxy:alpine
    labels:
      - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true"
    container_name: domoticz-proxy
    networks:
      - domoticz_network
    ports:
      - 80:80
      - 443:443
    volumes:
      - <local path>/conf.d:/etc/nginx/conf.d:rw
      - <local path>/vhost.d:/etc/nginx/vhost.d:rw
      - <local path>/html:/usr/share/nginx/html:rw
      - <local path>/certs:/etc/nginx/certs:ro
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    restart: unless-stopped

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: domoticz-letsencrypt
    depends_on:
      - proxy
    networks:
      - domoticz_network
    volumes:
      - <same local path of nginx-proxy>/certs:/etc/nginx/certs:rw
      - <same local path of nginx-proxy>/vhost.d:/etc/nginx/vhost.d:rw
      - <same local path of nginx-proxy>html:/usr/share/nginx/html:rw
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    restart: unless-stopped


  domoticz:
    image: bpmbee/debian-domoticz:version-1.1 
    container_name: domoticz
    depends_on:
      - proxy
    environment:
      - TZ=Europe/Amsterdam
      - VIRTUAL_HOST=my-host.example.com
      - VIRTUAL_PORT=8080
      - LETSENCRYPT_HOST=my-host.example.com
      - [email protected]
    networks:
      - domoticz_network
    volumes:
      - <local path>/data:/data
    expose:
      - "8080"
    ports:
      - 8118:8080 # only if you want local network access
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0 # used for ZWave or RFX 433 dongles
    restart: unless-stopped

networks:
  domoticz_network:
Thanks to kiddigital in helping me out on the versioning issue (misunderstanding) I had!
Last edited by BPMb on Saturday 07 November 2020 14:59, edited 2 times in total.
BPMb
Posts: 10
Joined: Thursday 27 April 2017 0:55
Target OS: Linux
Domoticz version: master
Contact:

Re: debian-domoticz v1.0 (with letsencrypt and Toon API)

Post by BPMb »

My pleasure!

You don’t have to expose a port for MQTT. An MQTT broker isn’t included but this container is perfectly able to connect to one. You could add one to this docker-compose and also assign it to the domoticz_network
BPMb
Posts: 10
Joined: Thursday 27 April 2017 0:55
Target OS: Linux
Domoticz version: master
Contact:

Re: debian-domoticz v1.0 (with letsencrypt and Toon API)

Post by BPMb »

I'm using Linux as host (Ubuntu 20) but as far as I know you should be able to use this for Windows as well.. I do know the Windows version of Docker has a setting that lets you choose between Linux based and Windows based images, you should choose Linux there.

I did find this little piece of information from the Portainer website:
Deploy Portainer Server on a standalone WINDOWS Docker Host (running Windows Containers) – note must be Windows 1909 or newer.
$ docker volume create portainer_data
$ docker run -d -p 8000:8000 -p 9000:9000 --name portainer --restart always -v \\.\pipe\docker_engine:\\.\pipe\docker_engine -v portainer_data:C:\data portainer/portainer-ce
SOURCE

Note the \pipe\docker_engine part. Also note that they're talking about running Windows containers so I think you need to switch that in your configuration.

Also see: https://docs.docker.com/docker-for-wind ... containers
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest