colinmollenhour / mariadb-galera-swarm

MariaDb Galera Cluster container based on official mariadb image which can auto-bootstrap and recover cluster state.
https://hub.docker.com/r/colinmollenhour/mariadb-galera-swarm
Apache License 2.0
217 stars 102 forks source link

Start script resets MYSQL_MODE_ARGS environment variable #34

Closed smidge84 closed 6 years ago

smidge84 commented 6 years ago

I noticed that in the example docker stack file we provide an environment variable called MYSQL_MODE_ARGS which we use to set the location of the WSREP notify.sh script. However, my seed node kept specifying that the notify script hadn't been defined.

After some digging I found that on line 112 of start.sh the variable is set to empty.

The rest of the script works correctly, appending new mysql agruments to this variable. However, this line means that no matter what value we provide as a docker environment variable, it will always be ignored.

A simple fix would be to either remove the line, or perform check to see if the variable has already been set before setting it to empty.

colinmollenhour commented 6 years ago

It is not intended that MYSQL_MODE_ARGS be an environment variable but rather a local variable for that script. When the README refers to setting wsrep_notify_cmd I had in mind this would be in the config file.

The script does pass "$@" to the mysqld.sh script so you can add additional arguments to the docker command. I think if an environment variable is needed for passing additional arguments it should be a separate variable so as not to create fragility with manipulation of MYSQL_MODE_ARGS. Perhaps MYSQL_EXTRA_ARGS?

smidge84 commented 6 years ago

Okay, that makes sense. I was sure I'd read an example somewhere where MYSQL_MODE_ARGS was set as a service environment variable with the config for the path to the notify script. However I can't seem to find what I read now. Like you said, the fact that the script does pass $@ was how I managed to work around this issue without being able to modify the galera.cnf config file (I'm having a general issue at the moment building docker images). Happy to close this issue. Cheers :+1: