#!/bin/bash wpcli() { docker compose run --rm wpcli "$@" } echo "Waiting for MariaDB to be ready..." while [ "$(docker inspect --format='{{.State.Health.Status}}' db_${DOMAIN})" != "healthy" ]; do #echo "MariaDB is not healthy yet. Retrying..." echo "Loading..." sleep 5 done if ! wpcli core is-installed ; then echo "Installing WordPress..." wpcli core install \ --url="https://${DOMAIN}" \ --title="${SITE_TITLE}" \ --admin_user="${ADMIN_USER}" \ --admin_password="${ADMIN_PASSWORD}" \ --admin_email="${ADMIN_EMAIL}" \ --skip-email wpcli rewrite structure '/%postname%/' echo "Installing and activating plugins..." wpcli plugin install wordfence cache-enabler seo-by-rank-math fluent-smtp kadence-blocks query-monitor --activate wpcli option update cache_enabler '{ "version": "1.8.15", "use_trailing_slashes": 1, "permalink_structure": "has_trailing_slash", "cache_expires": 1, "cache_expiry_time": 8, "clear_site_cache_on_saved_post": 0, "clear_site_cache_on_saved_comment": 0, "clear_site_cache_on_saved_term": 0, "clear_site_cache_on_saved_user": 0, "clear_site_cache_on_changed_plugin": 0, "convert_image_urls_to_webp": 0, "mobile_cache": 0, "compress_cache": 1, "minify_html": 1, "minify_inline_css_js": 1, "excluded_post_ids": "", "excluded_page_paths": "", "excluded_query_strings": "", "excluded_cookies": "" }' --format=json wpcli theme install kadence --activate wpcli plugin update --all wpcli theme update --all # List users #echo "== User List ==" #wpcli user list #echo "" # Show installed plugin #echo "== Theme List ==" #wpcli theme list #echo "" # Show installed plugin #echo "== Plugin List ==" #wpcli plugin list #echo "" echo "WordPress setup completed!" else echo "WordPress is already installed. Exiting now..." fi