Permalink
Browse files

Merge pull request #717 from amazeeio/707-fix-default-charset-collation

#707 - change default charset and collation on DBs
  • Loading branch information...
Schnitzel committed Nov 1, 2018
2 parents 865b84e + 236ea18 commit c488cd3eee37cb6ceb277177a5358a18dde25abc
@@ -92,7 +92,7 @@ EOF
if [ "$MARIADB_DATABASE" != "" ]; then
echo "[i] Creating database: $MARIADB_DATABASE"
echo "CREATE DATABASE IF NOT EXISTS \`$MARIADB_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
echo "CREATE DATABASE IF NOT EXISTS \`$MARIADB_DATABASE\` ;" >> $tfile
if [ "$MARIADB_USER" != "" ]; then
echo "[i] Creating user: $MARIADB_USER with password $MARIADB_PASSWORD"
echo "GRANT ALL ON \`$MARIADB_DATABASE\`.* to '$MARIADB_USER'@'%' IDENTIFIED BY '$MARIADB_PASSWORD';" >> $tfile
@@ -47,8 +47,8 @@ RUN \
rm -rf /var/lib/mysql/* /etc/mysql/; \
curl -sSL http://mysqltuner.pl/ -o mysqltuner.pl
COPY logging.bash /lagoon/entrypoints/10-mariadb-logging
COPY envplate.bash /lagoon/entrypoints/20-mariadb-envplate
COPY docker-entrypoint.bash /lagoon/entrypoints/9999-mariadb-entrypoint
COPY mysql-backup.sh /lagoon/
COPY my.cnf /etc/mysql/my.cnf
@@ -60,7 +60,9 @@ RUN for i in /var/run/mysqld /var/lib/mysql /etc/mysql/conf.d /docker-entrypoint
sed -i 's/#!\/bin\/bash -ue/#!\/bin\/bash -e/' /usr/bin/wsrep_sst_rsync
COPY root/usr/share/container-scripts/mysql/readiness-probe.sh /usr/share/container-scripts/mysql/readiness-probe.sh
RUN /bin/fix-permissions /usr/share/container-scripts/mysql/
RUN /bin/fix-permissions /usr/share/container-scripts/mysql/ \
&& /bin/fix-permissions /etc/mysql
RUN touch /var/log/mariadb-slow.log && /bin/fix-permissions /var/log/mariadb-slow.log
RUN touch /var/log/mariadb-queries.log && /bin/fix-permissions /var/log/mariadb-queries.log
@@ -75,7 +75,7 @@ EOF
if [ "$MARIADB_DATABASE" != "" ]; then
echo "[i] Creating database: $MARIADB_DATABASE"
echo "CREATE DATABASE IF NOT EXISTS \`$MARIADB_DATABASE\` CHARACTER SET utf8 COLLATE utf8_general_ci;" >> $tfile
echo "CREATE DATABASE IF NOT EXISTS \`$MARIADB_DATABASE\` ;" >> $tfile
if [ "$MARIADB_USER" != "" ]; then
echo "[i] Creating user: $MARIADB_USER with password $MARIADB_PASSWORD"
echo "GRANT ALL ON \`$MARIADB_DATABASE\`.* to '$MARIADB_USER'@'%' IDENTIFIED BY '$MARIADB_PASSWORD';" >> $tfile
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -eo pipefail
/bin/ep /etc/mysql/*
@@ -9,8 +9,8 @@ socket = /run/mysqld/mysqld.sock
[mysqld]
port = 3306
socket = /run/mysqld/mysqld.sock
character_set_server = utf8mb4
collation_server = utf8mb4_bin
character_set_server = ${MARIADB_CHARSET:-utf8mb4}
collation_server = ${MARIADB_COLLATION:-utf8mb4_bin}
expire_logs_days = 10
ignore_db_dirs=backup
innodb_buffer_pool_size = 256M
@@ -3,4 +3,6 @@ FROM ${IMAGE_REPO:-lagoon}/mariadb
ENV MARIADB_DATABASE=keycloak \
MARIADB_USER=keycloak \
MARIADB_PASSWORD=keycloak
MARIADB_PASSWORD=keycloak \
MARIADB_CHARSET=utf8 \
MARIADB_COLLATION=utf8_general_ci

0 comments on commit c488cd3

Please sign in to comment.