Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arm32 dockerfile (using template) #76

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

cvb941
Copy link

@cvb941 cvb941 commented May 23, 2019

I deleted the dockerfiles and created a script build.sh which creates them using a template dockerfile, for each combination of (architecture x mariadb_version). The final dockerfile then uses a suitable image and correct dependent binaries (which I made and added for arm32).

Although it is rather unclean now, since for the arm32 I used a mariadb image for raspberry from jsurf, which has only the 10.1 mariadb version, so at this moment I skip 10.2 and 10.3. We should probably wait for a more complete solution, that could use this as a base for the change.
A solution would certainly be to use a different docker image than the official mariadb one. There is one from bitnami, linuxserver or this one which uses alpine linux (and thus apk instead of apt).

I also lowered the value of gcache to 128MB, since the 2048MB value crashed on raspberry (this bug).

What is left to be done is creating a manifest from these generated dockerfiles and we can have proper multiarch images.

@cvb941
Copy link
Author

cvb941 commented May 23, 2019

I might have been successful in using the linuxserver mariadb base image, but I cannot test it right now since my raspberry sd card got corrupted. I'm ordering a new one and will post an update here once I try it out.

@cvb941 cvb941 mentioned this pull request May 23, 2019
@colinmollenhour
Copy link
Owner

Looking good. I think I'd like to keep the Dockerfiles though, so perhaps rather than delete them just add a notice at the top like:

# DO NOT EDIT THIS FILE - See Dockerfile.template

@@ -9,7 +9,7 @@ innodb_lock_schedule_algorithm=FCFS

# Subsequent `wsrep_provider_options` will replace the ones specified below
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_provider_options="gcache.size=2048M; gcache.keep_pages_size=1024M; gcache.recover=yes;"
wsrep_provider_options="gcache.size=128M; gcache.keep_pages_size=1024M; gcache.recover=yes;"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also fork this file for amd64 vs armv6 because 128M is quite small for a machine without tiny disks so I'd like to keep the default for amd64 the same.

@cvb941
Copy link
Author

cvb941 commented Jun 28, 2019

All right, I have managed to make the linuxserver base image work. It should be better compared to jsurfs image, has working xtrabackup-v2 and resolves correctly on armv6 docker (jsurf's required --resolve-image=never to run). Although it required an additional chown on another mysql folder and apt install of gosu package.

While I wanted to use a different image compared to jsurf's because of mariadb versions other than 10.1, while linuxserver looks like it has images tagged with 10.3 version of mariadb, the arm version of the image seems to include the 10.1 anyway. So for now, still only 10.1 image for armv6 (10.1.40 to be precise).

@colinmollenhour I have also included a --bind-address=0.0.0.0 argument on the mysqld command, without which I wasn't able to connect to my cluster from outside (not even the healthcheck would connect and the container would get killed)
I have too prolonged the healthcheck in the dockerfile, this was driving me crazy, since on my second, older raspberry, the containers didn't fully start up or did only sometimes. After tearing some hair I finally found out that the swarm was killing the containers because the poor SD card couldn't start them fast enough. Raising the healthcheck retries appear to solve that.
Also I have a line at the end of start.sh where I printed out the mysql error log, which helped me a lot in my journey of debugging the containers.
Please comment on those changes and I can update them to your liking, or remove them if you want.

@@ -355,5 +355,5 @@ fi
# Start mysqld
echo "${LOG_MESSAGE} ---------------------------------------------------------------"
echo "${LOG_MESSAGE} Starting with options: $OPT $START"
exec mysqld $OPT $START
exec mysqld $OPT $START --bind-address=0.0.0.0
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is needed, but I think it belongs in one of the .cnf files instead.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already here: https://github.com/colinmollenhour/mariadb-galera-swarm/blob/master/conf.d/30-galera.cnf#L2

Are you overwriting this file locally, perhaps?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue I guess is that, at least in the jsurf image and linuxserver image, the bind-address setting gets overwritten by /etc/mysql/mariadb.conf.d/50-server.cnf file, with 127.0.0.1.

The breakdown:
mysqladmin --help command lists the following files

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

Out of those, only the /etc/mysql/my.cnf file exists, with the following ending:

# Import all .cnf files from configuration directory
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/

The first directory is the one the dockerfile populates, the second is presumably mariadb default.

Grepping for the bind-address yields the following output:

root@5d24286d9f20:/etc/mysql# grep -r "bind-address"
conf.d/30-galera.cnf:bind-address=0.0.0.0
mariadb.conf.d/50-server.cnf:bind-address               = 127.0.0.1

As the /etc/mysql/mariadb.conf.d/ gets included later, I believe it overwrites the /etc/mysql/conf.d/ settings.

I guess we should then overwrite the mariadb.conf.d/50-server.cnf through the dockerfile instead of my command argument solution.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'd like to avoid making major changes to the config to avoid impacting existing users, so probably just resetting the environment from the jsurf image to match that of the official image would be the best soluition. E.g. RUN rm /etc/mysql/conf.d/* or similar.

@@ -423,4 +423,5 @@ test -s /var/run/galera-healthcheck-1.pid && kill $(cat /var/run/galera-healthch
test -s /var/run/galera-healthcheck-2.pid && kill $(cat /var/run/galera-healthcheck-2.pid)

echo "Goodbye"
cat /var/log/mysql/error.log
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why this is needed since it is supposed to be set up so that errors go to stderr which is of course captured by docker... Is there a local cnf file overriding the log path perhaps?

I think this would be really confusing to see the full log after the "Goodbye" since it would not be chronologically correct, so if this does need to remain for some reason every line should be prefixed with something like: "=== post-shutdown - error.log:" so it is obvious where it is coming from. E.g. replace "cat" with:

awk -v prefix="=== post-shutdown - error.log: " '{print prefix $0}'

@mozzhead164
Copy link

mozzhead164 commented Feb 18, 2020

Any update on this? Need to Run MariaDB on a 5x Raspberry Pi 4 Cluster

Would I just pull the master from DockerHub
ie
$docker pull colinmollenhour/mariadb-galera-swarm:10.1.43-2020-01-06

@NightDragon1
Copy link

Hi all,

would love to see this pull requested being merged.
Already hungry for a raspi-galera swarm solution :)

Thx

@colinmollenhour
Copy link
Owner

Hi all, thanks for the contributions and interest. I don't have a test platform setup for Arm32 or a reason to use it so will need others to test it. There are a few unresolved issues noted in the PR which need to be addressed and now there are also many new versions supported so I am simply waiting for someone else to finish this PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants