[Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:image-plugin-updates into charm-k8s-wordpress:master

2021-06-02 Thread Thomas Cuthbert
The proposal to merge ~tcuthbert/charm-k8s-wordpress:image-plugin-updates into 
charm-k8s-wordpress:master has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403555
-- 
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:image-plugin-updates into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread 烙 prod-jenkaas-is
Review: Approve continuous-integration

PASSED: Continuous integration, rev:6d8d586f69199802d0ca0bac1e6901e1ead565bb
https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/18/
Executed test runs:
SUCCESS: https://jenkins.canonical.com/is/job/lp-charm-test/125/
None: https://jenkins.canonical.com/is/job/lp-update-mp/197503/


Click here to trigger a rebuild:
https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/18//rebuild
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread 烙 prod-jenkaas-is
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:6d8d586f69199802d0ca0bac1e6901e1ead565bb

No commit message was specified in the merge proposal.  Click on the following 
link and set the commit message (if you want jenkins to rebuild you need to 
trigger it yourself):
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642/+edit-commit-message

https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/17/
Executed test runs:
SUCCESS: https://jenkins.canonical.com/is/job/lp-charm-test/124/
None: https://jenkins.canonical.com/is/job/lp-update-mp/197050/

Click here to trigger a rebuild:
https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/17//rebuild
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread 烙 prod-jenkaas-is
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:42d39bbdc5bb24119726a523262a1b81878a93c2

No commit message was specified in the merge proposal.  Click on the following 
link and set the commit message (if you want jenkins to rebuild you need to 
trigger it yourself):
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642/+edit-commit-message

https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/16/
Executed test runs:
FAILURE: https://jenkins.canonical.com/is/job/lp-charm-test/123/
None: https://jenkins.canonical.com/is/job/lp-update-mp/197044/

Click here to trigger a rebuild:
https://jenkins.canonical.com/is/job/lp-charm-k8s-wordpress-ci/16//rebuild
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread 烙 prod-jenkaas-is
A CI job is currently in progress. A follow up comment will be added when it 
completes.
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread Canonical IS Mergebot
This merge proposal is being monitored by mergebot. Change the status to 
Approved to merge.
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into charm-k8s-wordpress:master

2021-06-02 Thread Thomas Cuthbert
Thomas Cuthbert has proposed merging 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403642
-- 
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:xubuntu-container-fixes into 
charm-k8s-wordpress:master.
diff --git a/Dockerfile b/Dockerfile
index 21e3b76..5f50716 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,5 @@
 ARG DIST_RELEASE
-FROM ubuntu:${DIST_RELEASE}
-ARG DIST_RELEASE
-ARG VERSION
-
-LABEL maintainer="wordpress-charmers@lists.launchpad.net"
-# Used by Launchpad OCI Recipe to tag version
-LABEL org.label-schema.version=${VERSION:-5.6}
+FROM ubuntu:${DIST_RELEASE} as base
 
 # HTTPS_PROXY used when we RUN curl to download Wordpress itself
 ARG BUILD_DATE
@@ -42,6 +36,7 @@ RUN apt-get update && apt-get -y dist-upgrade \
 python3 \
 python3-yaml \
 ssl-cert \
+wget \
 && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
 && . "$APACHE_ENVVARS" \
 && 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 \
@@ -62,8 +57,23 @@ RUN a2enconf docker-php \
 && a2enmod rewrite \
 && a2enmod ssl
 
+
+FROM base as plugins
+
+# Download themes and plugins. This will eventually be separated into new container.
+COPY ./image-builder/src/fetcher.py /
+WORKDIR /var/www/html/wp-content/
+RUN mkdir themes plugins && /fetcher.py
+VOLUME /var/www/html/wp-content
+
+FROM base As install
+ARG VERSION
+
+# TODO: replace downloading the source wordpress code with copying it from the upstream wordpress container,
+# which should speed builds up:
+#   COPY --from=wordpress-${VERSION}:fpm /usr/src/wordpress /usr/src/wordpress
 # Install the main Wordpress code, this will be our only site so /var/www/html is fine
-RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${VERSION}.tar.gz; \
+RUN wget -O wordpress.tar.gz -t 3 -r "https://wordpress.org/wordpress-${VERSION}.tar.gz; \
 && tar -xzf wordpress.tar.gz -C /usr/src/ \
 && rm wordpress.tar.gz \
 && chown -R www-data:www-data /usr/src/wordpress \
@@ -71,17 +81,9 @@ RUN curl -o wordpress.tar.gz -fSL "https://wordpress.org/wordpress-${VERSION}.ta
 && mv /usr/src/wordpress /var/www/html
 
 COPY ./image-builder/files/ /files/
-COPY ./image-builder/src/fetcher.py .
-RUN mkdir -p /files/themes /files/plugins
-RUN ./fetcher.py
-# Copy our collected themes and plugins into the appropriate paths
-RUN cp -r /files/plugins/* /var/www/html/wp-content/plugins/
-RUN cp -r /files/themes/* /var/www/html/wp-content/themes/
-
 # wp-info.php contains template variables which our ENTRYPOINT script will populate
 RUN install -D /files/wp-info.php /var/www/html/wp-info.php
 RUN install -D /files/wp-config.php /var/www/html/wp-config.php
-RUN chown -R www-data:www-data /var/www/html
 
 # Copy our helper scripts and their wrapper into their own directory
 RUN install /files/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
@@ -97,10 +99,19 @@ RUN chmod 0755 /srv/wordpress-helpers/plugin_handler.py
 RUN chmod 0755 /srv/wordpress-helpers/ready.sh
 RUN chmod 0755 /usr/local/bin/docker-entrypoint.sh
 
-RUN rm -r /files
+FROM install as wordpress
+ARG VERSION
+
+LABEL maintainer="wordpress-charmers@lists.launchpad.net"
+# Used by Launchpad OCI Recipe to tag version
+LABEL org.label-schema.version=${VERSION:-5.7}
 
 # Port 80 only, TLS will terminate elsewhere
 EXPOSE 80
 
+# Copy plugins from the plugin stage into the WordPress content directory.
+COPY ./image-builder/src/fetcher.py /
+COPY --chown=www-data:www-data --from=plugins /var/www/html/wp-content/plugins/ /var/www/html/wp-content/plugins/
+COPY --chown=www-data:www-data --from=plugins /var/www/html/wp-content/themes/ /var/www/html/wp-content/themes/
 ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
 CMD apachectl -D FOREGROUND
diff --git a/image-builder/files/docker-entrypoint.sh b/image-builder/files/docker-entrypoint.sh
index 545d54e..42caf39 100644
--- a/image-builder/files/docker-entrypoint.sh
+++ b/image-builder/files/docker-entrypoint.sh
@@ -14,6 +14,15 @@ done
 # If we have passed in SWIFT_URL, then append swift proxy config.
 [ -z "${SWIFT_URL-}" ] || a2enconf docker-php-swift-proxy
 
+# TODO: this will eventually be called directly by the charm.
+(
+cd /tmp
+/fetcher.py
+find /tmp -type f \( -path '/tmp/plugins/*' -o -path '/tmp/themes/*' \) -printf "%p\0/var/www/html/wp-content/%P\0" |
+xargs -rn2 -0 install -DT && rm -fr /tmp/* &&
+rm -fr /tmp/*
+)
+
 nohup bash -c "/srv/wordpress-helpers/plugin_handler.py &"
 
 # Match against either php 7.2 (bionic) or 7.4 

Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:image-plugin-updates into charm-k8s-wordpress:master

2021-06-02 Thread 烙 prod-jenkaas-is
A CI job is currently in progress. A follow up comment will be added when it 
completes.
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/403555
Your team Wordpress Charmers is requested to review the proposed merge of 
~tcuthbert/charm-k8s-wordpress:image-plugin-updates into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp