Skip to content

Commit 0c96844

Browse files
authored
Merge pull request #45 from autopilotpattern/wp473
Update to WordPress 4.7.3
2 parents ea60ea6 + 9455b4e commit 0c96844

File tree

7 files changed

+45
-31
lines changed

7 files changed

+45
-31
lines changed

Dockerfile

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ FROM php:5.6-apache
33
RUN a2enmod rewrite
44

55
# Install the PHP extensions we need, and other packages
6-
RUN apt-get update \
6+
RUN set -ex \
7+
&& apt-get update \
78
&& apt-get install -y --no-install-recommends \
89
curl \
910
jq \
@@ -14,14 +15,15 @@ RUN apt-get update \
1415
nfs-common \
1516
unzip \
1617
&& rm -rf /var/lib/apt/lists/* \
17-
&& pecl install memcached \
18+
# Memcached 2.2.0 is the latest for PHP < 7
19+
# see https://pecl.php.net/package/memcached
20+
&& pecl install memcached-2.2.0 \
1821
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
1922
&& docker-php-ext-install gd mysqli opcache \
20-
&& docker-php-ext-enable memcached
21-
22-
# Set recommended PHP.ini settings
23-
# See https://secure.php.net/manual/en/opcache.installation.php
24-
RUN { \
23+
&& docker-php-ext-enable memcached \
24+
# Set recommended PHP.ini settings
25+
# See https://secure.php.net/manual/en/opcache.installation.php
26+
&& { \
2527
echo 'opcache.memory_consumption=128'; \
2628
echo 'opcache.interned_strings_buffer=8'; \
2729
echo 'opcache.max_accelerated_files=4000'; \
@@ -36,10 +38,11 @@ COPY etc /etc
3638

3739
# Add Containerpilot and its configuration
3840
# Releases at https://github.com/joyent/containerpilot/releases
39-
ENV CONTAINERPILOT_VER 2.3.0
41+
ENV CONTAINERPILOT_VER 2.7.2
4042
ENV CONTAINERPILOT file:///etc/containerpilot.json
4143

42-
RUN export CONTAINERPILOT_CHECKSUM=ec9dbedaca9f4a7a50762f50768cbc42879c7208 \
44+
RUN set -ex \
45+
&& export CONTAINERPILOT_CHECKSUM=e886899467ced6d7c76027d58c7f7554c2fb2bcc \
4346
&& curl --retry 7 --fail -Lso /tmp/containerpilot.tar.gz \
4447
"https://github.com/joyent/containerpilot/releases/download/${CONTAINERPILOT_VER}/containerpilot-${CONTAINERPILOT_VER}.tar.gz" \
4548
&& echo "${CONTAINERPILOT_CHECKSUM} /tmp/containerpilot.tar.gz" | sha1sum -c \
@@ -48,8 +51,9 @@ RUN export CONTAINERPILOT_CHECKSUM=ec9dbedaca9f4a7a50762f50768cbc42879c7208 \
4851

4952
# Install Consul
5053
# Releases at https://releases.hashicorp.com/consul
51-
RUN export CONSUL_VERSION=0.6.4 \
52-
&& export CONSUL_CHECKSUM=abdf0e1856292468e2c9971420d73b805e93888e006c76324ae39416edcf0627 \
54+
RUN set -ex \
55+
&& export CONSUL_VERSION=0.7.5 \
56+
&& export CONSUL_CHECKSUM=40ce7175535551882ecdff21fdd276cef6eaab96be8a8260e0599fadb6f1f5b8 \
5357
&& curl --retry 7 --fail -vo /tmp/consul.zip "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip" \
5458
&& echo "${CONSUL_CHECKSUM} /tmp/consul.zip" | sha256sum -c \
5559
&& unzip /tmp/consul -d /usr/local/bin \
@@ -58,16 +62,18 @@ RUN export CONSUL_VERSION=0.6.4 \
5862

5963
# Install Consul template
6064
# Releases at https://releases.hashicorp.com/consul-template/
61-
RUN export CONSUL_TEMPLATE_VERSION=0.14.0 \
62-
&& export CONSUL_TEMPLATE_CHECKSUM=7c70ea5f230a70c809333e75fdcff2f6f1e838f29cfb872e1420a63cdf7f3a78 \
65+
RUN set -ex \
66+
&& export CONSUL_TEMPLATE_VERSION=0.18.2 \
67+
&& export CONSUL_TEMPLATE_CHECKSUM=6fee6ab68108298b5c10e01357ea2a8e4821302df1ff9dd70dd9896b5c37217c \
6368
&& curl --retry 7 --fail -Lso /tmp/consul-template.zip "https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip" \
6469
&& echo "${CONSUL_TEMPLATE_CHECKSUM} /tmp/consul-template.zip" | sha256sum -c \
6570
&& unzip /tmp/consul-template.zip -d /usr/local/bin \
6671
&& rm /tmp/consul-template.zip
6772

6873
# Install wp-cli, http://wp-cli.org
6974
ENV WP_CLI_CONFIG_PATH /var/www/html/wp-cli.yml
70-
RUN curl --retry 7 --fail -Ls -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
75+
RUN set -ex \
76+
&& curl --retry 7 --fail -Ls -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
7177
&& chmod +x wp-cli.phar \
7278
&& mv wp-cli.phar /usr/local/bin/wp \
7379
&& wp --info --allow-root
@@ -78,13 +84,15 @@ COPY /var/www/html /var/www/html
7884
RUN chown -R www-data:www-data /var/www/html/*
7985

8086
# Install WordPress via wp-cli & move the default themes to our content dir
81-
ENV WORDPRESS_VERSION 4.5.3
82-
RUN wp --allow-root core download --version=${WORDPRESS_VERSION} \
87+
ENV WORDPRESS_VERSION 4.7.3
88+
RUN set -ex \
89+
&& wp --allow-root core download --version=${WORDPRESS_VERSION} \
8390
&& mv /var/www/html/wordpress/wp-content/themes/* /var/www/html/content/themes/
8491

8592
# Install HyperDB, https://wordpress.org/plugins/hyperdb
8693
# Releases at https://wordpress.org/plugins/hyperdb/developers/ , though no SHA1 fingerprints are published
87-
RUN export HYPERDB_VERSION=1.1 \
94+
RUN set -ex \
95+
&& export HYPERDB_VERSION=1.1 \
8896
&& curl --retry 7 --fail -Ls -o /var/www/html/hyperdb.zip https://downloads.wordpress.org/plugin/hyperdb.${HYPERDB_VERSION}.zip \
8997
&& unzip hyperdb.zip \
9098
&& chown -R www-data:www-data /var/www/html/hyperdb \
@@ -93,7 +101,8 @@ RUN export HYPERDB_VERSION=1.1 \
93101
&& touch /var/www/html/content/db-config.php
94102

95103
# Install ztollman's object-cache.php or object caching to memcached
96-
RUN curl --retry 7 --fail -Ls -o /var/www/html/content/object-cache.php https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/master/object-cache.php
104+
RUN set -ex \
105+
&& curl --retry 7 --fail -Ls -o /var/www/html/content/object-cache.php https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/master/object-cache.php
97106

98107
# The volume is defined after we install everything
99108
VOLUME /var/www/html

bin/onchange-db.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
consul-template \
66
-once \
77
-dedup \
8-
-consul ${CONSUL}:8500 \
8+
-consul-addr ${CONSUL}:8500 \
99
-template "/var/www/html/db-config.php.ctmpl:/var/www/html/content/db-config.php"

bin/onchange-memcached.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
consul-template \
44
-once \
55
-dedup \
6-
-consul ${CONSUL}:8500 \
6+
-consul-addr ${CONSUL}:8500 \
77
-template "/var/www/html/memcached-config.php.ctmpl:/var/www/html/memcached-config.php"

bin/onchange-wp-config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
consul-template \
44
-once \
55
-dedup \
6-
-consul ${CONSUL}:8500 \
6+
-consul-addr ${CONSUL}:8500 \
77
-template "/var/www/html/wp-config.php.ctmpl:/var/www/html/wp-config.php"

docker-compose.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# An demo version of WordPress for easy scaling
22
wordpress:
3-
image: autopilotpattern/wordpress:latest
3+
image: autopilotpattern/wordpress:4.7.3-r4.0.0
44
restart: always
55
env_file: _env
66
environment:
@@ -10,7 +10,7 @@ wordpress:
1010
- 9090
1111
labels:
1212
# Setting the CNS service name
13-
- triton.cns.services=wordpress
13+
- triton.cns.services=wp-wordpress
1414
# Soft anti-affinity to avoid other WordPress instances
1515
- com.docker.swarm.affinities=["container!=~*wordpress*"]
1616
# Set the package
@@ -34,7 +34,7 @@ consul:
3434
dns:
3535
- 127.0.0.1
3636
labels:
37-
- triton.cns.services=consul
37+
- triton.cns.services=wp-consul
3838
# Soft anti-affinity to avoid all other containers
3939
- com.docker.swarm.affinities=["container!=~*"]
4040
- com.joyent.package=g4-highcpu-128M
@@ -51,7 +51,7 @@ nfs:
5151
- 1892
5252
- 2049
5353
labels:
54-
- triton.cns.services=nfs
54+
- triton.cns.services=wp-nfs
5555
- com.docker.swarm.affinities=["container!=~*"]
5656
- com.joyent.package=g4-highcpu-256M
5757

@@ -66,7 +66,7 @@ mysql:
6666
expose:
6767
- 3306
6868
labels:
69-
- triton.cns.services=mysql
69+
- triton.cns.services=wp-mysql
7070
- com.docker.swarm.affinities=["container!=~*mysql*"]
7171
- com.joyent.package=g4-highcpu-4G
7272

@@ -80,13 +80,13 @@ memcached:
8080
ports:
8181
- 11211
8282
labels:
83-
- triton.cns.services=memcached
83+
- triton.cns.services=wp-memcached
8484
- com.docker.swarm.affinities=["container!=~*memcached*"]
8585
- com.joyent.package=g4-highcpu-512M
8686

8787
# Nginx as a load-balancing tier and reverse proxy
8888
nginx:
89-
image: autopilotpattern/wordpress-nginx:latest
89+
image: autopilotpattern/wordpress-nginx:4.7.3-r4.0.0
9090
restart: always
9191
ports:
9292
- 80
@@ -96,7 +96,7 @@ nginx:
9696
environment:
9797
- CONSUL_AGENT=1
9898
labels:
99-
- triton.cns.services=nginx
99+
- triton.cns.services=wp-nginx,nginx
100100
- com.docker.swarm.affinities=["container!=~*nginx*"]
101101
- com.joyent.package=g4-highcpu-512M
102102

@@ -109,6 +109,6 @@ prometheus:
109109
ports:
110110
- 9090
111111
labels:
112-
- triton.cns.services=prometheus
112+
- triton.cns.services=wp-prometheus
113113
- com.docker.swarm.affinities=["container!=~*prometheus*"]
114114
- com.joyent.package=g4-highcpu-1G

etc/containerpilot.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
"poll": 7,
1717
"onChange": "/usr/local/bin/onchange-db.sh"
1818
},
19+
{
20+
"name": "mysql-primary",
21+
"poll": 7,
22+
"onChange": "/usr/local/bin/onchange-db.sh"
23+
},
1924
{
2025
"name": "nfs",
2126
"poll": 11,

setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ envcheck() {
196196
echo >> _env
197197

198198
echo '# Consul discovery via Triton CNS' >> _env
199-
echo CONSUL=consul.svc.${TRITON_ACCOUNT}.${TRITON_DC}.cns.joyent.com >> _env
199+
echo CONSUL=wp-consul.svc.${TRITON_ACCOUNT}.${TRITON_DC}.cns.joyent.com >> _env
200200
echo >> _env
201201

202202
echo 'Edit the _env file to confirm and set your desired configuration details'

0 commit comments

Comments
 (0)