The MySQL database just needs to support connecting from outside of localhost. You will need to configure your DB to allow that.
Running on another host doesn’t really have any bearing on whether or not you can use it remotely. At that point it’s just another service on your network
There is nothing special to put into the config. It’s just connecting to another machine on your network. Forget that it’s running in docker, because that is irrelevant. Just put in the IP address of the host running the MySQL docker container. You DID map the container running MySQL to the correct ports on the host, right?
I thought you were running MySQL inside docker on another docker host. That’s what it sounded like.
Just to be 100% clear, there is literally nothing you need to do to the HA docker container to get it to connect to a MySQL database running on another machine in your network. In docker or otherwise.
There is nothing special in the config aside from telling it the IP address of the MySQL server.
What is your network configuration on your HA docker container? I use net=host on mine
I use macvlan, so the ha container is being treated just like any other host on the network.
I have multiple VLAN running on my home lab, hence need to do macvlan.
So just to clarify, do you have a ha docker container running on one docker host.
then you also have MySQL instance running on another docker host? and the connection just works… if so. I would love to find out
how you did that.
I don’t understand what the issue is or why you think HA in docker cares where the database is.
Yes, I have had this set up exactly like this. I moved to a postgresql database though, and run it in another docker container on the same host but I don’t link the containers. They are treated as separate devices on the network. Prior to moving to postgresql, my MySQL database was running in a freebsd jail and worked just fine with my HA docker.
I don’t know why yours isn’t working but there is nothing special in the configuration or docker settings that allow it.
Ok so can you explain to me how docker talks to the mysql server located in another docker host?
I
I dont understand why you keep on saying its not required. Then how does it talk to it? How does it know where to connect to? Saw some write up you may be able to do HA docker and mysql docker in the SAME host…
But as i keep on pointing out to you. Its NOT on the same host. This containers are on different host, they are NOT on the same vlan/network.
You can provide how exactly you configured this in your environment.
You stated that you understand that it is merely another machine on your network. You just point it to the IP address of the other Docker host, assuming the other docker host is exposing the ports that your database is running on. I don’t really know why this seems that difficult. The documentation is quite clear on this.
db_url (Optional): The URL which point to your database.
You use the mysql URL form like explained in the documentation…
It doesn’t need to be, as I keep saying. As long as you can reach the database from the VLAN/HA host, it doesn’t matter if it’s running in a docker container on your network or someone else’s network (cloud).
Ok ive tried all that last night. It didnt work. I will paste the exact error. I am under the impression you can only do the recorder component under hass.io setup? Is that correct?
I am under the impression you can only do the recorder component under hass.io setup? Is that correct?
No, that is incorrect. I am running this under just a normal Docker instance. The documentation does not state this either. I can connect to my postgresql database and see all the events and actions that my HA is performing.
Nice one. Thats what i want to know… i got the db_url component not found last night and i follow the documentation you mentioned. Will have yto paste the exact error. Juat hard doing this from a phone