Skip to content
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
14 changes: 14 additions & 0 deletions docker/docker-compose-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ services:
- |
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
MYSQL_PID=$$!

mkdir -p /var/run/mysqld 2>/dev/null || true
Comment on lines +29 to +30
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s trailing whitespace on the blank line after MYSQL_PID=$$! (line 29) and an extra blank line later (line 43), which makes the YAML harder to review/maintain. Please remove the trailing spaces and collapse redundant blank lines.

Copilot uses AI. Check for mistakes.
for i in $(seq 1 30); do
if [ -S /var/lib/mysql/mysql.sock ]; then
Comment on lines +30 to +32
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description’s “Files changed” list mentions only docker-compose.yml, but this PR also modifies docker-compose-debug.yml. Please update the description to reflect all changed files so reviewers/users aren’t surprised by debug compose behavior changes.

Copilot uses AI. Check for mistakes.
break
fi
sleep 1
done

if [ -S /var/lib/mysql/mysql.sock ] && [ ! -e /var/run/mysqld/mysqld.sock ]; then
Comment on lines +31 to +38
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as in docker-compose.yml: the 30s wait loop can skip symlink creation if /var/lib/mysql/mysql.sock shows up after the loop, causing the later mysqladmin ping -h localhost ... wait (and healthcheck) to fail indefinitely because /var/run/mysqld/mysqld.sock never gets created. Prefer creating the symlink immediately (dangling is OK) and/or retrying symlink creation while waiting for MySQL, only skipping if /var/run/mysqld/mysqld.sock already exists as a real socket.

Suggested change
for i in $(seq 1 30); do
if [ -S /var/lib/mysql/mysql.sock ]; then
break
fi
sleep 1
done
if [ -S /var/lib/mysql/mysql.sock ] && [ ! -e /var/run/mysqld/mysqld.sock ]; then
# Ensure the socket symlink exists early; dangling is acceptable.
if [ ! -S /var/run/mysqld/mysqld.sock ]; then
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
fi
for i in $(seq 1 30); do
# If the MySQL socket appears during the wait, re-ensure the symlink.
if [ -S /var/lib/mysql/mysql.sock ] && [ ! -S /var/run/mysqld/mysqld.sock ]; then
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
echo 'Socket symlink ensured'
break
fi
if [ -S /var/lib/mysql/mysql.sock ]; then
break
fi
sleep 1
done
# Final safeguard to ensure the symlink exists once MySQL is up.
if [ -S /var/lib/mysql/mysql.sock ] && [ ! -S /var/run/mysqld/mysqld.sock ]; then

Copilot uses AI. Check for mistakes.
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
echo 'Socket symlink ensured'
Comment on lines +39 to +40
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ln failures are ignored (2>/dev/null || true) but the script still prints Socket symlink ensured, which can report success even if the symlink wasn’t actually created. Consider letting ln fail loudly or gating the success message on ln’s exit code.

Suggested change
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
echo 'Socket symlink ensured'
if ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null; then
echo 'Socket symlink ensured'
else
echo 'Failed to ensure socket symlink' >&2
fi

Copilot uses AI. Check for mistakes.
fi


echo 'Waiting for MySQL to start...'
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
Expand Down
13 changes: 13 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,19 @@ services:
/usr/local/bin/docker-entrypoint.sh mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci &
MYSQL_PID=$$!

mkdir -p /var/run/mysqld 2>/dev/null || true
for i in $(seq 1 30); do
if [ -S /var/lib/mysql/mysql.sock ]; then
break
fi
sleep 1
done
Comment on lines +30 to +35
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 30s wait loop can leave the symlink uncreated if /var/lib/mysql/mysql.sock appears after the loop finishes. In that case the subsequent mysqladmin ping -h localhost ... loop (and the container healthcheck) can keep failing indefinitely because /var/run/mysqld/mysqld.sock never gets created. Consider creating the /var/run/mysqld/mysqld.sock symlink up-front (a dangling symlink is fine) and/or retrying symlink creation while waiting for MySQL, only skipping if /var/run/mysqld/mysqld.sock already exists as a real socket.

Copilot uses AI. Check for mistakes.

if [ -S /var/lib/mysql/mysql.sock ] && [ ! -e /var/run/mysqld/mysqld.sock ]; then
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
echo 'Socket symlink ensured'
Comment on lines +38 to +39
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ln errors are suppressed (2>/dev/null || true) but the script still prints Socket symlink ensured unconditionally, which can be misleading if the symlink creation fails. Consider either not swallowing the ln failure or checking ln’s exit status before emitting the success message.

Suggested change
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null || true
echo 'Socket symlink ensured'
ln -sf /var/lib/mysql/mysql.sock /var/run/mysqld/mysqld.sock 2>/dev/null
if [ $$? -eq 0 ]; then
echo 'Socket symlink ensured'
else
echo 'Failed to ensure socket symlink' >&2
fi

Copilot uses AI. Check for mistakes.
fi

echo 'Waiting for MySQL to start...'
until mysqladmin ping -h localhost -u root -p$${MYSQL_ROOT_PASSWORD} --silent 2>/dev/null; do
echo 'MySQL is starting...'
Expand Down
Loading