CI: Another try with inline mysql start
This commit is contained in:
parent
2e5e1de9ce
commit
706fb4cd46
2 changed files with 7 additions and 23 deletions
27
.github/actions/setup-database/action.yml
vendored
27
.github/actions/setup-database/action.yml
vendored
|
|
@ -43,31 +43,12 @@ runs:
|
||||||
echo "MySQL is ready"
|
echo "MySQL is ready"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Set up MySQL Configuration and Privileges
|
- name: Set up MySQL Privileges
|
||||||
if: ${{ inputs.database == 'mysql' }}
|
if: ${{ inputs.database == 'mysql' }}
|
||||||
run: |
|
run: |
|
||||||
# Create MySQL config file inside the container and restart MySQL to apply settings
|
# Note: MySQL server configuration (character set, collation, row format) is set
|
||||||
# This ensures settings are applied at server startup, similar to command-line arguments
|
# at container startup via custom entrypoint script that passes command-line arguments
|
||||||
CONTAINER_ID=$(docker ps --filter "ancestor=mysql:8.0" --format "{{.ID}}" | head -1)
|
# to mysqld, similar to how mirromutth/mysql-action works.
|
||||||
if [ -n "$CONTAINER_ID" ]; then
|
|
||||||
# Create config file in container
|
|
||||||
docker exec $CONTAINER_ID sh -c 'printf "[mysqld]\ncharacter-set-server=utf8mb4\ncollation-server=utf8mb4_unicode_ci\ninnodb-default-row-format=DYNAMIC\n" > /etc/mysql/conf.d/custom.cnf'
|
|
||||||
# Restart MySQL to apply config (graceful shutdown and start)
|
|
||||||
docker exec $CONTAINER_ID sh -c 'mysqladmin -u root -proot_password shutdown' || true
|
|
||||||
sleep 2
|
|
||||||
docker start $CONTAINER_ID
|
|
||||||
# Wait for MySQL to be ready again
|
|
||||||
until mysqladmin ping -h 127.0.0.1 -u root -proot_password --silent; do
|
|
||||||
sleep 1
|
|
||||||
echo -n .
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
# Also set global variables as a fallback (though config file should handle this)
|
|
||||||
mysql -u root -proot_password -h 127.0.0.1 mysql <<EOF
|
|
||||||
SET GLOBAL character_set_server = 'utf8mb4';
|
|
||||||
SET GLOBAL collation_server = 'utf8mb4_unicode_ci';
|
|
||||||
SET GLOBAL innodb_default_row_format = 'DYNAMIC';
|
|
||||||
EOF
|
|
||||||
# Ensure user exists and has proper privileges
|
# Ensure user exists and has proper privileges
|
||||||
mysql -u root -proot_password -h 127.0.0.1 mysql <<EOF
|
mysql -u root -proot_password -h 127.0.0.1 mysql <<EOF
|
||||||
CREATE USER IF NOT EXISTS 'evennia'@'%' IDENTIFIED BY 'password';
|
CREATE USER IF NOT EXISTS 'evennia'@'%' IDENTIFIED BY 'password';
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,9 @@ jobs:
|
||||||
--health-interval=10s
|
--health-interval=10s
|
||||||
--health-timeout=5s
|
--health-timeout=5s
|
||||||
--health-retries=3
|
--health-retries=3
|
||||||
|
--entrypoint="/bin/bash"
|
||||||
|
-c
|
||||||
|
"printf '#!/bin/bash\nexec /usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --innodb-default-row-format=DYNAMIC \"\$@\"\n' > /tmp/mysql-entrypoint.sh && chmod +x /tmp/mysql-entrypoint.sh && exec /tmp/mysql-entrypoint.sh"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue