Skip to content

Fix: make job consistent with wordpress environment #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Anas-hameed
Copy link

@Anas-hameed Anas-hameed commented Jun 26, 2025

Description:

The initialization task did not have the necessary environment variables to make DB connections. This is handy and required when installing certain plugins during initialization.

For now, we only had the wp-content directory mounted into the container. For this reason, wordpress would copy the installation files to var/www/html on startup. For reference, here are the startup logs:

WordPress not found in /var/www/html - copying now...
Complete! WordPress has been successfully copied to /var/www/html
No 'wp-config.php' found in /var/www/html, but 'WORDPRESS_...' variables supplied; copying 'wp-config-docker.php' (WORDPRESS_CONFIG_EXTRA WORDPRESS_DB_HOST WORDPRESS_DB_NAME WORDPRESS_DB_PASSWORD WORDPRESS_DB_USER WORDPRESS_DEBUG WORDPRESS_TABLE_PREFIX)

By mounting the entire wordpress directory in the var/www/html directory, we can also install wordpress plugins using initialization tasks and modify the wp-config.php file during initialization tasks to keep it persistent across the job and the wordpress container itself.

Add environment variable for db connection during init task
make volume path consistent with wordpress container
We do this as wordpress would copy everything from the /usr/src/wordpress to /var/www/html on startup when it would not find a valid wordpress installation in that directory.

This is also helpful when we need to install plugins during the initialization tasks as we more than often need to keep a persistent wp-config.php file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant