Skip to content

Commit e88ad85

Browse files
committed
Fix theme activation
1 parent c0a6dc7 commit e88ad85

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

wordpress/setup.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,23 @@
11
#!/bin/bash
2-
set -e
2+
# Don't use set -e so script continues even if some commands fail
3+
4+
# Change to WordPress directory
5+
cd /var/www/html
6+
7+
# Wait for wp-config.php to exist (created by docker-entrypoint)
8+
echo "Waiting for WordPress configuration..."
9+
while [ ! -f /var/www/html/wp-config.php ]; do
10+
sleep 2
11+
done
312

413
# Wait for database to be ready
5-
until wp db check --allow-root 2>/dev/null; do
6-
echo "Waiting for database..."
14+
echo "Waiting for database connection..."
15+
for i in $(seq 1 30); do
16+
if wp db check --allow-root --path=/var/www/html 2>/dev/null; then
17+
echo "Database connected!"
18+
break
19+
fi
20+
echo "Database not ready, attempt $i/30..."
721
sleep 3
822
done
923

@@ -49,10 +63,9 @@ if ! wp plugin is-active next-revalidate --allow-root 2>/dev/null; then
4963
wp plugin activate next-revalidate --allow-root
5064
fi
5165

52-
# Activate the headless theme (always run, safe if already active)
53-
# Note: Theme directory name must match the actual directory in wp-content/themes
66+
# Activate the headless theme
5467
echo "Activating Next.js Headless theme..."
55-
wp theme activate theme --allow-root || wp theme activate nextjs-headless --allow-root || true
68+
wp theme activate nextjs-headless --allow-root || echo "WARNING: Could not activate nextjs-headless theme"
5669

5770
# Configure the plugin if NEXTJS_URL is set
5871
if [ -n "$NEXTJS_URL" ]; then

0 commit comments

Comments
 (0)