Merge ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master into ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master

Proposed by Thomas Cuthbert
Status: Merged
Approved by: Haw Loeung
Approved revision: 33352a089fc2e7e9262c77958b322036d0ce787d
Merged at revision: 31935ce1ccf73af80eff56b73c3e9205430d1174
Proposed branch: ~tcuthbert/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master
Merge into: ~wordpress-charmers/charm-k8s-wordpress/+git/wordpress-k8s-image-builder:master
Diff against target: 77 lines (+27/-6)
3 files modified
Dockerfile (+4/-3)
files/docker-php.conf (+6/-0)
files/wp-config.php (+17/-3)
Reviewer Review Type Date Requested Status
Haw Loeung +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+382824@code.launchpad.net

Commit message

Docker image configuration changes:

    * Update wp-config to support being behind TLS reverse proxy and move debug logging statements up so they actually are applied
    * Permalinks require mod_rewrite enabled for the directory root
    * Add missing required packages for WordPress and WP openid plugins to work

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Unable to determine commit message from repository - please click "Set commit message" and enter the commit message manually.

Revision history for this message
Haw Loeung (hloeung) wrote :

LGTM

review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 31935ce1ccf73af80eff56b73c3e9205430d1174

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/Dockerfile b/Dockerfile
index 2c86bef..b2d507a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,8 +19,8 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selectio
19# Update all packages, remove cruft, install required packages, configure apache19# Update all packages, remove cruft, install required packages, configure apache
20RUN apt-get update && apt-get -y dist-upgrade \20RUN apt-get update && apt-get -y dist-upgrade \
21 && apt-get --purge autoremove -y \21 && apt-get --purge autoremove -y \
22 && apt-get install -y apache2 curl libapache2-mod-php php php-gd php-mysql \22 && apt-get install -y apache2 curl libapache2-mod-php php php-curl php-gd php-gmp php-mysql \
23 php-symfony-yaml pwgen python3 python3-yaml ssl-cert \23 php-symfony-yaml php-xml pwgen python3 python3-yaml ssl-cert libgmp-dev \
24 && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \24 && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
25 && . "$APACHE_ENVVARS" \25 && . "$APACHE_ENVVARS" \
26 && for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR"; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 777 "$dir"; done \26 && for dir in "$APACHE_LOCK_DIR" "$APACHE_RUN_DIR" "$APACHE_LOG_DIR"; do rm -rvf "$dir"; mkdir -p "$dir"; chown "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; chmod 777 "$dir"; done \
@@ -33,7 +33,8 @@ RUN apt-get update && apt-get -y dist-upgrade \
33COPY ./files/docker-php.conf $APACHE_CONFDIR/conf-available/docker-php.conf33COPY ./files/docker-php.conf $APACHE_CONFDIR/conf-available/docker-php.conf
34RUN a2enconf docker-php \34RUN a2enconf docker-php \
35 && a2dismod mpm_event \35 && a2dismod mpm_event \
36 && a2enmod mpm_prefork36 && a2enmod mpm_prefork \
37 && a2enmod rewrite
3738
38# Install the main Wordpress code, this will be our only site so /var/www/html is fine39# Install the main Wordpress code, this will be our only site so /var/www/html is fine
39RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz" \40RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/latest.tar.gz" \
diff --git a/files/docker-php.conf b/files/docker-php.conf
index af22747..283d871 100644
--- a/files/docker-php.conf
+++ b/files/docker-php.conf
@@ -8,4 +8,10 @@ DirectoryIndex index.php index.html
8<Directory /var/www/>8<Directory /var/www/>
9 Options -Indexes9 Options -Indexes
10 AllowOverride All10 AllowOverride All
11 RewriteEngine On
12 RewriteBase /
13 RewriteRule ^index\.php$ - [L]
14 RewriteCond %{REQUEST_FILENAME} !-f
15 RewriteCond %{REQUEST_FILENAME} !-d
16 RewriteRule . /index.php [L]
11</Directory>17</Directory>
diff --git a/files/wp-config.php b/files/wp-config.php
index 7b9a387..158b0db 100644
--- a/files/wp-config.php
+++ b/files/wp-config.php
@@ -12,6 +12,20 @@
1212
13/* That's all, stop editing! Happy blogging. */13/* That's all, stop editing! Happy blogging. */
1414
15/** Enable container debug level logging. **/
16if ( getenv("WORDPRESS_DEBUG") ) {
17 define( 'WP_DEBUG', true );
18 define( 'WP_DEBUG_DISPLAY', false );
19 define( 'WP_DEBUG_LOG', '/dev/stderr' );
20}
21
22/** Fixes for mixed content when WordPress is behind nginx TLS reverse proxy.
23 * https://ahenriksson.com/2020/01/27/how-to-set-up-wordpress-behind-a-reverse-proxy-when-using-nginx/
24 * */
25define('FORCE_SSL_ADMIN', true);
26if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
27 $_SERVER['HTTPS']='on';
28
15/** Absolute path to the WordPress directory. */29/** Absolute path to the WordPress directory. */
16if ( !defined('ABSPATH') )30if ( !defined('ABSPATH') )
17 define('ABSPATH', dirname(__FILE__) . '/');31 define('ABSPATH', dirname(__FILE__) . '/');
@@ -32,8 +46,8 @@ define( 'WP_HTTP_BLOCK_EXTERNAL', true );
32define( 'AUTOMATIC_UPDATER_DISABLED', true );46define( 'AUTOMATIC_UPDATER_DISABLED', true );
33define( 'WP_AUTO_UPDATE_CORE', false );47define( 'WP_AUTO_UPDATE_CORE', false );
3448
35/** Enable container debug level logging. **/49$http_host = $_SERVER['HTTP_HOST'];
36if ( getenv("WORDPRESS_DEBUG") )50define('WP_HOME',"https://$http_host");
37 define( 'WP_DEBUG', true );51define('WP_SITEURL',"https://$http_host");
3852
39remove_filter('template_redirect', 'redirect_canonical');53remove_filter('template_redirect', 'redirect_canonical');

Subscribers

People subscribed via source and target branches