Rancher as an alternative to HASS.io

As I could not get hass.io to work on my Intel NUC, I tried another approach with Rancher. For does who don’t no Rancher, it is a Docker container orchestration tool.
By creating some yaml templates based on (among other things) docker-compose.yaml you can build your own application catalog from which you can fire up your container stacks.
I created a basic catalog including Home Assistant, AppDaemon, Mosquito, ozwcp etc. And I must say, it works awesome!

It’s still a WIP, but have a look on my catalog at github and tell me what you think…

3 Likes

Wow…this looks super cool. For something like a NUC, where I don’t want to use the machine only for HASS, this would be a great solution.

Thanks for posting this, it looks great. I’m using docker compose at the moment on a debian server so transition should be relatively easy.

Not entirely understanding it yet but I think I’ll try a test install on my NUC.

The great thing is that you can add multiple catalogs, there is also a so called community catalog available. This catalog provides among other things influxdb and grafana, had it up and running within a few minutes. Now looking at some great charts of my energy consumption.

energy

1 Like

Its a nice solution.
I decided to have a VM just for hass.io, but I have another VM for other docker containers.
Currently I am using portainer and CLI commands on that VM. Maybe i’ll check out rancher.
BTW are you using rancher OS directly on the nuc? or you deployed a flavour of linux with rancher on top?

More Rancher dockers Rancher Catalog

hi basschipper

Any chance you could do a guide of some sort?

Ive been trying to configure rancher without great succcess, with the help of vides on youtube etc, but still unable to get HA up and runnning. Any configuration pointers would be a great help.

Cheers

Hi Frank,

Did you follow my readme on my github page?
Where did you got stuck?

  • Have a host up and running?
  • Is Rancher server running?
  • Added a host?
  • Added the HA catalog?

Hi basschipper!

Just got hass up and running with z-stick and rfxcom under rancher thanks to you :slight_smile:

Im new to docker and rancher but this is awesome. I did have some problem with the usb URL for z-wave and rfxcom. You should add how to get the usb id in the description (ls -lart /dev/serial/by-id) And it is not obvious where to find the config and db folder, you should add that to.

Im looking forward for the next version of HASS so I can upgrade my first docker with rancher :wink:

Keep up the good work, Thanks!

Is it possible to have the volumes folder as Configuration options in rancher?

Hi Toni,

Nice to hear!

I just added 0.53.1 to the catalog, so you should be able to update, I will try to keep up with the 0.*.1 versions. I also improved the device variable descriptions in the catalog, eg. ZWave device.

The “/config” folder is by Home Assistant design, see Dockerfile.

I’m still struggling with bluetooth, it seems that the Home assistant container is required to run privileged and with network_mode: host. Running in host network mode has the effect of the Home Assistant container leaving the overlay network and can’t reach the database under the hostname ( db ) anymore:

recorder:
  db_url: mysql://ha:1234@db/homeassistant

(Yes, I have to add this to the readme :wink: )

Just did my first upgrade didn’t see it first it needed a F5 in rancher. Than just click on upgrade.Super easy did take 1min aprox on my i3 NUC. Its relay nice that you have the old version still there to fall back to. Just click stop on the new and play on the old :slight_smile:

Cant get recorder and mysql to work.

Is db in @db/homeassistant alias for the mount point /var/lib/mysql?

When i do

recorder:
db_url: mysql://user:passw@db/homeassistant i get (1045, “Access denied for user ‘ha’@‘10.42.37.182’ (using password: YES)”) (retrying in 3 seconds)

recorder:
db_url: mysql://user:passw@db/homeassistant i get (2002, “Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)”) (retrying in 3 seconds)

No, a connection string works like this: mysql://user:password@SERVER_IP/DB_NAME

SERVER_IP = IP or hostname of the MySQL server. Within the overlay network you can easily use the service name, which is simply “db”, see docker-compose.yml.

Unfortunately I can’t remember if I created the initial user/database manually.

Edit:
The documentation states:

After installing the dependencies, it is required to create the database manually. During the startup, Home Assistant will look for the database specified in the db_url. If the database doesn’t exist, it will not automatically create it for you.

Once Home Assistant finds the database, with right level of permissions, all the required tables will then be automatically created and the data will be populated accordingly.


So, you need a MySQL client to create the user and database. I use Sequel Pro (Mac client), but you could use Adminer from the community catalog. Adminer doesn’t seem to have a port mapping by default. After launching Adminer hit upgrade and add a port mapping so you can reach Adminer.
Also remember that Adminer will run in a separate stack and thus a separate overlay network. Connecting to the database within the Home Assistant stack is done via the host, and not “db” as stated above.

Installed adminer with rancher but there are no port settings? So dont know how to connect tried :80.
Then I installed it with docker “sudo docker run -d -p 80:80 clue/adminer” and its works fine just brows to http://dockerhost:80 But cant login to mysql, just getting access denied same as recorder setup in hass. Have tested container ip and host ip it seams to be the dockerhost ip.

Does not the rancher/homeassistant installation create a user and a database? There is configuration settings for user, pass and db name when you install it with rancher.

It works fine with the root user that was created but not the ha user. I can see the user “ha” but it seems to lack rights. I have given it full rights I think with GRANT ALL PRIVILEGES ON *. * TO ‘newuser’ @ ‘localhost’; but still cant logon. But im fine running with root user.

Adminer does not have any port mappings by default. That’s why I told you to hit upgrade and add them after launching. I don’t understand why, seems pretty useless without any port mappings…

First time logging in to mysql you should always use the root user. When logged in, you can create the ha database, ha user and grant the ha user privileges on the ha database. This is indeed done by a query you mentioned. However, the remote host you specified is not localhost, to keep it simple use any host ‘%’ instead.

Eg.:

GRANT ALL PRIVILEGES ON ha_db.* TO 'ha_user'@'%';

Before configuring the HA recorder, test the user with Adminer!

1 Like

Docker and rancher are still new to me but I’m starting te get grip on it I think :wink: Now I know what you ment about upgrade the container.

And the mysql part I almost did correct just missed that damn % i did localhost :frowning:

Thanks a lot

New to rancher. When installing Home-Assistant I left all device fields (all three audio device fields, Zwave, and RFXcom) blank. Doing so gives me the following error: Error (Service ‘homeassistant’ configuration key ‘devices’ contains an invalid type, it should be an array.)

are you running a single instance of HASS or multiple in a stack?