From 49aef86119ec8e6a72fbba2a16575d4be08f1213 Mon Sep 17 00:00:00 2001 From: Artur Moreira Date: Wed, 25 Mar 2026 00:17:23 +0000 Subject: [PATCH] feat(wordpress): add wordpress-andebol service on port 8081 for andebol.net MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a second WordPress instance (wordpress-andebol) with its own MariaDB (db-andebol) on port 8081 to support the andebol.net domain. New env vars required in .env: ANDEBOL_MYSQL_ROOT_PASSWORD ANDEBOL_MYSQL_PASSWORD ANDEBOL_WORDPRESS_PUBLIC_URL (optional, defaults to http://localhost:8081) Closes BIT-507 (partial — WP deploy step). Co-Authored-By: Paperclip --- wordpress/docker-compose.yml | 92 ++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/wordpress/docker-compose.yml b/wordpress/docker-compose.yml index 3e5ff5a..d8728c7 100644 --- a/wordpress/docker-compose.yml +++ b/wordpress/docker-compose.yml @@ -100,6 +100,98 @@ services: retries: 5 start_period: 60s + db-andebol: + image: mariadb:11 + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: ${ANDEBOL_MYSQL_ROOT_PASSWORD} + MYSQL_DATABASE: wordpress_andebol + MYSQL_USER: wordpress + MYSQL_PASSWORD: ${ANDEBOL_MYSQL_PASSWORD} + volumes: + - db_andebol_data:/var/lib/mysql + healthcheck: + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + interval: 10s + timeout: 5s + retries: 8 + start_period: 90s + + wordpress-andebol: + image: wordpress:6-php8.3-apache + restart: unless-stopped + depends_on: + db-andebol: + condition: service_healthy + ports: + - "8081:80" + environment: + WORDPRESS_DB_HOST: db-andebol:3306 + WORDPRESS_DB_NAME: wordpress_andebol + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: ${ANDEBOL_MYSQL_PASSWORD} + WORDPRESS_TABLE_PREFIX: wp_ + WORDPRESS_PUBLIC_URL: ${ANDEBOL_WORDPRESS_PUBLIC_URL:-http://localhost:8081} + WORDPRESS_DEBUG: ${WORDPRESS_DEBUG:-0} + WORDPRESS_CONFIG_EXTRA: | + define('DISABLE_WP_CRON', true); + $$_wp_dbg = getenv('WORDPRESS_DEBUG'); + $$_wp_debug_on = ($$_wp_dbg !== false && $$_wp_dbg !== '' && $$_wp_dbg !== '0' && strtolower((string) $$_wp_dbg) !== 'false' && strtolower((string) $$_wp_dbg) !== 'no'); + define('WP_DEBUG', $$_wp_debug_on); + define('WP_DEBUG_LOG', $$_wp_debug_on); + define('WP_DEBUG_DISPLAY', $$_wp_debug_on); + define('SCRIPT_DEBUG', $$_wp_debug_on); + if ($$_wp_debug_on) { + error_reporting(E_ALL); + @ini_set('display_errors', '1'); + } + define('REST_API_ENABLED', true); + $$_wp_public_url = getenv('WORDPRESS_PUBLIC_URL'); + if ($$_wp_public_url === false || $$_wp_public_url === '') { + $$_wp_public_url = 'http://localhost:8081'; + } + $$_wp_public_url = rtrim($$_wp_public_url, '/'); + $$_container_local = in_array($$_wp_public_url, array('http://localhost:8081', 'http://127.0.0.1:8081'), true); + $$_proxy_hint = !empty($$_SERVER['HTTP_X_FORWARDED_FOR']) + || !empty($$_SERVER['HTTP_X_FORWARDED_PROTO']) + || !empty($$_SERVER['HTTP_X_REAL_IP']); + if ($$_container_local + && !empty($$_SERVER['HTTP_HOST']) + && strpos($$_SERVER['HTTP_HOST'], 'localhost') === false + && strpos($$_SERVER['HTTP_HOST'], '127.0.0.1') === false + && $$_proxy_hint + ) { + $$_proto = 'http'; + if (!empty($$_SERVER['HTTP_X_FORWARDED_PROTO'])) { + $$_first = strtolower(trim(strtok($$_SERVER['HTTP_X_FORWARDED_PROTO'], ','))); + if ($$_first === 'https') { + $$_proto = 'https'; + } + } elseif (!empty($$_SERVER['HTTPS']) && $$_SERVER['HTTPS'] !== 'off') { + $$_proto = 'https'; + } + $$_wp_public_url = $$_proto . '://' . $$_SERVER['HTTP_HOST']; + } + define('WP_HOME', $$_wp_public_url); + define('WP_SITEURL', $$_wp_public_url); + if (!empty($$_SERVER['HTTP_X_FORWARDED_PROTO'])) { + $$_xf_proto = strtolower(trim(strtok($$_SERVER['HTTP_X_FORWARDED_PROTO'], ','))); + if ($$_xf_proto === 'https') { + $$_SERVER['HTTPS'] = 'on'; + } + } + volumes: + - wp_andebol_content:/var/www/html/wp-content + - ./php.ini:/usr/local/etc/php/conf.d/custom.ini:ro + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/wp-json/wp/v2/", "-o", "/dev/null", "-w", "%{http_code}"] + interval: 30s + timeout: 10s + retries: 5 + start_period: 60s + volumes: db_data: wp_content: + db_andebol_data: + wp_andebol_content: