Skip to content
Merged
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
2 changes: 1 addition & 1 deletion features/src/mariadb/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "MariaDB",
"id": "mariadb",
"version": "1.4.0",
"version": "1.4.1",
"description": "Sets up MariaDB into the Dev Environment",
"options": {
"installDatabaseToWorkspaces": {
Expand Down
6 changes: 3 additions & 3 deletions features/src/mariadb/entrypoint.alpine.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ chown -R "${MARIADB_USER}:${MARIADB_USER}" "${MARIADB_DATADIR}"
install -d /run/mysqld -o "${MARIADB_USER}" -g "${MARIADB_USER}"

if [ ! -d "${MARIADB_DATADIR}/mysql" ]; then
mysql_install_db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
mariadb-install-db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
fi

if [ -x /sbin/chpst ]; then
# shellcheck disable=SC2086,SC2154 # there could be multiple options in EXTRA_OPTIONS
exec chpst -u "${MARIADB_USER}:${MARIADB_USER}" \
mysqld \
mariadbd \
--datadir="${MARIADB_DATADIR}" \
--sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION \
--max_allowed_packet=67M \
Expand All @@ -27,7 +27,7 @@ if [ -x /sbin/chpst ]; then
else
# shellcheck disable=SC2086 # there could be multiple options in EXTRA_OPTIONS
exec su-exec "${MARIADB_USER}:${MARIADB_USER}" \
mysqld \
mariadbd \
--datadir="${MARIADB_DATADIR}" \
--sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION \
--max_allowed_packet=67M \
Expand Down
4 changes: 2 additions & 2 deletions features/src/mariadb/entrypoint.deb.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ chown -R "${MARIADB_USER}:${MARIADB_USER}" "${MARIADB_DATADIR}"
install -d /run/mysqld -o "${MARIADB_USER}" -g "${MARIADB_USER}"

if [ ! -d "${MARIADB_DATADIR}/mysql" ]; then
mysql_install_db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
mariadb-install-db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
fi

MY_UID="$(id -u "${MARIADB_USER}")"
MY_GID="$(id -g "${MARIADB_USER}")"

# shellcheck disable=SC2086,SC2154 # there could be multiple options in EXTRA_OPTIONS
exec setpriv --reuid="${MY_UID}" --regid="${MY_GID}" --inh-caps=-all --init-groups \
mysqld \
mariadbd \
--datadir="${MARIADB_DATADIR}" \
--sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION \
--max_allowed_packet=67M \
Expand Down
4 changes: 2 additions & 2 deletions features/src/mariadb/service-run.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ chown -R "${MARIADB_USER}:${MARIADB_USER}" "${MARIADB_DATADIR}"
install -d /run/mysqld -o "${MARIADB_USER}" -g "${MARIADB_USER}"

if [ ! -d "${MARIADB_DATADIR}/mysql" ]; then
mysql_install_db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
mariadb-install-db --auth-root-authentication-method=normal --skip-test-db --user="${MARIADB_USER}" --datadir="${MARIADB_DATADIR}"
fi

# shellcheck disable=SC2086,SC2154 # there could be multiple options in EXTRA_OPTIONS
exec chpst -u "${MARIADB_USER}:${MARIADB_USER}" \
mysqld \
mariadbd \
--datadir="${MARIADB_DATADIR}" \
--sql-mode=ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION \
--max_allowed_packet=67M \
Expand Down
16 changes: 8 additions & 8 deletions features/test/mariadb/checks.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/bash

if hash sv >/dev/null 2>&1; then
second=0
while ! mariadb-admin ping -u root -h 127.0.0.1 --silent && [[ "${second}" -lt 60 ]]; do
sleep 1
second=$((second + 1))
done
check "MariaDB is online" mariadb-admin ping -u root -h 127.0.0.1 --silent

if hash sv > /dev/null 2>&1; then
check "mariadb is running" sudo sh -c 'sv status mariadb | grep -E ^run:'
sudo sv stop mariadb
check "mariadb is stopped" sudo sh -c 'sv status mariadb | grep -E ^down:'
Expand All @@ -9,13 +16,6 @@ else
check "mariadb is running" pgrep mariadbd
fi
Comment thread
sjinks marked this conversation as resolved.

second=0
while ! mysqladmin ping -u root -h 127.0.0.1 --silent && [[ "${second}" -lt 60 ]]; do
sleep 1
second=$((second+1))
done
check "MariaDB is online" mysqladmin ping -u root -h 127.0.0.1 --silent

# Microsoft's base images contain zsh. We don't want to run this check for MS images because we have no control over the installed services.
if test -d /etc/rc2.d && ! test -e /usr/bin/zsh; then
dir="$(ls -1 /etc/rc2.d)"
Expand Down
Loading