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

MySQL improvements #65

Merged
merged 7 commits into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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 config/console/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
globals:
www: /var/www/sites
mysql-login: "root:"
mysql-login: "root:root"
restart-command: s6-svc -r /var/run/s6/services/apache
"vhost:create":
folder: /var/www/sites/[site]/config/apache
Expand Down
2 changes: 1 addition & 1 deletion config/folioshell/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
globals:
www: /var/www/sites
mysql-login: "root:"
mysql-login: "root:root"
restart-command: s6-svc -r /var/run/s6/services/apache
"vhost:create":
folder: /var/www/sites/[site]/config/apache
Expand Down
3 changes: 3 additions & 0 deletions config/s6/cont-init.d/101-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ printf "%s" $MYSQL_ENABLE > /var/run/s6/container_environment/MYSQL_ENABLE
MYSQL_USER=${MYSQL_USER:=root}
printf "%s" $MYSQL_USER > /var/run/s6/container_environment/MYSQL_USER

MYSQL_PASS=${MYSQL_PASS:=root}
printf "%s" $MYSQL_PASS > /var/run/s6/container_environment/MYSQL_PASS

MYSQL_VOLUME=${MYSQL_VOLUME:=/mnt/www/mysql}
printf "%s" $MYSQL_VOLUME > /var/run/s6/container_environment/MYSQL_VOLUME

Expand Down
7 changes: 7 additions & 0 deletions config/s6/cont-init.d/102-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
echo "MySQL Configuration"
echo "> MYSQL_ENABLE = "${MYSQL_ENABLE:-undefined}
echo "> MYSQL_USER = "${MYSQL_USER:-undefined}

if [[ $APP_ENV = "development" ]]
then
echo "> MYSQL_PASS = "${MYSQL_PASS:-undefined}
else
echo "> MYSQL_PASS = [redacted]"
ercanozkaya marked this conversation as resolved.
Show resolved Hide resolved
fi
echo "> MYSQL_VOLUME = "${MYSQL_VOLUME:-undefined}

echo "Joomla Configuration"
Expand Down
5 changes: 2 additions & 3 deletions config/s6/mysql-init.d/101-perm.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/usr/bin/with-contenv bash

echo "[myql-init.d] ${file}: Granting local access of MySQL database from localhost for ${MYSQL_USER}"
/usr/bin/mysql -e "
CREATE USER IF NOT EXISTS '${MYSQL_USER}'@'%';
"

if [[ $APP_ENV = "development" ]]
then
echo "[mysql-init.d] ${file}: Granting remote access of MySQL database from any IP address for ${MYSQL_USER}"
/usr/bin/mysql -e "
CREATE USER IF NOT EXISTS '${MYSQL_USER}'@'%';
ALTER USER '${MYSQL_USER}'@'%' IDENTIFIED WITH mysql_native_password BY '${MYSQL_PASS}';
ALTER USER '${MYSQL_USER}'@'localhost' IDENTIFIED WITH mysql_native_password BY '${MYSQL_PASS}';
GRANT ALL ON *.* TO '${MYSQL_USER}'@'%';
FLUSH PRIVILEGES;
"
Expand Down
4 changes: 4 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ services:
#- "8443:8443" # HTTPS Apache
- "3306:3306" # MySQL
- "33060:33060" # MySQL - X Plugin
cap_add:
- SYS_NICE


#docker compose --profile phpmyadmin up
phpmyadmin:
Expand All @@ -59,6 +62,7 @@ services:
- PMA_PORT=3306
- PMA_ARBITRARY=1
- PMA_USER=root
- PMA_PASSWORD=root
ports:
- "8180:80" # phpMyAdmin Server
depends_on:
Expand Down