Skip to content

Commit

Permalink
Merge pull request #3 from 10up/wordpress
Browse files Browse the repository at this point in the history
in progress
  • Loading branch information
misterbisson committed Apr 7, 2016
2 parents 58627b8 + 4e8e85f commit 8c87bbd
Show file tree
Hide file tree
Showing 32 changed files with 558 additions and 344 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.DS_Store
manta.id_rsa
manta.id_rsa.pub
_env
79 changes: 43 additions & 36 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ RUN a2enmod rewrite

# install the PHP extensions we need, and other packages
RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y --no-install-recommends \
less \
libpng12-dev \
libjpeg-dev \
unzip \
curl \
nfs-common \
libmemcached-dev \
vim \
&& rm -rf /var/lib/apt/lists/* \
&& pecl install memcached \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd mysqli opcache
&& docker-php-ext-install gd mysqli opcache \
&& docker-php-ext-enable memcached

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
Expand All @@ -24,18 +30,20 @@ RUN { \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

COPY /bin/docker-entrypoint.sh /entrypoint.sh

# The Containerbuddy helper/glue scripts for this specific app
COPY containerbuddy /opt/containerbuddy
# The our helper/glue scripts and configuration for this specific app
COPY bin /usr/local/bin
COPY etc /etc

# Install Containerbuddy
# Releases at https://github.com/joyent/containerbuddy/releases
ENV CONTAINERBUDDY_VERSION 0.1.1
ENV CONTAINERBUDDY_SHA1 3163e89d4c95b464b174ba31733946ca247e068e
RUN curl --retry 7 -Lso /tmp/containerbuddy.tar.gz "https://github.com/joyent/containerbuddy/releases/download/${CONTAINERBUDDY_VERSION}/containerbuddy-${CONTAINERBUDDY_VERSION}.tar.gz" \
&& echo "${CONTAINERBUDDY_SHA1} /tmp/containerbuddy.tar.gz" | sha1sum -c \
&& tar zxf /tmp/containerbuddy.tar.gz -C /opt/containerbuddy \
# Add Containerbuddy and its configuration
ENV CONTAINERBUDDY_VER 1.3.0
ENV CONTAINERBUDDY file:///etc/containerbuddy.json

RUN export CONTAINERBUDDY_CHECKSUM=c25d3af30a822f7178b671007dcd013998d9fae1 \
&& curl -Lso /tmp/containerbuddy.tar.gz \
"https://github.com/joyent/containerbuddy/releases/download/${CONTAINERBUDDY_VER}/containerbuddy-${CONTAINERBUDDY_VER}.tar.gz" \
&& echo "${CONTAINERBUDDY_CHECKSUM} /tmp/containerbuddy.tar.gz" | sha1sum -c \
&& tar zxf /tmp/containerbuddy.tar.gz -C /usr/local/bin \
&& rm /tmp/containerbuddy.tar.gz

# Install Consul template
Expand All @@ -47,44 +55,43 @@ RUN curl --retry 7 -Lso /tmp/consul-template.zip "https://releases.hashicorp.com
&& unzip /tmp/consul-template.zip -d /usr/local/bin \
&& rm /tmp/consul-template.zip

# Make the WP uploads directory writeable by the web server
#RUN chown -R www-data:www-data /var/www/html/content/uploads

# install wp-cli, http://wp-cli.org
ENV WP_CLI_CONFIG_PATH /var/www/html/wp-cli.yml
RUN curl -Ls -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp \
&& wp --info --allow-root

# copy the WordPress skeleton from this repo into the container
# this includes any themes and/or plugins we've added to the content/themes and content/plugins, etc, directories.
COPY /var/www/html /var/www/html

# Make the WP uploads directory writeable by the web server
RUN chown -R www-data:www-data /var/www/html/content/uploads

# install WordPress
# Releases at https://wordpress.org/download/release-archive/
ENV WORDPRESS_VERSION 4.4.1
ENV WORDPRESS_SHA1 89bcc67a33aecb691e879c818d7e2299701f30e7
# upstream tarballs include ./wordpress/ so this gives us /var/www/html/wordpress
RUN curl -o wordpress.tar.gz -SL https://wordpress.org/wordpress-${WORDPRESS_VERSION}.tar.gz \
&& echo "${WORDPRESS_SHA1} *wordpress.tar.gz" | sha1sum -c - \
&& tar -xzf wordpress.tar.gz -C /var/www/html \
&& rm wordpress.tar.gz

ENV WORDPRESS_VERSION 4.4.2
# install WordPress via wp-cli & copy the default themes to our content dir
RUN wp --allow-root core download --version=${WORDPRESS_VERSION} \
&& cp -r /var/www/html/wordpress/wp-content/themes/* /var/www/html/content/themes/


# install HyperDB, https://wordpress.org/plugins/hyperdb
# Releases at https://wordpress.org/plugins/hyperdb/developers/ , though no SHA1 fingerprints are published
ENV HYPERDB_VERSION 1.1
RUN curl -Lo /var/www/html/hyperdb.zip https://downloads.wordpress.org/plugin/hyperdb.${HYPERDB_VERSION}.zip \
RUN curl -Ls -o /var/www/html/hyperdb.zip https://downloads.wordpress.org/plugin/hyperdb.${HYPERDB_VERSION}.zip \
&& unzip hyperdb.zip \
&& chown -R www-data:www-data /var/www/html/hyperdb \
&& mv hyperdb/db.php /var/www/html/content/. \
&& rm -rf /var/www/html/hyperdb.zip /var/www/html/hyperdb \
&& touch /var/www/html/wordpress/db-config.php \
&& ln -s /var/www/html/wordpress/db-config.php /var/www/html/.
&& touch /var/www/html/content/db-config.php

# install ztollman's object-cache.php or object caching to memcached
RUN curl -Ls -o /var/www/html/content/object-cache.php https://raw.githubusercontent.com/tollmanz/wordpress-pecl-memcached-object-cache/master/object-cache.php

# install wp-cli, http://wp-cli.org
ENV WP_CLI_CONFIG_PATH /var/www/html/wp-cli.yml
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& mv wp-cli.phar /usr/local/bin/wp \
&& wp --info --allow-root

# the volume is defined after we install everything
VOLUME /var/www/html

# grr, ENTRYPOINT resets CMD now
ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]
CMD ["/usr/local/bin/containerbuddy", \
"apache2-foreground"]
41 changes: 41 additions & 0 deletions _env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Environment variables for MySQL service
MYSQL_USER=wpuser
MYSQL_PASSWORD=userpassword
MYSQL_REPL_USER=repluser
MYSQL_REPL_PASSWORD=replpassword
MYSQL_DATABASE=test

# Environment variables for backups to Manta
MANTA_URL=
MANTA_USER=
MANTA_SUBUSER=
MANTA_ROLE=
MANTA_KEY_ID=
MANTA_PRIVATE_KEY=
MANTA_BUCKET=

WORDPRESS_VERSION=4.1
# please include the scheme http:// or https:// in the URL variable
WORDPRESS_URL=http://localhost
WORDPRESS_SITE_TITLE=test site
[email protected]
WORDPRESS_ADMIN_USER=username
WORDPRESS_ADMIN_PASSWORD=password
WORDPRESS_ACTIVE_THEME=theme
WORDPRESS_CACHE_KEY_SALT=some-unique-string
#WORDPRESS_TEST_DATA=False

# Wordpress unique salts - these must be unique for your install to ensure
# login security. visit the following link to generate a set for your site and
# include them here
# https://api.wordpress.org/secret-key/1.1/salt/
WORDPRESS_AUTH_KEY=
WORDPRESS_SECURE_AUTH_KEY=
WORDPRESS_LOGGED_IN_KEY=
WORDPRESS_NONCE_KEY=
WORDPRESS_AUTH_SALT=
WORDPRESS_SECURE_AUTH_SALT=
WORDPRESS_LOGGED_IN_SALT=
WORDPRESS_NONCE_SALT=

CONSUL=consul
164 changes: 0 additions & 164 deletions bin/docker-entrypoint.sh

This file was deleted.

5 changes: 5 additions & 0 deletions bin/health.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

/usr/local/bin/wp --allow-root core is-installed \
&& /usr/local/bin/wp --allow-root option get siteurl \
&& /usr/bin/curl --fail -s -o /dev/null http://localhost/
9 changes: 9 additions & 0 deletions bin/onchange-db.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

/usr/local/bin/onchange-wp-config.sh

consul-template \
-once \
-dedup \
-consul ${CONSUL}:8500 \
-template "/var/www/html/consul-templates/db-config.php.ctmpl:/var/www/html/content/db-config.php"
7 changes: 7 additions & 0 deletions bin/onchange-memcached.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

consul-template \
-once \
-dedup \
-consul ${CONSUL}:8500 \
-template "/var/www/html/consul-templates/memcached-config.php.ctmpl:/var/www/html/memcached-config.php"
Loading

0 comments on commit 8c87bbd

Please sign in to comment.