templates/deployment.yaml を更新

This commit is contained in:
2025-11-25 23:46:08 +00:00
parent 3cf7957d0e
commit 8ccec93399

View File

@@ -100,7 +100,15 @@ spec:
max_attempts=30 max_attempts=30
attempt=0 attempt=0
while [ $attempt -lt $max_attempts ]; do while [ $attempt -lt $max_attempts ]; do
if /tmp/wp-cli.phar --path=/usr/src/wordpress db check 2>/dev/null; then if php -r "
\$link = @mysqli_connect('${WORDPRESS_DB_HOST}', '${WORDPRESS_DB_USER}', '${WORDPRESS_DB_PASSWORD}', '${WORDPRESS_DB_NAME}');
if (\$link) {
echo 'Connected';
mysqli_close(\$link);
exit(0);
}
exit(1);
" 2>/dev/null; then
echo "Database connection successful" echo "Database connection successful"
break break
fi fi
@@ -109,6 +117,14 @@ spec:
sleep 2 sleep 2
done done
if [ $attempt -eq $max_attempts ]; then
echo "ERROR: Database connection timeout"
echo "DB_HOST: ${WORDPRESS_DB_HOST}"
echo "DB_NAME: ${WORDPRESS_DB_NAME}"
echo "DB_USER: ${WORDPRESS_DB_USER}"
exit 1
fi
echo "Checking if WordPress is already installed..." echo "Checking if WordPress is already installed..."
TABLES=$(/tmp/wp-cli.phar --path=/usr/src/wordpress db query "SHOW TABLES LIKE '${WORDPRESS_TABLE_PREFIX}options';" 2>/dev/null || echo "") TABLES=$(/tmp/wp-cli.phar --path=/usr/src/wordpress db query "SHOW TABLES LIKE '${WORDPRESS_TABLE_PREFIX}options';" 2>/dev/null || echo "")