diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 37d799fd01e21b67ccd879a8142a83b9459e4bbd..ce0340be47e83cd58d230151c82e571403516517 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1 +1,27 @@ include: "https://git.autistici.org/ai3/build-container/raw/master/common.yml" + +# test the newly built container before releasing it. +stages: + - build + - test + - release + +test: + stage: test + image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/debian:stable + services: + - name: ${IMAGE_TAG} + alias: noblogs + - name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mysql:latest + alias: mysql + variables: + APACHE_PORT: 8080 + SITE_URL: "http://noblogs:8080" + MYSQL_DATABASE: noblogstest + MYSQL_ROOT_PASSWORD: changeme + PHP_FPM_USER: www-data + script: + - apt -q update + - env DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install curl + - "curl -H 'Host: noblogs.org' -v ${SITE_URL}" + diff --git a/Dockerfile b/Dockerfile index 8ead4316408e2f349adc50e353a4c37627a5c4f4..1866a5648a911edb81d4855095d37fc00ba2489c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,3 +17,6 @@ COPY docker/post-upgrade.sh /post-upgrade.sh RUN /tmp/build.sh && rm /tmp/build.sh +# For testing purposes (8080 is the default port of apache2-php-base). +EXPOSE 8080/tcp + diff --git a/docker/conf/php/7.3/fpm/pool.d/www.conf b/docker/conf/php/7.3/fpm/pool.d/www.conf index 2deb81cc83d613cec114479dbf78441722b15ea7..9be0c6090846a616c871f7910b9d02ddc81e9f79 100644 --- a/docker/conf/php/7.3/fpm/pool.d/www.conf +++ b/docker/conf/php/7.3/fpm/pool.d/www.conf @@ -1,4 +1,5 @@ [www] +user = ${PHP_FPM_USER} listen = /run/php/php7.3-fpm.sock pm = dynamic diff --git a/docker/wp-config.php b/docker/wp-config.php index 1b464007a992a92c565586768059e0af62a356f6..d9695b9e17fe2473d8f74907768af0af3ca14da5 100644 --- a/docker/wp-config.php +++ b/docker/wp-config.php @@ -4,8 +4,38 @@ * First of all, read our own configuration file. * * Store the result in an associative array '$noblogs_config'. + * + * If the configuration file does not exist, start with a testing + * configuration that is meant to work with our CI. */ -$noblogs_config = json_decode(file_get_contents('/etc/noblogs/config.json'), true); +$noblogs_config = array( + "secrets" => array( + "auth_key" => "testkey", + "secure_auth_key" => "testkey", + "logged_in_key" => "testkey", + "nonce_key" => "testkey", + "auth_salt" => "testkey", + "secure_auth_salt" => "testkey", + "logged_in_salt" => "testkey", + "nonce_salt" => "testkey" + ), + "db_config" => array( + "backends" => array( + "default" => array( + "host" => "mysql", + "port" => "3306", + "name" => getenv("MYSQL_DATABASE"), + "user" => "root", + "password" => getenv("MYSQL_ROOT_PASSWORD") + ) + ) + ) + ); + +$noblogs_config_json = file_get_contents('/etc/noblogs/config.json'); +if ($noblogs_config_json) { + $noblogs_config = json_decode($noblogs_config_json, true); +} /** * The base configurations of the WordPress.