My Docker Stack

I’m currently running the following on my Synology NAS as separate Docker files and now I want to add InfluxDB and either Grafana or ChronoGraf (or both). Seeing as I’ll then have 7 or 8 containers, I’d prefer to move these to docker compose to simplify management. Anyone got a working docker-compose.yml file they can share with all or most of that?

MQTT and UniFi are my most important with watchtower a close 2nd as it has been awesome in recently auto-updating the UniFi container.

You may find lot of info in this post.

here you go; for mqtt i use Eclipse.

  unifi:
    container_name: unifi
    image: jacobalberty/unifi:stable
    restart: unless-stopped
    volumes:
    - /mnt/cache/appdata/unifi:/config
    - /mnt/cache/appdata/unifi/cert:/unifi/cert
    - /mnt/cache/appdata/unifi/data:/unifi/data
    - /mnt/cache/appdata/unifi/logs:/unifi/logs
    - /mnt/cache/appdata/unifi/init.d:/unifi/init.d
    - /etc/localtime:/etc/localtime:ro
    environment:
    - UNIFI_GID=999
    - UNIFI_UID=999
    - TZ=Asia/Dubai
    - RUNAS_UID0=false
    ports:
    - "3478:3478/udp"
    - "10001:10001/udp"
    - "8080:8080"
    - "8081:8081"
    - "8443:8443"
    - "8843:8843"
    - "8880:8880"
    - "6789:6789"
    labels:
    - "com.centurylinklabs.watchtower.enable=true"

  tasmoadmin: 
    container_name: tasmoadmin
    image: raymondmm/tasmoadmin:v1.6.0
    restart: unless-stopped
    volumes:
    - /mnt/cache/appdata/tasmoadmin:/data:rw
    - /etc/localtime:/etc/localtime:ro
    environment:
    - APACHE_SERVER_NAME=tasmo.hass
    ports:
    - "1280:80"
    labels:
    - "com.centurylinklabs.watchtower.enable=true"

  watchtower:
    container_name: watchtower
    image: v2tec/watchtower
    restart: unless-stopped
    hostname: UNRAID
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock:ro
    - /etc/localtime:/etc/localtime:ro
    environment:
    - WATCHTOWER_NOTIFICATIONS=email
    - [email protected]
    - [email protected]
    - WATCHTOWER_NOTIFICATION_EMAIL_SERVER=smtp.gmail.com
    - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_USER=mymail
    - WATCHTOWER_NOTIFICATION_EMAIL_SERVER_PASSWORD=mypassword
    - PGID=100
    - PUID=99
    command: --debug --label-enable --cleanup --interval 300
    labels:
    - "com.centurylinklabs.watchtower.enable=true"

  mqtt:
    container_name: mqtt
    image: eclipse-mosquitto
    restart: unless-stopped
    volumes:
    - /mnt/cache/appdata/mosquitto/config:/mosquitto/config
    - /mnt/cache/appdata/mosquitto/log:/mosquitto/log
    - /mnt/cache/appdata/mosquitto/data:/mosquitto/data
    - /etc/localtime:/etc/localtime:ro
    environment:
    - PGID=100
    - PUID=99
    ports:
    - "1883:1883"
    - "9001:9001"
    labels:
    - "com.centurylinklabs.watchtower.enable=true"
3 Likes

Thank you so much. Not sure on the environment variables though. Do these need defining when using docker-compose (PGID/PUID) as these are not in my docker file currently.

It depends on the container you are running. Does it require special user permissions for anything? Or do you want to make sure you have the same user running across all containers as well as the permissions on the file system?

The choice is yours. If your apps work without them, then don’t worry about it.

Love the stack example, so I in no way want what I say next to be anything but a reflection of my skill on a much less powerful docker server. But. Do not run syncthing as is from the example on a Synology running a Celeron or less. You will find a true meaning of pain, culminating in a killall dockerd. The syno just collapsed like a cheap trinket under the onslaught.

I also love syncthing, but I had to shift it to an echo only service to get it to settle down as a backup service for my others computers. I thought I’d give sync as a “syncthing” another go, but alas, it’s just not to be.

I’m no l33t sysadmin, don’t even play one on tv, but if you aren’t one either you might want to give that one bit of the stack a pass. Otherwise, thanks for providing a wonderful template to build from!

…The syno was fine afterwards, but I’ll be appropriately wary now of “unless-stopped”.
PS Or maybe it’s just me, there’s a syno user 3mo back. Mine was a DS218+

syncthing docker runs fine on a pi, so I don’t know why your celeron would have any issues.

docker stop hass-sync

Thanks for the command. Dunno but it ran away with the processor and wouldn’t die until I did the excessive killall and removed it from the stack deploy. I haven’t had any issues since.

Make sure your syncthing is IGNORING the home assistant log and db file. I can see where it would CONSTANTLY be syncing those 2 things, causing a CPU spike. If you want to just create the setting, point the sync directory at something other than home assistant config directory, load up the web GUI for it, and make your changes, then fire up the container pointing to the correct directory.

Quite possible. That was why I’d run into the syncthing issue before on something else - excessive updates. Thanks again for the the advice. Now I just have to figure out what I’m doing wrong with Influx. That’s pretty much the last of my issues in converting the Hassio setup I had running.

I’d like the auth to work, and it’s a departure from what I saw of your setup, but none o’ the params I’ve tried seem to do the trick. 404 when HA tries to post to the db since neither the db nor the users were established. I’ll try establishing the user/db manually in case it’s something dumb like the syno firewall. Ah, and scanning history you posting the conf, excellent. If this works, I’ll owe you a debt. Getting off the Raspi was more work than I expected.

influxdb:
    container_name: influxdb
    restart: unless-stopped
    image: influxdb:latest
    volumes:
      - /volume1/docker/homeassistant/influxdb/influxdb.conf:/etc/influxdb/influxdb.conf:ro
      - /volume1/docker/homeassistant/influxdb/data:/var/lib/influxdb
      - /etc/localtime:/etc/localtime:ro
    environment:
      - INFLUXDB_DB='home_assistant'
      - INFLUXDB_HTTP_ENABLED=true
      - INFLUXDB_HTTP_AUTH_ENABLED=true
      - INFLUXDB_ADMIN_USER='admin'
      - INFLUXDB_ADMIN_PASSWORD=''
      - INFLUXDB_USER_PASSWORD=''
      - INFLUXDB_USER='homeassistant'
    ports:
      - "8086:8086"

Yeah, definitely read through this page:

https://hub.docker.com/_/influxdb

I probably didn’t go into the details on here because it took me a bit to figure it all out, and I didn’t document the process.

1 Like

Thanks again. After 3 hours on the subject I ended up doing what I did last time: Create the the username and password then bring up auth in the config afterward. From what I can tell, at least one issue was that influx will only try once to create everything for you. If that fails, the docker volume will be filled with a blank influx instance and that’s it. Auth is up, but no one’s home.

Even after figuring that out and wiping the instance to reinit, I couldn’t get the automagic to work right. I dearly wanted a one-shot stack deploy though with auth.

Thank you for sharing this. For me, seeing you use postgres was the ticket. I had been struggling with mariadb, and postgres isn’t giving me any problems at all.

1 Like

Hi, can you share you compose file? I tried to create a good one but without success!

Did you ever solve this? I keep getting exit code 3 on both eclipse mosquitto as toke mosquitto when i try to start them (through compose though I can’t start them in any way even GUI) on my Synology. Its starting to become annoying…

mosquitto:
image: eclipse-mosquitto:latest
restart: always
ports:
- “1883:1883”
- “9001:9001”
volumes:
- /volume1/docker/mosquitto/config:/mosquitto/config
- /volume1/docker/mosquitto/data:/mosquitto/data
- /volume1/docker/mosquitto/log:/mosquitto/log

I manually created the directories and even CHMOD 777 everything. Nothing helps.

do you have an actual config file inside the config directory? You are telling mosquitto to look there for a config, but if you don’t have a config it can’t start.

I just tried that and now it starts, but i do get this message:

Creating docker_mosquitto_1 … done
Attaching to docker_mosquitto_1
mosquitto_1 | WARNING: no logs are available with the ‘db’ log driver

And no files are added in config or data or log folder. (besides the mosquitto.conf that i added myself)

Does anyone here have the HASS docker working with host network mode enabled, in combination with the linuxserver-letsencrypt docker? It seems to only work if I do not enable network_mode: host in my docker-compose file for the home assistant docker. This sucks because my Xiaomi hub needs the host network mode to work … Any idea’s?

yes, I’m running HA (non-hassio) in docker with network mode and also running the linuxsever-letsencrypt docker container. it’s working fine.