templates/deployment.yaml を更新

This commit is contained in:
2025-12-12 05:25:50 +00:00
parent 8cb599bf0f
commit 70fbf15b69

View File

@@ -74,7 +74,6 @@ spec:
define( 'WP_HOME', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' ); define( 'WP_HOME', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' );
define( 'WP_SITEURL', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' ); define( 'WP_SITEURL', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' );
// Multisite設定
$multisite_enabled = getenv('WORDPRESS_MULTISITE_ENABLED'); $multisite_enabled = getenv('WORDPRESS_MULTISITE_ENABLED');
if ( $multisite_enabled === 'true' ) { if ( $multisite_enabled === 'true' ) {
define('WP_ALLOW_MULTISITE', true); define('WP_ALLOW_MULTISITE', true);
@@ -111,15 +110,7 @@ spec:
max_attempts=30 max_attempts=30
attempt=0 attempt=0
while [ $attempt -lt $max_attempts ]; do while [ $attempt -lt $max_attempts ]; do
if php -r " 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
\$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
@@ -165,17 +156,15 @@ spec:
echo "WordPress is already installed, skipping installation" echo "WordPress is already installed, skipping installation"
if [ -f /tmp/wp-cli.phar ]; then if [ -f /tmp/wp-cli.phar ]; then
echo "Running WordPress core update check..." echo "Running WordPress core update check..."
CURRENT_VERSION=$(cat /usr/src/wordpress/wp-includes/version.php | grep "wp_version = " | cut -d "'" -f 2 || echo "unknown")
echo "Target WordPress version: $CURRENT_VERSION"
/tmp/wp-cli.phar --path=/var/www/html core update-db 2>/dev/null || echo "No database update needed" /tmp/wp-cli.phar --path=/var/www/html core update-db 2>/dev/null || echo "No database update needed"
fi fi
fi fi
{{- if .Values.wordpress.adsTxt.enabled }} {{- if .Values.wordpress.adsTxt.enabled }}
echo "Deploying ads.txt..." echo "Deploying ads.txt..."
cat > /var/www/html/ads.txt << 'EOF' cat > /var/www/html/ads.txt << 'EOFADSTXT'
{{ .Values.wordpress.adsTxt.content }} {{ .Values.wordpress.adsTxt.content }}
EOF EOFADSTXT
echo "ads.txt deployed" echo "ads.txt deployed"
{{- end }} {{- end }}