Skip to content

2025-05-31 mariadb - master branch - PR 1 of 2 #804

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .templates/mariadb/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ RUN for CNF in ${CANDIDATES} ; do [ -f ${CNF} ] && break ; done ; \
-e "s/^read_buffer_size/# read_buffer_size/" \
${CNF}

# copy the root password check+fix into place
# https://github.com/linuxserver/docker-mariadb/issues/163
COPY iotstack_check-root-password.sh /etc/periodic/15min/iotstack_check-root-password.sh

# copy the health-check script into place
ENV HEALTHCHECK_SCRIPT="iotstack_healthcheck.sh"
COPY ${HEALTHCHECK_SCRIPT} /usr/local/bin/${HEALTHCHECK_SCRIPT}
Expand Down
28 changes: 28 additions & 0 deletions .templates/mariadb/iotstack_check-root-password.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# https://github.com/linuxserver/docker-mariadb/issues/163
# assumed installation path is /etc/periodic/15min/iotstack_check-root-password.sh

# marker file
MARKER="/tmp/root-password-checked"

# sense marker already exists
[ -f "${MARKER}" ] && exit 0

# create the marker
touch "${MARKER}"

# sense root password not defined yet.
# (defining the var necessarily causes a recreate)
[ -z "${MYSQL_ROOT_PASSWORD}" ] && exit 0

# can we execute a trivial command as root but WITHOUT a password?
if $(mariadb -u root -e 'quit' &> /dev/null) ; then
# yes! Set the password now
mariadb-admin -u root password "${MYSQL_ROOT_PASSWORD}"
echo "root password was not set - is now set" >"${MARKER}"
else
echo "root password checked - already set" >"${MARKER}"
fi

exit 0
20 changes: 1 addition & 19 deletions docs/Containers/Gitea.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Environment variables need to be set in several stages:
$ echo "GITEA_DB_ROOT_PASSWORD=$(uuidgen)" >>~/IOTstack.env
```

If omitted, the container will not start. See [note below](#rootpw).
If omitted, the container will not start.

You (the human user) will **never** need to know the username and passwords set here. You will not need to use these values in practice.

Expand Down Expand Up @@ -170,24 +170,6 @@ Environment variables need to be set in several stages:

* Gitea also supports LetsEncrypt. See [using ACME with Let's Encrypt](https://docs.gitea.com/administration/https-setup#using-acme-default-lets-encrypt).

## database root password { #rootpw }

At the time of writing (April 2025), the MariaDB instance was not respecting the environment variable being used to pass the root password into the container.

> See [MariaDB issue 163](https://github.com/linuxserver/docker-mariadb/issues/163)

You can ensure that the root password is set by running the following command:

``` console
$ docker exec gitea_db bash -c 'mariadb-admin -u root password $MYSQL_ROOT_PASSWORD'
```

If this command returns an error, it means that the root password was already set (presumably because Issue 163 has been resolved).

If this command succeeds without error, it means that the root password was not set but is now set.

Also notice that you did not need to know or copy/paste the root password to run the above command. It was sufficient to know the name of the environment variable containing the database root password.

## default ports

The IOTstack implementation listens on the following ports:
Expand Down