<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[8809] sites/trunk/wordcamp.org: WordCamp: Add docker setup to ease development flow</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/8809">8809</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/8809","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>vedjain</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-05-20 11:51:19 +0000 (Mon, 20 May 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>WordCamp: Add docker setup to ease development flow

This is adds initial docker configuration for running WordCamp meta environment. Right now expectation is to have a MySQL running on host and configured in wp-config. Eventually MySQL will be added as part of docker configuration.</pre>

<h3>Added Paths</h3>
<ul>
<li><a href="#sitestrunkwordcamporgDockerfile">sites/trunk/wordcamp.org/Dockerfile</a></li>
<li><a href="#sitestrunkwordcamporgdockercomposeyml">sites/trunk/wordcamp.org/docker-compose.yml</a></li>
<li><a href="#sitestrunkwordcamporgnginxconf">sites/trunk/wordcamp.org/nginx.conf</a></li>
<li><a href="#sitestrunkwordcamporgphpfpmconf">sites/trunk/wordcamp.org/php-fpm.conf</a></li>
<li><a href="#sitestrunkwordcamporgwordcampsslconf">sites/trunk/wordcamp.org/wordcamp.ssl.conf</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordcamporgDockerfile"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/Dockerfile</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/Dockerfile                               (rev 0)
+++ sites/trunk/wordcamp.org/Dockerfile 2019-05-20 11:51:19 UTC (rev 8809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,48 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+FROM wordpress:5.0.3-fpm
+
+RUN mv /usr/src/wordpress /usr/src/public_html
+WORKDIR /usr/src/public_html
+
+RUN apt-get update
+RUN apt-get install nginx -y
+
+COPY nginx.conf /etc/nginx/sites-enabled/wordcamp.conf
+COPY wordcamp.ssl.conf /var/wordcamp.ssl.conf
+
+RUN cd ~ && openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout wordcamp.key -out wordcamp.crt -config /var/wordcamp.ssl.conf
+RUN cp ~/wordcamp.crt /etc/ssl/certs/wordcamp.crt
+RUN cp ~/wordcamp.key /etc/ssl/private/wordcamp.key
+
+# Install wkhtmltopdf for camptix invoices. See https://stackoverflow.com/a/38336153/1845153
+RUN curl -L https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz > wkhtmltox.tar.xz
+RUN tar xvf wkhtmltox.tar.xz
+RUN mv wkhtmltox/bin/wkhtmlto* /usr/bin/
+
+# Install cli
+RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
+RUN chmod +x wp-cli.phar
+RUN mv wp-cli.phar /usr/local/bin/wp
+
+# Mail catcher.
+RUN apt-get install build-essential libsqlite3-dev ruby-dev -y
+RUN gem install mailcatcher --no-ri --no-rdoc
+RUN apt-get install ssmtp -y
+RUN sed -i -e "s|;sendmail_path =|sendmail_path = /usr/sbin/ssmtp -t |" /usr/local/etc/php/php.ini-development
+RUN sed -i -e "s/smtp_port = 25/smtp_port = 1025/" /usr/local/etc/php/php.ini-development
+RUN chown root:mail /etc/ssmtp/ssmtp.conf
+RUN sed -i -e "s/#FromLineOverride=YES/FromLineOverride=YES/" /etc/ssmtp/ssmtp.conf
+RUN sed -i -e "s/mailhub=mail/mailhub=127.0.0.1:1025/" /etc/ssmtp/ssmtp.conf
+RUN cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
+
+# utils
+RUN apt-get install vim -y
+
+COPY php-fpm.conf /usr/local/etc/php-fpm.d/zz-www.conf
+
+# Setup Gutenberg blocks
+RUN apt-get install -y gnupg2 && curl -sL https://deb.nodesource.com/setup_11.x | bash -
+RUN apt-get install -y nodejs
+RUN npm --prefix ./wp-content/mu-plugins/blocks install ./wp-content/mu-plugins/blocks
+
+CMD tail -f /dev/null
+
</ins></span></pre></div>
<a id="sitestrunkwordcamporgdockercomposeyml"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/docker-compose.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/docker-compose.yml                               (rev 0)
+++ sites/trunk/wordcamp.org/docker-compose.yml 2019-05-20 11:51:19 UTC (rev 8809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,13 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+version: "3.2"
+services:
+  wordcamp.test:
+    build:
+      context: .
+      dockerfile: Dockerfile
+    volumes:
+      - "./public_html:/usr/src/public_html"
+    ports:
+      - "1234:80"
+      - "443:443"
+      - "1080:1080"
+    command: bash -c "nginx && mailcatcher --http-ip 0.0.0.0 && php-fpm"
</ins></span></pre></div>
<a id="sitestrunkwordcamporgnginxconf"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/nginx.conf</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/nginx.conf                               (rev 0)
+++ sites/trunk/wordcamp.org/nginx.conf 2019-05-20 11:51:19 UTC (rev 8809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,51 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+# Upstream to abstract backend connection(s) for php
+upstream php {
+        server unix:/tmp/php-cgi.socket;
+        server 127.0.0.1:9000;
+}
+
+server {
+    listen 80;
+    listen [::]:80;
+    server_name wordcamp.test;
+    return 301 https://wordcamp.test$request_uri;
+}
+
+server {
+        listen 443 ssl http2;
+        listen [::]:443 ssl http2;
+
+        server_name wordcamp.test;
+        ssl_certificate /etc/ssl/certs/wordcamp.crt;
+        ssl_certificate_key /etc/ssl/private/wordcamp.key;
+        ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
+
+        root /usr/src/public_html;
+        index index.php;
+
+        location = /favicon.ico {
+                log_not_found off;
+                access_log off;
+        }
+
+        location = /robots.txt {
+                allow all;
+                log_not_found off;
+                access_log off;
+        }
+
+        location / {
+                try_files $uri $uri/ /index.php?$args;
+        }
+
+        location ~ \.php$ {
+                include fastcgi.conf;
+                fastcgi_intercept_errors on;
+                fastcgi_pass php;
+        }
+
+        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
+                expires max;
+                log_not_found off;
+        }
+}
</ins></span></pre></div>
<a id="sitestrunkwordcamporgphpfpmconf"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/php-fpm.conf</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/php-fpm.conf                             (rev 0)
+++ sites/trunk/wordcamp.org/php-fpm.conf       2019-05-20 11:51:19 UTC (rev 8809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,6 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[global]
+
+[www]
+php_flag[display_errors] = on
+php_admin_value[error_log] = /var/log/fpm-php.www.log
+php_admin_flag[log_errors] = on
</ins></span></pre></div>
<a id="sitestrunkwordcamporgwordcampsslconf"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: sites/trunk/wordcamp.org/wordcamp.ssl.conf</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordcamp.org/wordcamp.ssl.conf                                (rev 0)
+++ sites/trunk/wordcamp.org/wordcamp.ssl.conf  2019-05-20 11:51:19 UTC (rev 8809)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,28 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+[ req ]
+default_bits = 2048
+prompt = no
+default_md = sha256
+req_extensions = req_ext
+distinguished_name = dn
+default_keyfile    = wordcamp.key
+
+[ dn ]
+C = IN
+ST = STATE
+L = Location
+O = WordCamp
+OU = WordCampDev
+CN = wordcamp
+
+[ req_ext ]
+subjectAltName = @alt_names
+
+[ alt_names ]
+DNS.1 = wordcamp.docker
+
+[ v3_ext ]
+authorityKeyIdentifier=keyid,issuer:always
+basicConstraints=CA:FALSE
+keyUsage=keyEncipherment,dataEncipherment
+extendedKeyUsage=serverAuth,clientAuth
+subjectAltName=@alt_names%
</ins></span></pre>
</div>
</div>

</body>
</html>