From 3c916c7f74fcdd4ae628c118eba0fdc68cb09f59 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 19 Mar 2018 10:20:18 -0700 Subject: [PATCH 01/29] Bump PHP tools versions Composer v1.6.3 Drush v8.1.16 Drupal Console Launcher v1.7.0 WP CLI v1.3.0 Magento2 Code Generator v1.10 Blackfire CLI v1.15.0 --- 5.6/Dockerfile | 12 ++++++------ 7.0/Dockerfile | 12 ++++++------ 7.1/Dockerfile | 12 ++++++------ 7.2/Dockerfile | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 3cc07637..834e5129 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -202,12 +202,12 @@ RUN set -xe; \ # Copy mhsendmail binary from stage 1 COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail -ENV COMPOSER_VERSION=1.5.2 \ - DRUSH_VERSION=8.1.13 \ - DRUPAL_CONSOLE_VERSION=1.0.2 \ - WPCLI_VERSION=1.3.0 \ - MG_CODEGEN_VERSION=1.6.4 \ - BLACKFIRE_VERSION=1.14.1 +ENV COMPOSER_VERSION=1.6.3 \ + DRUSH_VERSION=8.1.16 \ + DRUPAL_CONSOLE_VERSION=1.7.0 \ + WPCLI_VERSION=1.5.0 \ + MG_CODEGEN_VERSION=1.10 \ + BLACKFIRE_VERSION=1.15.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 619cce65..aea45965 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -205,12 +205,12 @@ RUN set -xe; \ # Copy mhsendmail binary from stage 1 COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail -ENV COMPOSER_VERSION=1.5.2 \ - DRUSH_VERSION=8.1.13 \ - DRUPAL_CONSOLE_VERSION=1.0.2 \ - WPCLI_VERSION=1.3.0 \ - MG_CODEGEN_VERSION=1.6.4 \ - BLACKFIRE_VERSION=1.14.1 +ENV COMPOSER_VERSION=1.6.3 \ + DRUSH_VERSION=8.1.16 \ + DRUPAL_CONSOLE_VERSION=1.7.0 \ + WPCLI_VERSION=1.5.0 \ + MG_CODEGEN_VERSION=1.10 \ + BLACKFIRE_VERSION=1.15.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index cb223391..b849734a 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -205,12 +205,12 @@ RUN set -xe; \ # Copy mhsendmail binary from stage 1 COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail -ENV COMPOSER_VERSION=1.5.2 \ - DRUSH_VERSION=8.1.13 \ - DRUPAL_CONSOLE_VERSION=1.0.2 \ - WPCLI_VERSION=1.3.0 \ - MG_CODEGEN_VERSION=1.6.4 \ - BLACKFIRE_VERSION=1.14.1 +ENV COMPOSER_VERSION=1.6.3 \ + DRUSH_VERSION=8.1.16 \ + DRUPAL_CONSOLE_VERSION=1.7.0 \ + WPCLI_VERSION=1.5.0 \ + MG_CODEGEN_VERSION=1.10 \ + BLACKFIRE_VERSION=1.15.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 1487c55d..39f1a726 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -208,12 +208,12 @@ RUN set -xe; \ # Copy mhsendmail binary from stage 1 COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail -ENV COMPOSER_VERSION=1.5.2 \ - DRUSH_VERSION=8.1.13 \ - DRUPAL_CONSOLE_VERSION=1.0.2 \ - WPCLI_VERSION=1.3.0 \ - MG_CODEGEN_VERSION=1.6.4 \ - BLACKFIRE_VERSION=1.14.1 +ENV COMPOSER_VERSION=1.6.3 \ + DRUSH_VERSION=8.1.16 \ + DRUPAL_CONSOLE_VERSION=1.7.0 \ + WPCLI_VERSION=1.5.0 \ + MG_CODEGEN_VERSION=1.10 \ + BLACKFIRE_VERSION=1.15.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ From c81eea5836d415d949745050043f25fc96035bd2 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 19 Mar 2018 10:20:52 -0700 Subject: [PATCH 02/29] Bump nodejs to the latest LTS release v8.10.0 --- 5.6/Dockerfile | 4 ++-- 7.0/Dockerfile | 4 ++-- 7.1/Dockerfile | 4 ++-- 7.2/Dockerfile | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 834e5129..c943e90d 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -243,8 +243,8 @@ USER docker ENV HOME /home/docker # Install nvm and a default node version -ENV NVM_VERSION=0.33.4 \ - NODE_VERSION=6.11.3 \ +ENV NVM_VERSION=0.33.8 \ + NODE_VERSION=8.10.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index aea45965..79d8179e 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -246,8 +246,8 @@ USER docker ENV HOME /home/docker # Install nvm and a default node version -ENV NVM_VERSION=0.33.4 \ - NODE_VERSION=6.11.3 \ +ENV NVM_VERSION=0.33.8 \ + NODE_VERSION=8.10.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index b849734a..34506717 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -246,8 +246,8 @@ USER docker ENV HOME /home/docker # Install nvm and a default node version -ENV NVM_VERSION=0.33.4 \ - NODE_VERSION=6.11.3 \ +ENV NVM_VERSION=0.33.8 \ + NODE_VERSION=8.10.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 39f1a726..656cc64a 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -249,8 +249,8 @@ USER docker ENV HOME /home/docker # Install nvm and a default node version -ENV NVM_VERSION=0.33.4 \ - NODE_VERSION=6.11.3 \ +ENV NVM_VERSION=0.33.8 \ + NODE_VERSION=8.10.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ From 3d23d5195ff6d94b518f8fdbf02c5b26ebb267bf Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 14:35:32 -0700 Subject: [PATCH 03/29] Removed archaic/not used PHP extensions --- 5.6/Dockerfile | 11 ++--------- 5.6/php-modules.txt | 6 ------ 7.0/Dockerfile | 10 ++-------- 7.0/php-modules.txt | 6 ------ 7.1/Dockerfile | 10 ++-------- 7.1/php-modules.txt | 6 ------ 7.2/Dockerfile | 11 ++--------- 7.2/php-modules.txt | 6 ------ 8 files changed, 8 insertions(+), 58 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c943e90d..310d5c2f 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -144,7 +144,6 @@ RUN set -xe; \ libxslt1.1 \ zlib1g \ ;\ - docker-php-ext-configure >/dev/null hash --with-mhash; \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ \ @@ -152,25 +151,19 @@ RUN set -xe; \ bcmath \ bz2 \ calendar\ - dba \ exif \ gd \ gettext \ intl \ ldap \ mcrypt \ - opcache \ - pcntl \ mysql \ mysqli \ + opcache \ + pcntl \ pdo_mysql \ - shmop \ soap \ sockets \ - sysvmsg \ - sysvsem \ - sysvshm \ - wddx \ xsl \ zip \ ;\ diff --git a/5.6/php-modules.txt b/5.6/php-modules.txt index 76b67407..2b0a54ac 100644 --- a/5.6/php-modules.txt +++ b/5.6/php-modules.txt @@ -7,7 +7,6 @@ Core ctype curl date -dba dom ereg exif @@ -42,7 +41,6 @@ readline redis Reflection session -shmop SimpleXML soap sockets @@ -50,11 +48,7 @@ SPL sqlite3 ssh2 standard -sysvmsg -sysvsem -sysvshm tokenizer -wddx xml xmlreader xmlwriter diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 79d8179e..9616b63c 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -149,7 +149,6 @@ RUN set -xe; \ # SSH2 must be installed from source git clone https://github.com/php/pecl-networking-ssh2.git /usr/src/php/ext/ssh2 && rm -rf /usr/src/php/ext/ssh2/.git; \ \ - docker-php-ext-configure >/dev/null hash --with-mhash; \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ \ @@ -157,25 +156,20 @@ RUN set -xe; \ bcmath \ bz2 \ calendar\ - dba \ exif \ gd \ gettext \ intl \ ldap \ mcrypt \ + mysql \ + mysqli \ opcache \ pcntl \ - mysqli \ pdo_mysql \ - shmop \ soap \ sockets \ ssh2 \ - sysvmsg \ - sysvsem \ - sysvshm \ - wddx \ xsl \ zip \ ;\ diff --git a/7.0/php-modules.txt b/7.0/php-modules.txt index 62cedb07..e498c885 100644 --- a/7.0/php-modules.txt +++ b/7.0/php-modules.txt @@ -7,7 +7,6 @@ Core ctype curl date -dba dom exif fileinfo @@ -40,7 +39,6 @@ readline redis Reflection session -shmop SimpleXML soap sockets @@ -48,11 +46,7 @@ SPL sqlite3 ssh2 standard -sysvmsg -sysvsem -sysvshm tokenizer -wddx xml xmlreader xmlwriter diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 34506717..21430584 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -149,7 +149,6 @@ RUN set -xe; \ # SSH2 must be installed from source git clone https://github.com/php/pecl-networking-ssh2.git /usr/src/php/ext/ssh2 && rm -rf /usr/src/php/ext/ssh2/.git; \ \ - docker-php-ext-configure >/dev/null hash --with-mhash; \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ \ @@ -157,25 +156,20 @@ RUN set -xe; \ bcmath \ bz2 \ calendar\ - dba \ exif \ gd \ gettext \ intl \ ldap \ mcrypt \ + mysql \ + mysqli \ opcache \ pcntl \ - mysqli \ pdo_mysql \ - shmop \ soap \ sockets \ ssh2 \ - sysvmsg \ - sysvsem \ - sysvshm \ - wddx \ xsl \ zip \ ;\ diff --git a/7.1/php-modules.txt b/7.1/php-modules.txt index 62cedb07..e498c885 100644 --- a/7.1/php-modules.txt +++ b/7.1/php-modules.txt @@ -7,7 +7,6 @@ Core ctype curl date -dba dom exif fileinfo @@ -40,7 +39,6 @@ readline redis Reflection session -shmop SimpleXML soap sockets @@ -48,11 +46,7 @@ SPL sqlite3 ssh2 standard -sysvmsg -sysvsem -sysvshm tokenizer -wddx xml xmlreader xmlwriter diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 656cc64a..1d2d1856 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -152,7 +152,6 @@ RUN set -xe; \ # XDEBUG must be installed from source git clone https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug && rm -rf /usr/src/php/ext/xdebug/.git; \ \ - docker-php-ext-configure >/dev/null hash --with-mhash; \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ \ @@ -160,26 +159,20 @@ RUN set -xe; \ bcmath \ bz2 \ calendar\ - dba \ exif \ gd \ gettext \ intl \ ldap \ # mcrypt is removed from 7.2. See Deprecated features + mysql \ + mysqli \ opcache \ pcntl \ - mysqli \ pdo_mysql \ - shmop \ soap \ sockets \ ssh2 \ - sysvmsg \ - sysvsem \ - sysvshm \ - wddx \ - xdebug \ xsl \ zip \ ;\ diff --git a/7.2/php-modules.txt b/7.2/php-modules.txt index d59c2ced..398badaa 100644 --- a/7.2/php-modules.txt +++ b/7.2/php-modules.txt @@ -7,7 +7,6 @@ Core ctype curl date -dba dom exif fileinfo @@ -39,7 +38,6 @@ readline redis Reflection session -shmop SimpleXML soap sockets @@ -48,11 +46,7 @@ SPL sqlite3 ssh2 standard -sysvmsg -sysvsem -sysvshm tokenizer -wddx xml xmlreader xmlwriter From 0c71e851e3da86dd92bde3543773ae208130f738 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 14:53:06 -0700 Subject: [PATCH 04/29] Remove mysql extension Is has been deprecated for years and removed in PHP 7.0+ mysqli can be used instead. --- 5.6/Dockerfile | 1 - 5.6/php-modules.txt | 1 - 7.0/Dockerfile | 1 - 7.1/Dockerfile | 1 - 7.2/Dockerfile | 1 - 5 files changed, 5 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 310d5c2f..cd5589a8 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -157,7 +157,6 @@ RUN set -xe; \ intl \ ldap \ mcrypt \ - mysql \ mysqli \ opcache \ pcntl \ diff --git a/5.6/php-modules.txt b/5.6/php-modules.txt index 2b0a54ac..ed30bc81 100644 --- a/5.6/php-modules.txt +++ b/5.6/php-modules.txt @@ -26,7 +26,6 @@ libxml mbstring mcrypt memcache -mysql mysqli mysqlnd openssl diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 9616b63c..3181f4e1 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -162,7 +162,6 @@ RUN set -xe; \ intl \ ldap \ mcrypt \ - mysql \ mysqli \ opcache \ pcntl \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 21430584..6e615800 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -162,7 +162,6 @@ RUN set -xe; \ intl \ ldap \ mcrypt \ - mysql \ mysqli \ opcache \ pcntl \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 1d2d1856..11ca881e 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -165,7 +165,6 @@ RUN set -xe; \ intl \ ldap \ # mcrypt is removed from 7.2. See Deprecated features - mysql \ mysqli \ opcache \ pcntl \ From edde640776519716a0d4ae2fd55e36f67e9d2a16 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 15:10:09 -0700 Subject: [PATCH 05/29] Put xdebug back for 7.2 Removed by mistake in 3d23d5195ff6d94b518f8fdbf02c5b26ebb267bf --- 7.2/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 11ca881e..0566708b 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -172,6 +172,7 @@ RUN set -xe; \ soap \ sockets \ ssh2 \ + xdebug \ xsl \ zip \ ;\ From e0e311b9d37bf5d6bb9aae9df871f863bdd6fac2 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 15:11:47 -0700 Subject: [PATCH 06/29] Added pgsql PHP extension (#31) --- 5.6/Dockerfile | 5 +++++ 5.6/php-modules.txt | 2 ++ 7.0/Dockerfile | 5 +++++ 7.0/php-modules.txt | 2 ++ 7.1/Dockerfile | 5 +++++ 7.1/php-modules.txt | 2 ++ 7.2/Dockerfile | 5 +++++ 7.2/php-modules.txt | 2 ++ 8 files changed, 28 insertions(+) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index cd5589a8..59aeed9e 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -123,6 +123,7 @@ RUN set -xe; \ libmemcached-dev \ libmhash-dev \ libpng12-dev \ + libpq-dev \ libssh2-1-dev \ libxslt1-dev \ zlib1g-dev \ @@ -140,12 +141,14 @@ RUN set -xe; \ libmcrypt4 \ libmhash2 \ libpng12-0 \ + libpq5 \ libssh2-1 \ libxslt1.1 \ zlib1g \ ;\ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ + docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ docker-php-ext-install >/dev/null -j$(nproc) \ bcmath \ @@ -161,6 +164,8 @@ RUN set -xe; \ opcache \ pcntl \ pdo_mysql \ + pdo_pgsql \ + pgsql \ soap \ sockets \ xsl \ diff --git a/5.6/php-modules.txt b/5.6/php-modules.txt index ed30bc81..59e3d4d6 100644 --- a/5.6/php-modules.txt +++ b/5.6/php-modules.txt @@ -33,7 +33,9 @@ pcntl pcre PDO pdo_mysql +pdo_pgsql pdo_sqlite +pgsql Phar posix readline diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 3181f4e1..90f37f99 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -123,6 +123,7 @@ RUN set -xe; \ libmemcached-dev \ libmhash-dev \ libpng12-dev \ + libpq-dev \ libssh2-1-dev \ libxslt1-dev \ zlib1g-dev \ @@ -142,6 +143,7 @@ RUN set -xe; \ libmemcachedutil2 \ libmhash2 \ libpng12-0 \ + libpq5 \ libssh2-1 \ libxslt1.1 \ zlib1g \ @@ -151,6 +153,7 @@ RUN set -xe; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ + docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ docker-php-ext-install >/dev/null -j$(nproc) \ bcmath \ @@ -166,6 +169,8 @@ RUN set -xe; \ opcache \ pcntl \ pdo_mysql \ + pdo_pgsql \ + pgsql \ soap \ sockets \ ssh2 \ diff --git a/7.0/php-modules.txt b/7.0/php-modules.txt index e498c885..ddaaea80 100644 --- a/7.0/php-modules.txt +++ b/7.0/php-modules.txt @@ -32,7 +32,9 @@ pcntl pcre PDO pdo_mysql +pdo_pgsql pdo_sqlite +pgsql Phar posix readline diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 6e615800..167bfc8c 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -123,6 +123,7 @@ RUN set -xe; \ libmemcached-dev \ libmhash-dev \ libpng12-dev \ + libpq-dev \ libssh2-1-dev \ libxslt1-dev \ zlib1g-dev \ @@ -142,6 +143,7 @@ RUN set -xe; \ libmemcachedutil2 \ libmhash2 \ libpng12-0 \ + libpq5 \ libssh2-1 \ libxslt1.1 \ zlib1g \ @@ -151,6 +153,7 @@ RUN set -xe; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ + docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ docker-php-ext-install >/dev/null -j$(nproc) \ bcmath \ @@ -166,6 +169,8 @@ RUN set -xe; \ opcache \ pcntl \ pdo_mysql \ + pdo_pgsql \ + pgsql \ soap \ sockets \ ssh2 \ diff --git a/7.1/php-modules.txt b/7.1/php-modules.txt index e498c885..ddaaea80 100644 --- a/7.1/php-modules.txt +++ b/7.1/php-modules.txt @@ -32,7 +32,9 @@ pcntl pcre PDO pdo_mysql +pdo_pgsql pdo_sqlite +pgsql Phar posix readline diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 0566708b..87dcfdd0 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -124,6 +124,7 @@ RUN set -xe; \ libmemcached-dev \ libmhash-dev \ libpng-dev \ + libpq-dev \ libssh2-1-dev \ libxslt1-dev \ zlib1g-dev \ @@ -143,6 +144,7 @@ RUN set -xe; \ libmemcachedutil2 \ libmhash2 \ libpng16-16 \ + libpq5 \ libssh2-1 \ libxslt1.1 \ zlib1g \ @@ -154,6 +156,7 @@ RUN set -xe; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ + docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ docker-php-ext-install >/dev/null -j$(nproc) \ bcmath \ @@ -169,6 +172,8 @@ RUN set -xe; \ opcache \ pcntl \ pdo_mysql \ + pdo_pgsql \ + pgsql \ soap \ sockets \ ssh2 \ diff --git a/7.2/php-modules.txt b/7.2/php-modules.txt index 398badaa..06168950 100644 --- a/7.2/php-modules.txt +++ b/7.2/php-modules.txt @@ -31,7 +31,9 @@ pcntl pcre PDO pdo_mysql +pdo_pgsql pdo_sqlite +pgsql Phar posix readline From d2f57cc953cc7c88a9928412e2d2f2bcf53d8bd9 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 17:30:53 -0700 Subject: [PATCH 07/29] Cleanup output in tests --- tests/test.bats | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test.bats b/tests/test.bats index cacc794c..79d15a01 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -102,12 +102,15 @@ _healthcheck_wait () output=$(echo "$phpInfo" | grep "PHP Version") echo "$output" | grep "${PHP_VERSION}" + unset output output=$(echo "$phpInfo" | grep "memory_limit") echo "$output" | grep "memory_limit => 512M => 512M" + unset output output=$(echo "$phpInfo" | grep "sendmail_path") echo "$output" | grep "sendmail_path => /usr/local/bin/mhsendmail --smtp-addr=mail:1025 => /usr/local/bin/mhsendmail --smtp-addr=mail:1025" + unset output # Check PHP modules run bash -c "docker exec '${NAME}' php -m | diff php-modules.txt -" @@ -170,4 +173,4 @@ _healthcheck_wait () ### Cleanup ### docker rm -vf "$NAME" >/dev/null 2>&1 || true -} \ No newline at end of file +} From da65bd3eda3e521458c942a87a5fef7a7b129955 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 17:31:07 -0700 Subject: [PATCH 08/29] Added imap PHP extension --- 5.6/Dockerfile | 5 +++++ 5.6/php-modules.txt | 1 + 7.0/Dockerfile | 5 +++++ 7.0/php-modules.txt | 1 + 7.1/Dockerfile | 5 +++++ 7.1/php-modules.txt | 1 + 7.2/Dockerfile | 5 +++++ 7.2/php-modules.txt | 1 + 8 files changed, 24 insertions(+) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 59aeed9e..4f8a325a 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -112,10 +112,12 @@ ENV NOTVISIBLE "in users profile" RUN set -xe; \ buildDeps=" \ g++ \ + libc-client2007e-dev \ libfreetype6-dev \ libgpgme11-dev \ libicu-dev \ libjpeg62-turbo-dev \ + libkrb5-dev \ libldap2-dev \ libmagickcore-dev \ libmagickwand-dev \ @@ -131,6 +133,7 @@ RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ + libc-client2007e \ libfreetype6 \ libgpgme11 \ libicu52 \ @@ -147,6 +150,7 @@ RUN set -xe; \ zlib1g \ ;\ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ + docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ @@ -157,6 +161,7 @@ RUN set -xe; \ exif \ gd \ gettext \ + imap \ intl \ ldap \ mcrypt \ diff --git a/5.6/php-modules.txt b/5.6/php-modules.txt index 59e3d4d6..3d830e46 100644 --- a/5.6/php-modules.txt +++ b/5.6/php-modules.txt @@ -19,6 +19,7 @@ gnupg hash iconv imagick +imap intl json ldap diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 90f37f99..4b141d36 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -112,10 +112,12 @@ ENV NOTVISIBLE "in users profile" RUN set -xe; \ buildDeps=" \ g++ \ + libc-client2007e-dev \ libfreetype6-dev \ libgpgme11-dev \ libicu-dev \ libjpeg62-turbo-dev \ + libkrb5-dev \ libldap2-dev \ libmagickcore-dev \ libmagickwand-dev \ @@ -131,6 +133,7 @@ RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ + libc-client2007e \ libfreetype6 \ libgpgme11 \ libicu52 \ @@ -152,6 +155,7 @@ RUN set -xe; \ git clone https://github.com/php/pecl-networking-ssh2.git /usr/src/php/ext/ssh2 && rm -rf /usr/src/php/ext/ssh2/.git; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ + docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ @@ -162,6 +166,7 @@ RUN set -xe; \ exif \ gd \ gettext \ + imap \ intl \ ldap \ mcrypt \ diff --git a/7.0/php-modules.txt b/7.0/php-modules.txt index ddaaea80..fa9d178e 100644 --- a/7.0/php-modules.txt +++ b/7.0/php-modules.txt @@ -18,6 +18,7 @@ gnupg hash iconv imagick +imap intl json ldap diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 167bfc8c..1708b522 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -112,10 +112,12 @@ ENV NOTVISIBLE "in users profile" RUN set -xe; \ buildDeps=" \ g++ \ + libc-client2007e-dev \ libfreetype6-dev \ libgpgme11-dev \ libicu-dev \ libjpeg62-turbo-dev \ + libkrb5-dev \ libldap2-dev \ libmagickcore-dev \ libmagickwand-dev \ @@ -131,6 +133,7 @@ RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ + libc-client2007e \ libfreetype6 \ libgpgme11 \ libicu52 \ @@ -152,6 +155,7 @@ RUN set -xe; \ git clone https://github.com/php/pecl-networking-ssh2.git /usr/src/php/ext/ssh2 && rm -rf /usr/src/php/ext/ssh2/.git; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ + docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ @@ -162,6 +166,7 @@ RUN set -xe; \ exif \ gd \ gettext \ + imap \ intl \ ldap \ mcrypt \ diff --git a/7.1/php-modules.txt b/7.1/php-modules.txt index ddaaea80..fa9d178e 100644 --- a/7.1/php-modules.txt +++ b/7.1/php-modules.txt @@ -18,6 +18,7 @@ gnupg hash iconv imagick +imap intl json ldap diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 87dcfdd0..acbdacc6 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -113,10 +113,12 @@ ENV NOTVISIBLE "in users profile" RUN set -xe; \ buildDeps=" \ g++ \ + libc-client2007e-dev \ libfreetype6-dev \ libgpgme11-dev \ libicu-dev \ libjpeg62-turbo-dev \ + libkrb5-dev \ libldap2-dev \ libmagickcore-dev \ libmagickwand-dev \ @@ -132,6 +134,7 @@ RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ + libc-client2007e \ libfreetype6 \ libgpgme11 \ libicu57 \ @@ -155,6 +158,7 @@ RUN set -xe; \ git clone https://github.com/xdebug/xdebug.git /usr/src/php/ext/xdebug && rm -rf /usr/src/php/ext/xdebug/.git; \ \ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ + docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ @@ -165,6 +169,7 @@ RUN set -xe; \ exif \ gd \ gettext \ + imap \ intl \ ldap \ # mcrypt is removed from 7.2. See Deprecated features diff --git a/7.2/php-modules.txt b/7.2/php-modules.txt index 06168950..48565b41 100644 --- a/7.2/php-modules.txt +++ b/7.2/php-modules.txt @@ -18,6 +18,7 @@ gnupg hash iconv imagick +imap intl json ldap From 9ad9b8f4071064580e8d60d8945181056ca73544 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 18:49:53 -0700 Subject: [PATCH 09/29] Added MSSQL support. Closes #35 Only available for PHP 7.0+ on Linux --- 7.0/Dockerfile | 24 ++++++++++++++++++------ 7.0/php-modules.txt | 2 ++ 7.1/Dockerfile | 24 ++++++++++++++++++------ 7.1/php-modules.txt | 2 ++ 7.2/Dockerfile | 24 ++++++++++++++++++------ 7.2/php-modules.txt | 2 ++ 6 files changed, 60 insertions(+), 18 deletions(-) diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 4b141d36..afa9e990 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -38,18 +38,21 @@ ENV LC_ALL C.UTF-8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # Include backports + # backports repo echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/backports.list; \ - # Include blackfire.io repo + # blackfire.io repo curl -sSL https://packagecloud.io/gpg.key | apt-key add -; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ - # Include git-lfs repo + # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ - # Including yarn repo + # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list + echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + # MSQSQL repo + curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ + echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; # Additional packages RUN set -xe; \ @@ -128,9 +131,13 @@ RUN set -xe; \ libpq-dev \ libssh2-1-dev \ libxslt1-dev \ + unixodbc-dev \ zlib1g-dev \ "; \ - apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + apt-get update >/dev/null; \ + # Necessary for msodbcsql17 (MSSQL) + ACCEPT_EULA=Y \ + apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ libc-client2007e \ @@ -149,6 +156,7 @@ RUN set -xe; \ libpq5 \ libssh2-1 \ libxslt1.1 \ + msodbcsql17 \ zlib1g \ ;\ # SSH2 must be installed from source @@ -188,14 +196,18 @@ RUN set -xe; \ imagick \ # Use memcached (not memcache) for PHP 7.x memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ xdebug \ ;\ docker-php-ext-enable \ gnupg \ imagick \ memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ ;\ # Disable xdebug by default rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ diff --git a/7.0/php-modules.txt b/7.0/php-modules.txt index fa9d178e..2afe1101 100644 --- a/7.0/php-modules.txt +++ b/7.0/php-modules.txt @@ -35,6 +35,7 @@ PDO pdo_mysql pdo_pgsql pdo_sqlite +pdo_sqlsrv pgsql Phar posix @@ -47,6 +48,7 @@ soap sockets SPL sqlite3 +sqlsrv ssh2 standard tokenizer diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 1708b522..4d743ab0 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -38,18 +38,21 @@ ENV LC_ALL C.UTF-8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # Include backports + # backports repo echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/backports.list; \ - # Include blackfire.io repo + # blackfire.io repo curl -sSL https://packagecloud.io/gpg.key | apt-key add -; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ - # Include git-lfs repo + # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ - # Including yarn repo + # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list + echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + # MSQSQL repo + curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ + echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; # Additional packages RUN set -xe; \ @@ -128,9 +131,13 @@ RUN set -xe; \ libpq-dev \ libssh2-1-dev \ libxslt1-dev \ + unixodbc-dev \ zlib1g-dev \ "; \ - apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + apt-get update >/dev/null; \ + # Necessary for msodbcsql17 (MSSQL) + ACCEPT_EULA=Y \ + apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ libc-client2007e \ @@ -149,6 +156,7 @@ RUN set -xe; \ libpq5 \ libssh2-1 \ libxslt1.1 \ + msodbcsql17 \ zlib1g \ ;\ # SSH2 must be installed from source @@ -188,14 +196,18 @@ RUN set -xe; \ imagick \ # Use memcached (not memcache) for PHP 7.x memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ xdebug \ ;\ docker-php-ext-enable \ gnupg \ imagick \ memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ ;\ # Disable xdebug by default rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ diff --git a/7.1/php-modules.txt b/7.1/php-modules.txt index fa9d178e..2afe1101 100644 --- a/7.1/php-modules.txt +++ b/7.1/php-modules.txt @@ -35,6 +35,7 @@ PDO pdo_mysql pdo_pgsql pdo_sqlite +pdo_sqlsrv pgsql Phar posix @@ -47,6 +48,7 @@ soap sockets SPL sqlite3 +sqlsrv ssh2 standard tokenizer diff --git a/7.2/Dockerfile b/7.2/Dockerfile index acbdacc6..0d096dc5 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -39,18 +39,21 @@ ENV LC_ALL C.UTF-8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # Include backports + # backports repo echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/backports.list; \ - # Include blackfire.io repo + # blackfire.io repo curl -sSL https://packagecloud.io/gpg.key | apt-key add -; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ - # Include git-lfs repo + # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ - # Including yarn repo + # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list + echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + # MSQSQL repo + curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ + echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; # Additional packages RUN set -xe; \ @@ -129,9 +132,13 @@ RUN set -xe; \ libpq-dev \ libssh2-1-dev \ libxslt1-dev \ + unixodbc-dev \ zlib1g-dev \ "; \ - apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + apt-get update >/dev/null; \ + # Necessary for msodbcsql17 (MSSQL) + ACCEPT_EULA=Y \ + apt-get -y --force-yes --no-install-recommends install >/dev/null \ $buildDeps \ blackfire-php \ libc-client2007e \ @@ -150,6 +157,7 @@ RUN set -xe; \ libpq5 \ libssh2-1 \ libxslt1.1 \ + msodbcsql17 \ zlib1g \ ;\ # SSH2 must be installed from source @@ -192,13 +200,17 @@ RUN set -xe; \ imagick \ # Use memcached (not memcache) for PHP 7.x memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ ;\ docker-php-ext-enable \ gnupg \ imagick \ memcached \ + pdo_sqlsrv \ redis \ + sqlsrv \ ;\ # Disable xdebug by default rm -f /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ diff --git a/7.2/php-modules.txt b/7.2/php-modules.txt index 48565b41..986d28e7 100644 --- a/7.2/php-modules.txt +++ b/7.2/php-modules.txt @@ -34,6 +34,7 @@ PDO pdo_mysql pdo_pgsql pdo_sqlite +pdo_sqlsrv pgsql Phar posix @@ -47,6 +48,7 @@ sockets sodium SPL sqlite3 +sqlsrv ssh2 standard tokenizer From 58ab40fcdef873e0ce535ee242094e9a5a6d84ff Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 21:22:25 -0700 Subject: [PATCH 10/29] Use tee instead of redirect --- 7.0/Dockerfile | 6 +++--- 7.1/Dockerfile | 6 +++--- 7.2/Dockerfile | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/7.0/Dockerfile b/7.0/Dockerfile index afa9e990..9027b3e4 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -45,11 +45,11 @@ RUN set -xe; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ - echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee -a /etc/apt/sources.list.d/github_git-lfs.list; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ # MSQSQL repo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 4d743ab0..e74d1527 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -45,11 +45,11 @@ RUN set -xe; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ - echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee -a /etc/apt/sources.list.d/github_git-lfs.list; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ # MSQSQL repo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 0d096dc5..143620b3 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -46,11 +46,11 @@ RUN set -xe; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ - echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee -a /etc/apt/sources.list.d/github_git-lfs.list; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list; \ + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ # MSQSQL repo curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; From 1da7c3b32c215ad893eb989f06f2183eb24fb5ad Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 20 Mar 2018 22:03:57 -0700 Subject: [PATCH 11/29] Raise php cli memory limit to 1024M. Closes #34 Composer is a memory hog on Drupal 8 projects and, quite often, needs 1G or RAM to run. --- 5.6/config/php/zz-php.ini | 2 +- 7.0/config/php/zz-php.ini | 2 +- 7.1/config/php/zz-php.ini | 2 +- 7.2/config/php/zz-php.ini | 2 +- tests/test.bats | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/5.6/config/php/zz-php.ini b/5.6/config/php/zz-php.ini index 0576a6e8..0ffa2847 100644 --- a/5.6/config/php/zz-php.ini +++ b/5.6/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use docksal-www.conf [php] -memory_limit = 512M +memory_limit = 1024M max_execution_time = 600 always_populate_raw_post_data = -1 sendmail_path = /bin/true diff --git a/7.0/config/php/zz-php.ini b/7.0/config/php/zz-php.ini index 640c4833..1d775cd0 100644 --- a/7.0/config/php/zz-php.ini +++ b/7.0/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use docksal-www.conf [php] -memory_limit = 512M +memory_limit = 1024M max_execution_time = 600 sendmail_path = /bin/true date.timezone = UTC diff --git a/7.1/config/php/zz-php.ini b/7.1/config/php/zz-php.ini index 640c4833..1d775cd0 100644 --- a/7.1/config/php/zz-php.ini +++ b/7.1/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use docksal-www.conf [php] -memory_limit = 512M +memory_limit = 1024M max_execution_time = 600 sendmail_path = /bin/true date.timezone = UTC diff --git a/7.2/config/php/zz-php.ini b/7.2/config/php/zz-php.ini index 640c4833..1d775cd0 100644 --- a/7.2/config/php/zz-php.ini +++ b/7.2/config/php/zz-php.ini @@ -1,7 +1,7 @@ ; PHP global (CLI and FPM) settings ; To override settings for FPM use docksal-www.conf [php] -memory_limit = 512M +memory_limit = 1024M max_execution_time = 600 sendmail_path = /bin/true date.timezone = UTC diff --git a/tests/test.bats b/tests/test.bats index 79d15a01..c323c667 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -105,7 +105,7 @@ _healthcheck_wait () unset output output=$(echo "$phpInfo" | grep "memory_limit") - echo "$output" | grep "memory_limit => 512M => 512M" + echo "$output" | grep "memory_limit => 1024M => 1024M" unset output output=$(echo "$phpInfo" | grep "sendmail_path") From 78261a259a19bca43227459a5abb8b592c4e2795 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 21 Mar 2018 00:24:40 -0700 Subject: [PATCH 12/29] MSSQL support for PHP 5.6. Closes #37 Installs mssql and pdo_dblib extensions --- 5.6/Dockerfile | 7 +++++++ 5.6/php-modules.txt | 2 ++ 7.0/Dockerfile | 2 +- 7.1/Dockerfile | 2 +- 7.2/Dockerfile | 2 +- README.md | 11 ++++++++++- 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 4f8a325a..0277fe17 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -111,6 +111,7 @@ ENV NOTVISIBLE "in users profile" # Install PHP extentions RUN set -xe; \ buildDeps=" \ + freetds-dev \ g++ \ libc-client2007e-dev \ libfreetype6-dev \ @@ -146,12 +147,16 @@ RUN set -xe; \ libpng12-0 \ libpq5 \ libssh2-1 \ + libsybdb5 \ libxslt1.1 \ zlib1g \ ;\ docker-php-ext-configure >/dev/null gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \ docker-php-ext-configure >/dev/null imap --with-kerberos --with-imap-ssl; \ docker-php-ext-configure >/dev/null ldap --with-libdir=lib/x86_64-linux-gnu/; \ + # mssql can be install in PHP 5.6 only. pdo_dblib is available in PHP 7.0+ as well. + docker-php-ext-configure >/dev/null mssql --with-libdir=/lib/x86_64-linux-gnu/; \ + docker-php-ext-configure >/dev/null pdo_dblib --with-libdir=/lib/x86_64-linux-gnu/; \ docker-php-ext-configure >/dev/null pgsql --with-pgsql=/usr/local/pgsql/; \ \ docker-php-ext-install >/dev/null -j$(nproc) \ @@ -165,9 +170,11 @@ RUN set -xe; \ intl \ ldap \ mcrypt \ + mssql \ mysqli \ opcache \ pcntl \ + pdo_dblib \ pdo_mysql \ pdo_pgsql \ pgsql \ diff --git a/5.6/php-modules.txt b/5.6/php-modules.txt index 3d830e46..4f01f5a1 100644 --- a/5.6/php-modules.txt +++ b/5.6/php-modules.txt @@ -27,12 +27,14 @@ libxml mbstring mcrypt memcache +mssql mysqli mysqlnd openssl pcntl pcre PDO +pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 9027b3e4..7317cba5 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -50,7 +50,7 @@ RUN set -xe; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ - # MSQSQL repo + # MSQSQL repo - msodbcsql17, pecl/sqlsrv and pecl/pdo_sqlsrv (PHP 7.0+ only) curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; diff --git a/7.1/Dockerfile b/7.1/Dockerfile index e74d1527..040bcd7e 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -50,7 +50,7 @@ RUN set -xe; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ - # MSQSQL repo + # MSQSQL repo - msodbcsql17, pecl/sqlsrv and pecl/pdo_sqlsrv (PHP 7.0+ only) curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 143620b3..c5e8cb1f 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -51,7 +51,7 @@ RUN set -xe; \ # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list; \ - # MSQSQL repo + # MSQSQL repo - msodbcsql17, pecl/sqlsrv and pecl/pdo_sqlsrv (PHP 7.0+ only) curl -sSL https://packages.microsoft.com/keys/microsoft.asc | apt-key add -; \ echo 'deb https://packages.microsoft.com/debian/8/prod jessie main' | tee /etc/apt/sources.list.d/mssql.list; diff --git a/README.md b/README.md index b9357154..e689f1fc 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This image(s) is part of the [Docksal](http://docksal.io) image library. - php-fpm && php-cli - xdebug - composer - - drush (6,7,8) + - drush - registry_rebuild - coder-8.x + phpcs - drupal console launcher @@ -50,6 +50,15 @@ Other notable tools: - mc - mhsendmail + +## PHP database drivers support + +- SQLite - via `sqlite3`, `pdo_sqlite` +- MySQL - via `mysqli`, `mysqlnd`, `pdo_mysql` +- PostgreSQL - via `pgsql`, `pdo_pgsql` +- MSSQL - via `mssql` and `pdo_dblib` for PHP 5.6; `sqlsrv` and `pdo_sqlsrv` for PHP 7.0+ + + ## Xdebug Xdebug is disabled by default. From bda7e4e895ed343f03babe1cd7c2eb7a8581057f Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 23 Mar 2018 18:03:47 -0700 Subject: [PATCH 13/29] Added cron package docksal/docksal#238 --- 5.6/Dockerfile | 1 + 7.0/Dockerfile | 1 + 7.1/Dockerfile | 1 + 7.2/Dockerfile | 1 + 4 files changed, 4 insertions(+) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 0277fe17..f5a8bdf9 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -54,6 +54,7 @@ RUN set -xe; \ # Additional packages RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + cron \ dnsutils \ git-lfs \ ghostscript \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 7317cba5..00b7b3ae 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -57,6 +57,7 @@ RUN set -xe; \ # Additional packages RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + cron \ dnsutils \ git-lfs \ ghostscript \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 040bcd7e..39fabf1b 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -57,6 +57,7 @@ RUN set -xe; \ # Additional packages RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + cron \ dnsutils \ git-lfs \ ghostscript \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index c5e8cb1f..2ca428fd 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -58,6 +58,7 @@ RUN set -xe; \ # Additional packages RUN set -xe; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ + cron \ dnsutils \ git-lfs \ ghostscript \ From c6b8bd1baa714bf4a373222db0663beddf9602a3 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 26 Mar 2018 12:20:54 -0700 Subject: [PATCH 14/29] Added postgresql-client package (#31) --- 5.6/Dockerfile | 1 + 7.0/Dockerfile | 1 + 7.1/Dockerfile | 1 + 7.2/Dockerfile | 4 ++++ 4 files changed, 7 insertions(+) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index f5a8bdf9..1e8672dc 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -69,6 +69,7 @@ RUN set -xe; \ nano \ openssh-client \ openssh-server \ + postgresql-client \ procps \ pv \ rsync \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 00b7b3ae..1618a570 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -72,6 +72,7 @@ RUN set -xe; \ nano \ openssh-client \ openssh-server \ + postgresql-client \ procps \ pv \ rsync \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 39fabf1b..b6fcbdcb 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -72,6 +72,7 @@ RUN set -xe; \ nano \ openssh-client \ openssh-server \ + postgresql-client \ procps \ pv \ rsync \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 2ca428fd..7fa20172 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -57,6 +57,9 @@ RUN set -xe; \ # Additional packages RUN set -xe; \ + # Create man direcotries, otherwise some packages may not install (e.g. postgresql-client) + # This should be a temporary workaround until fixed upstream: https://github.com/debuerreotype/debuerreotype/issues/10 + mkdir -p /usr/share/man/man1 /usr/share/man/man7; \ apt-get update >/dev/null; apt-get -y --force-yes --no-install-recommends install >/dev/null \ cron \ dnsutils \ @@ -73,6 +76,7 @@ RUN set -xe; \ nano \ openssh-client \ openssh-server \ + postgresql-client \ procps \ pv \ rsync \ From 4d01e09e1a5176a2fc88ba0b951af929adc7b076 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 27 Mar 2018 10:45:32 -0700 Subject: [PATCH 15/29] Sync additional repos section in 5.6 with the other versions --- 5.6/Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 1e8672dc..948502fa 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -38,18 +38,18 @@ ENV LC_ALL C.UTF-8 # Enable additional repos RUN set -xe; \ sed -i 's/main/main contrib non-free/' /etc/apt/sources.list; \ - # Include backports + # backports repo echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/backports.list; \ - # Include blackfire.io repo + # blackfire.io repo curl -sSL https://packagecloud.io/gpg.key | apt-key add -; \ echo "deb https://packages.blackfire.io/debian any main" | tee /etc/apt/sources.list.d/blackfire.list; \ - # Include git-lfs repo + # git-lfs repo curl -sSL https://packagecloud.io/github/git-lfs/gpgkey | apt-key add -; \ - echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' > /etc/apt/sources.list.d/github_git-lfs.list; \ - echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' >> /etc/apt/sources.list.d/github_git-lfs.list; \ - # Including yarn repo + echo 'deb https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee /etc/apt/sources.list.d/github_git-lfs.list; \ + echo 'deb-src https://packagecloud.io/github/git-lfs/debian/ jessie main' | tee -a /etc/apt/sources.list.d/github_git-lfs.list; \ + # yarn repo curl -sSL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -; \ - echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list + echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list # Additional packages RUN set -xe; \ From c2a59de47da1e8791a4da0d7fddfa99b86a05482 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 27 Mar 2018 10:47:57 -0700 Subject: [PATCH 16/29] Added Drush Launcher with fallback to global Drush 8. Closes #38 - Drush Launcher v 0.6.0 - Drush 8 is now installed in /usr/local/bin/drush8 and used as a fallback for Drush Launcher (support legacy (global drush) use cases) - Removed commented out legacy Drush 6 and 7 installation lines --- 5.6/Dockerfile | 14 ++++++-------- 7.0/Dockerfile | 14 ++++++-------- 7.1/Dockerfile | 14 ++++++-------- 7.2/Dockerfile | 14 ++++++-------- 4 files changed, 24 insertions(+), 32 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 948502fa..9521ff7d 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -215,6 +215,7 @@ COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail ENV COMPOSER_VERSION=1.6.3 \ DRUSH_VERSION=8.1.16 \ + DRUSH_LAUNCHER_VERSION=0.6.0 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ @@ -223,7 +224,9 @@ RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ # Drush 8 (default) - curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush; \ + curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ + # Drush Launcher + curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Install wp-cli @@ -270,16 +273,11 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config -ENV PATH $PATH:$HOME/.composer/vendor/bin +ENV PATH=$PATH:$HOME/.composer/vendor/bin \ + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ - # Legacy Drush versions (6 and 7) - #mkdir $HOME/drush6 && cd $HOME/drush6 && composer require drush/drush:6.*;\ - #mkdir $HOME/drush7 && cd $HOME/drush7 && composer require drush/drush:7.*;\ - #echo "alias drush6='$HOME/drush6/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - #echo "alias drush7='$HOME/drush7/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - echo "alias drush8='/usr/local/bin/drush'" >> $HOME/.bash_aliases; \ # Drush modules drush dl registry_rebuild --default-major=7 --destination=$HOME/.drush >/dev/null; \ drush cc drush; \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 1618a570..d4edd313 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -224,6 +224,7 @@ COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail ENV COMPOSER_VERSION=1.6.3 \ DRUSH_VERSION=8.1.16 \ + DRUSH_LAUNCHER_VERSION=0.6.0 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ @@ -232,7 +233,9 @@ RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ # Drush 8 (default) - curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush; \ + curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ + # Drush Launcher + curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Install wp-cli @@ -279,16 +282,11 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config -ENV PATH $PATH:$HOME/.composer/vendor/bin +ENV PATH=$PATH:$HOME/.composer/vendor/bin \ + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ - # Legacy Drush versions (6 and 7) - #mkdir $HOME/drush6 && cd $HOME/drush6 && composer require drush/drush:6.*;\ - #mkdir $HOME/drush7 && cd $HOME/drush7 && composer require drush/drush:7.*;\ - #echo "alias drush6='$HOME/drush6/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - #echo "alias drush7='$HOME/drush7/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - echo "alias drush8='/usr/local/bin/drush'" >> $HOME/.bash_aliases; \ # Drush modules drush dl registry_rebuild --default-major=7 --destination=$HOME/.drush >/dev/null; \ drush cc drush; \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index b6fcbdcb..a1bc7efb 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -224,6 +224,7 @@ COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail ENV COMPOSER_VERSION=1.6.3 \ DRUSH_VERSION=8.1.16 \ + DRUSH_LAUNCHER_VERSION=0.6.0 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ @@ -232,7 +233,9 @@ RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ # Drush 8 (default) - curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush; \ + curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ + # Drush Launcher + curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Install wp-cli @@ -279,16 +282,11 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config -ENV PATH $PATH:$HOME/.composer/vendor/bin +ENV PATH=$PATH:$HOME/.composer/vendor/bin \ + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ - # Legacy Drush versions (6 and 7) - #mkdir $HOME/drush6 && cd $HOME/drush6 && composer require drush/drush:6.*;\ - #mkdir $HOME/drush7 && cd $HOME/drush7 && composer require drush/drush:7.*;\ - #echo "alias drush6='$HOME/drush6/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - #echo "alias drush7='$HOME/drush7/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - echo "alias drush8='/usr/local/bin/drush'" >> $HOME/.bash_aliases; \ # Drush modules drush dl registry_rebuild --default-major=7 --destination=$HOME/.drush >/dev/null; \ drush cc drush; \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 7fa20172..49d9dd8b 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -230,6 +230,7 @@ COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail ENV COMPOSER_VERSION=1.6.3 \ DRUSH_VERSION=8.1.16 \ + DRUSH_LAUNCHER_VERSION=0.6.0 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ @@ -238,7 +239,9 @@ RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ # Drush 8 (default) - curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush; \ + curl -sSL "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" -o /usr/local/bin/drush8; \ + # Drush Launcher + curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ # Install wp-cli @@ -285,16 +288,11 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config -ENV PATH $PATH:$HOME/.composer/vendor/bin +ENV PATH=$PATH:$HOME/.composer/vendor/bin \ + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ - # Legacy Drush versions (6 and 7) - #mkdir $HOME/drush6 && cd $HOME/drush6 && composer require drush/drush:6.*;\ - #mkdir $HOME/drush7 && cd $HOME/drush7 && composer require drush/drush:7.*;\ - #echo "alias drush6='$HOME/drush6/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - #echo "alias drush7='$HOME/drush7/vendor/bin/drush'" >> $HOME/.bash_aliases; \ - echo "alias drush8='/usr/local/bin/drush'" >> $HOME/.bash_aliases; \ # Drush modules drush dl registry_rebuild --default-major=7 --destination=$HOME/.drush >/dev/null; \ drush cc drush; \ From 7e85cfeced7b29f9e3c8be4bd8045a83c4143a89 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 27 Mar 2018 10:49:52 -0700 Subject: [PATCH 17/29] Added tests to check additional binary versions - composer - drush and drush launcher - drupal console - wp cli - mg2-codegen - blackfire cli --- tests/test.bats | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/test.bats b/tests/test.bats index c323c667..3082ed9c 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -155,6 +155,8 @@ _healthcheck_wait () } @test "Check binaries and versions" { + [[ $SKIP == 1 ]] && skip + ### Setup ### docker rm -vf "$NAME" >/dev/null 2>&1 || true docker run --name "$NAME" -d \ @@ -166,6 +168,43 @@ _healthcheck_wait () ### Tests ### + # Check Composer version + run docker exec "$NAME" bash -c 'composer --version | grep "^Composer version ${COMPOSER_VERSION} "' + [[ ${status} == 0 ]] + unset output + + # Check Drush Launcher version + run docker exec "$NAME" bash -c 'drush --version | grep "^Drush Launcher Version: ${DRUSH_LAUNCHER_VERSION}$"' + [[ ${status} == 0 ]] + unset output + + # Check Drush version + run docker exec "$NAME" bash -c 'drush --version | grep "^ Drush Version : ${DRUSH_VERSION} $"' + [[ ${status} == 0 ]] + unset output + + # Check Drupal Console version + run docker exec "$NAME" bash -c 'drupal --version | grep "^Drupal Console Launcher ${DRUPAL_CONSOLE_VERSION}$"' + [[ ${status} == 0 ]] + unset output + + # Check Wordpress CLI version + run docker exec "$NAME" bash -c 'wp --version | grep "^WP-CLI ${WPCLI_VERSION}$"' + [[ ${status} == 0 ]] + unset output + + # Check Magento 2 Code Generator version + # TODO: this should not require running with sudo - sudo should be removed ones the following issues is addressed: + # https://github.com/staempfli/magento2-code-generator/issues/11 + run docker exec "$NAME" bash -c 'sudo mg2-codegen --version | grep "^mg2-codegen ${MG_CODEGEN_VERSION}$"' + [[ ${status} == 0 ]] + unset output + + # Check Blackfire CLI version + run docker exec "$NAME" bash -c 'blackfire version | grep "^blackfire ${BLACKFIRE_VERSION} "' + [[ ${status} == 0 ]] + unset output + # Check mhsendmail (does not have a flag to report its versions...) run docker exec "$NAME" which mhsendmail echo "$output" | grep "/usr/local/bin/mhsendmail" From b0908b3d11ecad4f51a072ab8b49fd801786aa63 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 27 Mar 2018 11:28:20 -0700 Subject: [PATCH 18/29] Fix tests - run docker exec as a regular user (docker) --- tests/test.bats | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test.bats b/tests/test.bats index 3082ed9c..58b2573d 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -82,7 +82,7 @@ _healthcheck_wait () ### Tests ### # Check PHP FPM and settings - run docker exec "$NAME" /var/www/scripts/test-php-fpm.sh index.php + run docker exec -u docker "$NAME" /var/www/scripts/test-php-fpm.sh index.php # sed below is used to normalize the web output of phpinfo # It will transforms "memory_limit 256M 256M" into # "memory_limit => 256M => 256M", which is much easier to parse @@ -93,12 +93,12 @@ _healthcheck_wait () # Cleanup output after each "run" unset output - run docker exec "$NAME" /var/www/scripts/test-php-fpm.sh nonsense.php + run docker exec -u docker "$NAME" /var/www/scripts/test-php-fpm.sh nonsense.php echo "$output" | grep "Status: 404 Not Found" unset output # Check PHP CLI and settings - phpInfo=$(docker exec "$NAME" php -i) + phpInfo=$(docker exec -u docker "$NAME" php -i) output=$(echo "$phpInfo" | grep "PHP Version") echo "$output" | grep "${PHP_VERSION}" @@ -136,17 +136,17 @@ _healthcheck_wait () ### Tests ### # Check PHP FPM settings overrides - run docker exec "$NAME" /var/www/scripts/test-php-fpm.sh index.php + run docker exec -u docker "$NAME" /var/www/scripts/test-php-fpm.sh index.php echo "$output" | grep "memory_limit" | grep "512M" unset output # Check xdebug was enabled - run docker exec "$NAME" php -m + run docker exec -u docker "$NAME" php -m echo "$output" | grep -e "^xdebug$" unset output # Check PHP CLI overrides - run docker exec "$NAME" php -i + run docker exec -u docker "$NAME" php -i echo "$output" | grep "memory_limit => 128M => 128M" unset output @@ -169,44 +169,44 @@ _healthcheck_wait () ### Tests ### # Check Composer version - run docker exec "$NAME" bash -c 'composer --version | grep "^Composer version ${COMPOSER_VERSION} "' + run docker exec -u docker "$NAME" bash -c 'composer --version | grep "^Composer version ${COMPOSER_VERSION} "' [[ ${status} == 0 ]] unset output # Check Drush Launcher version - run docker exec "$NAME" bash -c 'drush --version | grep "^Drush Launcher Version: ${DRUSH_LAUNCHER_VERSION}$"' + run docker exec -u docker "$NAME" bash -c 'drush --version | grep "^Drush Launcher Version: ${DRUSH_LAUNCHER_VERSION}$"' [[ ${status} == 0 ]] unset output # Check Drush version - run docker exec "$NAME" bash -c 'drush --version | grep "^ Drush Version : ${DRUSH_VERSION} $"' + run docker exec -u docker "$NAME" bash -c 'drush --version | grep "^ Drush Version : ${DRUSH_VERSION} $"' [[ ${status} == 0 ]] unset output # Check Drupal Console version - run docker exec "$NAME" bash -c 'drupal --version | grep "^Drupal Console Launcher ${DRUPAL_CONSOLE_VERSION}$"' + run docker exec -u docker "$NAME" bash -c 'drupal --version | grep "^Drupal Console Launcher ${DRUPAL_CONSOLE_VERSION}$"' [[ ${status} == 0 ]] unset output # Check Wordpress CLI version - run docker exec "$NAME" bash -c 'wp --version | grep "^WP-CLI ${WPCLI_VERSION}$"' + run docker exec -u docker "$NAME" bash -c 'wp --version | grep "^WP-CLI ${WPCLI_VERSION}$"' [[ ${status} == 0 ]] unset output # Check Magento 2 Code Generator version # TODO: this should not require running with sudo - sudo should be removed ones the following issues is addressed: # https://github.com/staempfli/magento2-code-generator/issues/11 - run docker exec "$NAME" bash -c 'sudo mg2-codegen --version | grep "^mg2-codegen ${MG_CODEGEN_VERSION}$"' + run docker exec -u docker "$NAME" bash -c 'sudo mg2-codegen --version | grep "^mg2-codegen ${MG_CODEGEN_VERSION}$"' [[ ${status} == 0 ]] unset output # Check Blackfire CLI version - run docker exec "$NAME" bash -c 'blackfire version | grep "^blackfire ${BLACKFIRE_VERSION} "' + run docker exec -u docker "$NAME" bash -c 'blackfire version | grep "^blackfire ${BLACKFIRE_VERSION} "' [[ ${status} == 0 ]] unset output # Check mhsendmail (does not have a flag to report its versions...) - run docker exec "$NAME" which mhsendmail + run docker exec -u docker "$NAME" which mhsendmail echo "$output" | grep "/usr/local/bin/mhsendmail" unset output From 767549dc12735b414f3fa41be658a5a38398809b Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 29 Mar 2018 10:40:54 -0700 Subject: [PATCH 19/29] Bump nodejs to 8.11.0 LTS --- 5.6/Dockerfile | 2 +- 7.0/Dockerfile | 2 +- 7.1/Dockerfile | 2 +- 7.2/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 9521ff7d..c04652cb 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -258,7 +258,7 @@ ENV HOME /home/docker # Install nvm and a default node version ENV NVM_VERSION=0.33.8 \ - NODE_VERSION=8.10.0 \ + NODE_VERSION=8.11.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.0/Dockerfile b/7.0/Dockerfile index d4edd313..9dcd2a94 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -267,7 +267,7 @@ ENV HOME /home/docker # Install nvm and a default node version ENV NVM_VERSION=0.33.8 \ - NODE_VERSION=8.10.0 \ + NODE_VERSION=8.11.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.1/Dockerfile b/7.1/Dockerfile index a1bc7efb..64852958 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -267,7 +267,7 @@ ENV HOME /home/docker # Install nvm and a default node version ENV NVM_VERSION=0.33.8 \ - NODE_VERSION=8.10.0 \ + NODE_VERSION=8.11.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 49d9dd8b..e40c0657 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -273,7 +273,7 @@ ENV HOME /home/docker # Install nvm and a default node version ENV NVM_VERSION=0.33.8 \ - NODE_VERSION=8.10.0 \ + NODE_VERSION=8.11.0 \ NVM_DIR=$HOME/.nvm # Don't use -x here - node/nvm stuff prints just too much stuff RUN set -e; \ From 98fe548bf665b07d15992be1244a689bafd6f463 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 29 Mar 2018 17:48:25 -0700 Subject: [PATCH 20/29] Added Terminus. Closes #40 --- 5.6/Dockerfile | 6 +++++- 7.0/Dockerfile | 6 +++++- 7.1/Dockerfile | 6 +++++- 7.2/Dockerfile | 6 +++++- tests/test.bats | 5 +++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c04652cb..9d4b8272 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -273,8 +273,10 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config +# Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ + TERMINUS_VERSION=1.7.1 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -286,6 +288,8 @@ RUN set -xe; \ phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ + # Terminus + composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ # Cleanup composer clear-cache diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 9dcd2a94..f2f65506 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -282,8 +282,10 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config +# Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ + TERMINUS_VERSION=1.7.1 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -295,6 +297,8 @@ RUN set -xe; \ phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ + # Terminus + composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ # Cleanup composer clear-cache diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 64852958..e1b6af65 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -282,8 +282,10 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config +# Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ + TERMINUS_VERSION=1.7.1 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -295,6 +297,8 @@ RUN set -xe; \ phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ + # Terminus + composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ # Cleanup composer clear-cache diff --git a/7.2/Dockerfile b/7.2/Dockerfile index e40c0657..862cb204 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -288,8 +288,10 @@ RUN set -e; \ # Fix npm complaining about permissions and not being able to update sudo rm -rf $HOME/.config +# Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ + TERMINUS_VERSION=1.7.1 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -301,6 +303,8 @@ RUN set -xe; \ phpcs --config-set installed_paths $HOME/.composer/vendor/drupal/coder/coder_sniffer; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ + # Terminus + composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ # Cleanup composer clear-cache diff --git a/tests/test.bats b/tests/test.bats index 58b2573d..4a0b8b2b 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -210,6 +210,11 @@ _healthcheck_wait () echo "$output" | grep "/usr/local/bin/mhsendmail" unset output + # Check Terminus version + run docker exec -u docker "$NAME" bash -c 'terminus --version | grep "^Terminus ${TERMINUS_VERSION}$"' + [[ ${status} == 0 ]] + unset output + ### Cleanup ### docker rm -vf "$NAME" >/dev/null 2>&1 || true } From fae8ecf1245c0f4995a7b80b2ce5b66ac66ad827 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 09:58:43 -0700 Subject: [PATCH 21/29] Install Terminus to it's own directory to avoid composer dependency conflicts When installed globally (in ~/.composer/vendor) Terminus has dependency conflicts with other composer based packages already installed there. To fix this, we'll move it to it's own directory. Also bump Terminus to 1.8.0 --- 5.6/Dockerfile | 11 ++++++++--- 7.0/Dockerfile | 11 ++++++++--- 7.1/Dockerfile | 11 ++++++++--- 7.2/Dockerfile | 11 ++++++++--- 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 9d4b8272..a75a6c43 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -275,8 +275,9 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ - TERMINUS_VERSION=1.7.1 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 +ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ + TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -289,7 +290,11 @@ RUN set -xe; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ # Terminus - composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ + # Installed in a dedicated directory to avoid dependency conflicts. + echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.pantheon; \ + # Run in a subshell since we are doing directory switching + (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.0/Dockerfile b/7.0/Dockerfile index f2f65506..5126e43a 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -284,8 +284,9 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ - TERMINUS_VERSION=1.7.1 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 +ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ + TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -298,7 +299,11 @@ RUN set -xe; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ # Terminus - composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ + # Installed in a dedicated directory to avoid dependency conflicts. + echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.pantheon; \ + # Run in a subshell since we are doing directory switching + (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.1/Dockerfile b/7.1/Dockerfile index e1b6af65..e76d57fe 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -284,8 +284,9 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ - TERMINUS_VERSION=1.7.1 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 +ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ + TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -298,7 +299,11 @@ RUN set -xe; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ # Terminus - composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ + # Installed in a dedicated directory to avoid dependency conflicts. + echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.pantheon; \ + # Run in a subshell since we are doing directory switching + (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 862cb204..679b89ca 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -290,8 +290,9 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ - DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \ - TERMINUS_VERSION=1.7.1 + DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 +ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ + TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \ @@ -304,7 +305,11 @@ RUN set -xe; \ # Composer parallel install plugin composer global require hirak/prestissimo >/dev/null; \ # Terminus - composer global require pantheon-systems/terminus:${TERMINUS_VERSION}; \ + # Installed in a dedicated directory to avoid dependency conflicts. + echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.pantheon; \ + # Run in a subshell since we are doing directory switching + (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache From 99af12460bef80211af8172b5deec1931aa81af9 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 08:34:41 -0700 Subject: [PATCH 22/29] Fix indents in tests --- tests/test.bats | 68 ++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tests/test.bats b/tests/test.bats index 4a0b8b2b..c5ceffa5 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -18,19 +18,19 @@ teardown() { # @param $1 container id/name _healthcheck () { - local health_status - health_status=$(docker inspect --format='{{json .State.Health.Status}}' "$1" 2>/dev/null) - - # Wait for 5s then exit with 0 if a container does not have a health status property - # Necessary for backward compatibility with images that do not support health checks - if [[ $? != 0 ]]; then - echo "Waiting 10s for container to start..." - sleep 10 - return 0 - fi - - # If it does, check the status - echo $health_status | grep '"healthy"' >/dev/null 2>&1 + local health_status + health_status=$(docker inspect --format='{{json .State.Health.Status}}' "$1" 2>/dev/null) + + # Wait for 5s then exit with 0 if a container does not have a health status property + # Necessary for backward compatibility with images that do not support health checks + if [[ $? != 0 ]]; then + echo "Waiting 10s for container to start..." + sleep 10 + return 0 + fi + + # If it does, check the status + echo $health_status | grep '"healthy"' >/dev/null 2>&1 } # Waits for containers to become healthy @@ -39,27 +39,27 @@ _healthcheck () # TODO: make this universal. Currently hardcoded for cli only. _healthcheck_wait () { - # Wait for cli to become ready by watching its health status - local container_name="${NAME}" - local delay=5 - local timeout=30 - local elapsed=0 - - until _healthcheck "$container_name"; do - echo "Waiting for $container_name to become ready..." - sleep "$delay"; - - # Give the container 30s to become ready - elapsed=$((elapsed + delay)) - if ((elapsed > timeout)); then - echo-error "$container_name heathcheck failed" \ - "Container did not enter a healthy state within the expected amount of time." \ - "Try ${yellow}fin restart${NC}" - exit 1 - fi - done - - return 0 + # Wait for cli to become ready by watching its health status + local container_name="${NAME}" + local delay=5 + local timeout=30 + local elapsed=0 + + until _healthcheck "$container_name"; do + echo "Waiting for $container_name to become ready..." + sleep "$delay"; + + # Give the container 30s to become ready + elapsed=$((elapsed + delay)) + if ((elapsed > timeout)); then + echo-error "$container_name heathcheck failed" \ + "Container did not enter a healthy state within the expected amount of time." \ + "Try ${yellow}fin restart${NC}" + exit 1 + fi + done + + return 0 } From 418e1e7007d0698633bedacbb7f068efce5c3d64 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 09:02:28 -0700 Subject: [PATCH 23/29] Added gomplate to use go templates in configs --- 5.6/Dockerfile | 11 +++++++---- 7.0/Dockerfile | 11 +++++++---- 7.1/Dockerfile | 11 +++++++---- 7.2/Dockerfile | 11 +++++++---- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index a75a6c43..ed56ffa3 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -219,7 +219,8 @@ ENV COMPOSER_VERSION=1.6.3 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ - BLACKFIRE_VERSION=1.15.0 + BLACKFIRE_VERSION=1.15.0 \ + GOMPLATE_VERSION=2.4.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ @@ -229,12 +230,14 @@ RUN set -xe; \ curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ - # Install wp-cli + # Wordpress CLI curl -sSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Install magento code generator + # Magento2 Code Generator curl -sSL "https://github.com/staempfli/magento2-code-generator/releases/download/${MG_CODEGEN_VERSION}/mg2-codegen.phar" -o /usr/local/bin/mg2-codegen; \ - # Install blackfire cli + # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ + # gomplate + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 5126e43a..d088be93 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -228,7 +228,8 @@ ENV COMPOSER_VERSION=1.6.3 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ - BLACKFIRE_VERSION=1.15.0 + BLACKFIRE_VERSION=1.15.0 \ + GOMPLATE_VERSION=2.4.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ @@ -238,12 +239,14 @@ RUN set -xe; \ curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ - # Install wp-cli + # Wordpress CLI curl -sSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Install magento code generator + # Magento2 Code Generator curl -sSL "https://github.com/staempfli/magento2-code-generator/releases/download/${MG_CODEGEN_VERSION}/mg2-codegen.phar" -o /usr/local/bin/mg2-codegen; \ - # Install blackfire cli + # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ + # gomplate + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.1/Dockerfile b/7.1/Dockerfile index e76d57fe..f943ce08 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -228,7 +228,8 @@ ENV COMPOSER_VERSION=1.6.3 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ - BLACKFIRE_VERSION=1.15.0 + BLACKFIRE_VERSION=1.15.0 \ + GOMPLATE_VERSION=2.4.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ @@ -238,12 +239,14 @@ RUN set -xe; \ curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ - # Install wp-cli + # Wordpress CLI curl -sSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Install magento code generator + # Magento2 Code Generator curl -sSL "https://github.com/staempfli/magento2-code-generator/releases/download/${MG_CODEGEN_VERSION}/mg2-codegen.phar" -o /usr/local/bin/mg2-codegen; \ - # Install blackfire cli + # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ + # gomplate + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 679b89ca..beb60f82 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -234,7 +234,8 @@ ENV COMPOSER_VERSION=1.6.3 \ DRUPAL_CONSOLE_VERSION=1.7.0 \ WPCLI_VERSION=1.5.0 \ MG_CODEGEN_VERSION=1.10 \ - BLACKFIRE_VERSION=1.15.0 + BLACKFIRE_VERSION=1.15.0 \ + GOMPLATE_VERSION=2.4.0 RUN set -xe; \ # Composer curl -sSL "https://github.com/composer/composer/releases/download/${COMPOSER_VERSION}/composer.phar" -o /usr/local/bin/composer; \ @@ -244,12 +245,14 @@ RUN set -xe; \ curl -sSL "https://github.com/drush-ops/drush-launcher/releases/download/${DRUSH_LAUNCHER_VERSION}/drush.phar" -o /usr/local/bin/drush; \ # Drupal Console curl -sSL "https://github.com/hechoendrupal/drupal-console-launcher/releases/download/${DRUPAL_CONSOLE_VERSION}/drupal.phar" -o /usr/local/bin/drupal; \ - # Install wp-cli + # Wordpress CLI curl -sSL "https://github.com/wp-cli/wp-cli/releases/download/v${WPCLI_VERSION}/wp-cli-${WPCLI_VERSION}.phar" -o /usr/local/bin/wp; \ - # Install magento code generator + # Magento2 Code Generator curl -sSL "https://github.com/staempfli/magento2-code-generator/releases/download/${MG_CODEGEN_VERSION}/mg2-codegen.phar" -o /usr/local/bin/mg2-codegen; \ - # Install blackfire cli + # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ + # gomplate + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* From 7950f9e90f1dfbf8a3454eb452be4bdbdda81d4d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 09:04:21 -0700 Subject: [PATCH 24/29] Added templates for private SSH key and Acquia Cloud API --- 5.6/Dockerfile | 5 +++-- 5.6/config/.acquia/cloudapi.conf.tmpl | 1 + 5.6/config/.ssh/config | 1 + 5.6/config/.ssh/id_rsa.tmpl | 1 + 5.6/startup.sh | 21 +++++++++++++++++++++ 7.0/Dockerfile | 5 +++-- 7.0/config/.acquia/cloudapi.conf.tmpl | 1 + 7.0/config/.ssh/config | 1 + 7.0/config/.ssh/id_rsa.tmpl | 1 + 7.0/startup.sh | 21 +++++++++++++++++++++ 7.1/Dockerfile | 5 +++-- 7.1/config/.acquia/cloudapi.conf.tmpl | 1 + 7.1/config/.ssh/config | 1 + 7.1/config/.ssh/id_rsa.tmpl | 1 + 7.1/startup.sh | 21 +++++++++++++++++++++ 7.2/Dockerfile | 5 +++-- 7.2/config/.acquia/cloudapi.conf.tmpl | 1 + 7.2/config/.ssh/config | 1 + 7.2/config/.ssh/id_rsa.tmpl | 1 + 7.2/startup.sh | 21 +++++++++++++++++++++ 20 files changed, 108 insertions(+), 8 deletions(-) create mode 100644 5.6/config/.acquia/cloudapi.conf.tmpl create mode 100644 5.6/config/.ssh/id_rsa.tmpl create mode 100644 7.0/config/.acquia/cloudapi.conf.tmpl create mode 100644 7.0/config/.ssh/id_rsa.tmpl create mode 100644 7.1/config/.acquia/cloudapi.conf.tmpl create mode 100644 7.1/config/.ssh/id_rsa.tmpl create mode 100644 7.2/config/.acquia/cloudapi.conf.tmpl create mode 100644 7.2/config/.ssh/id_rsa.tmpl diff --git a/5.6/Dockerfile b/5.6/Dockerfile index ed56ffa3..9e756b25 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -304,9 +304,10 @@ RUN set -xe; \ USER root # Copy configs and scripts -COPY --chown=docker:docker config/.ssh $HOME/.ssh -COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.acquia $HOME/.acquia COPY --chown=docker:docker config/.docksalrc $HOME/.docksalrc +COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.ssh $HOME/.ssh COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY startup.sh /opt/startup.sh COPY healthcheck.sh /opt/healthcheck.sh diff --git a/5.6/config/.acquia/cloudapi.conf.tmpl b/5.6/config/.acquia/cloudapi.conf.tmpl new file mode 100644 index 00000000..8ee346e5 --- /dev/null +++ b/5.6/config/.acquia/cloudapi.conf.tmpl @@ -0,0 +1 @@ +{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} diff --git a/5.6/config/.ssh/config b/5.6/config/.ssh/config index 5f68e05c..74320faa 100644 --- a/5.6/config/.ssh/config +++ b/5.6/config/.ssh/config @@ -1,3 +1,4 @@ +# Disable remote host key checking and warnings Host * StrictHostKeyChecking no UserKnownHostsFile /dev/null diff --git a/5.6/config/.ssh/id_rsa.tmpl b/5.6/config/.ssh/id_rsa.tmpl new file mode 100644 index 00000000..969c101a --- /dev/null +++ b/5.6/config/.ssh/id_rsa.tmpl @@ -0,0 +1 @@ +{{ getenv "SSH_PRIVATE_KEY" }} diff --git a/5.6/startup.sh b/5.6/startup.sh index b15a852a..083fb325 100755 --- a/5.6/startup.sh +++ b/5.6/startup.sh @@ -28,6 +28,27 @@ xdebug_enable() sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } +# Helper function to render configs from go templates using gomplate +render_tmpl() +{ + local file=${1} + local tmpl="${1}.tmpl" + + if [[ ! -f ${tmpl} ]]; then + echo-debug "Error: Template file not found: ${tmpl}" + return 1 + else + echo-debug "Rendering tempalte: ${tmpl}..." + gompalte -f "${tmpl}" -o "${file}" + fi +} + +# Process templates +# Private SSH key +render_tmpl "$HOME_DIR/.ssh/id_rsa" +# Acquia Cloud API config +render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.0/Dockerfile b/7.0/Dockerfile index d088be93..9166fb56 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -313,9 +313,10 @@ RUN set -xe; \ USER root # Copy configs and scripts -COPY --chown=docker:docker config/.ssh $HOME/.ssh -COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.acquia $HOME/.acquia COPY --chown=docker:docker config/.docksalrc $HOME/.docksalrc +COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.ssh $HOME/.ssh COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY startup.sh /opt/startup.sh COPY healthcheck.sh /opt/healthcheck.sh diff --git a/7.0/config/.acquia/cloudapi.conf.tmpl b/7.0/config/.acquia/cloudapi.conf.tmpl new file mode 100644 index 00000000..8ee346e5 --- /dev/null +++ b/7.0/config/.acquia/cloudapi.conf.tmpl @@ -0,0 +1 @@ +{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} diff --git a/7.0/config/.ssh/config b/7.0/config/.ssh/config index 5f68e05c..74320faa 100644 --- a/7.0/config/.ssh/config +++ b/7.0/config/.ssh/config @@ -1,3 +1,4 @@ +# Disable remote host key checking and warnings Host * StrictHostKeyChecking no UserKnownHostsFile /dev/null diff --git a/7.0/config/.ssh/id_rsa.tmpl b/7.0/config/.ssh/id_rsa.tmpl new file mode 100644 index 00000000..969c101a --- /dev/null +++ b/7.0/config/.ssh/id_rsa.tmpl @@ -0,0 +1 @@ +{{ getenv "SSH_PRIVATE_KEY" }} diff --git a/7.0/startup.sh b/7.0/startup.sh index b15a852a..083fb325 100755 --- a/7.0/startup.sh +++ b/7.0/startup.sh @@ -28,6 +28,27 @@ xdebug_enable() sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } +# Helper function to render configs from go templates using gomplate +render_tmpl() +{ + local file=${1} + local tmpl="${1}.tmpl" + + if [[ ! -f ${tmpl} ]]; then + echo-debug "Error: Template file not found: ${tmpl}" + return 1 + else + echo-debug "Rendering tempalte: ${tmpl}..." + gompalte -f "${tmpl}" -o "${file}" + fi +} + +# Process templates +# Private SSH key +render_tmpl "$HOME_DIR/.ssh/id_rsa" +# Acquia Cloud API config +render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.1/Dockerfile b/7.1/Dockerfile index f943ce08..5866f858 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -313,9 +313,10 @@ RUN set -xe; \ USER root # Copy configs and scripts -COPY --chown=docker:docker config/.ssh $HOME/.ssh -COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.acquia $HOME/.acquia COPY --chown=docker:docker config/.docksalrc $HOME/.docksalrc +COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.ssh $HOME/.ssh COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY startup.sh /opt/startup.sh COPY healthcheck.sh /opt/healthcheck.sh diff --git a/7.1/config/.acquia/cloudapi.conf.tmpl b/7.1/config/.acquia/cloudapi.conf.tmpl new file mode 100644 index 00000000..8ee346e5 --- /dev/null +++ b/7.1/config/.acquia/cloudapi.conf.tmpl @@ -0,0 +1 @@ +{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} diff --git a/7.1/config/.ssh/config b/7.1/config/.ssh/config index 5f68e05c..74320faa 100644 --- a/7.1/config/.ssh/config +++ b/7.1/config/.ssh/config @@ -1,3 +1,4 @@ +# Disable remote host key checking and warnings Host * StrictHostKeyChecking no UserKnownHostsFile /dev/null diff --git a/7.1/config/.ssh/id_rsa.tmpl b/7.1/config/.ssh/id_rsa.tmpl new file mode 100644 index 00000000..969c101a --- /dev/null +++ b/7.1/config/.ssh/id_rsa.tmpl @@ -0,0 +1 @@ +{{ getenv "SSH_PRIVATE_KEY" }} diff --git a/7.1/startup.sh b/7.1/startup.sh index b15a852a..083fb325 100755 --- a/7.1/startup.sh +++ b/7.1/startup.sh @@ -28,6 +28,27 @@ xdebug_enable() sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } +# Helper function to render configs from go templates using gomplate +render_tmpl() +{ + local file=${1} + local tmpl="${1}.tmpl" + + if [[ ! -f ${tmpl} ]]; then + echo-debug "Error: Template file not found: ${tmpl}" + return 1 + else + echo-debug "Rendering tempalte: ${tmpl}..." + gompalte -f "${tmpl}" -o "${file}" + fi +} + +# Process templates +# Private SSH key +render_tmpl "$HOME_DIR/.ssh/id_rsa" +# Acquia Cloud API config +render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.2/Dockerfile b/7.2/Dockerfile index beb60f82..04c19bad 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -319,9 +319,10 @@ RUN set -xe; \ USER root # Copy configs and scripts -COPY --chown=docker:docker config/.ssh $HOME/.ssh -COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.acquia $HOME/.acquia COPY --chown=docker:docker config/.docksalrc $HOME/.docksalrc +COPY --chown=docker:docker config/.drush $HOME/.drush +COPY --chown=docker:docker config/.ssh $HOME/.ssh COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY startup.sh /opt/startup.sh COPY healthcheck.sh /opt/healthcheck.sh diff --git a/7.2/config/.acquia/cloudapi.conf.tmpl b/7.2/config/.acquia/cloudapi.conf.tmpl new file mode 100644 index 00000000..8ee346e5 --- /dev/null +++ b/7.2/config/.acquia/cloudapi.conf.tmpl @@ -0,0 +1 @@ +{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} diff --git a/7.2/config/.ssh/config b/7.2/config/.ssh/config index 5f68e05c..74320faa 100644 --- a/7.2/config/.ssh/config +++ b/7.2/config/.ssh/config @@ -1,3 +1,4 @@ +# Disable remote host key checking and warnings Host * StrictHostKeyChecking no UserKnownHostsFile /dev/null diff --git a/7.2/config/.ssh/id_rsa.tmpl b/7.2/config/.ssh/id_rsa.tmpl new file mode 100644 index 00000000..969c101a --- /dev/null +++ b/7.2/config/.ssh/id_rsa.tmpl @@ -0,0 +1 @@ +{{ getenv "SSH_PRIVATE_KEY" }} diff --git a/7.2/startup.sh b/7.2/startup.sh index b15a852a..083fb325 100755 --- a/7.2/startup.sh +++ b/7.2/startup.sh @@ -28,6 +28,27 @@ xdebug_enable() sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } +# Helper function to render configs from go templates using gomplate +render_tmpl() +{ + local file=${1} + local tmpl="${1}.tmpl" + + if [[ ! -f ${tmpl} ]]; then + echo-debug "Error: Template file not found: ${tmpl}" + return 1 + else + echo-debug "Rendering tempalte: ${tmpl}..." + gompalte -f "${tmpl}" -o "${file}" + fi +} + +# Process templates +# Private SSH key +render_tmpl "$HOME_DIR/.ssh/id_rsa" +# Acquia Cloud API config +render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset From ea039a1ec67918ab91d13f25ae7fadc45ee80c59 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 09:05:48 -0700 Subject: [PATCH 25/29] Updated acapi.drush.inc --- 5.6/config/.drush/acapi.drush.inc | 27 +++++++++++++++++++++++---- 7.0/config/.drush/acapi.drush.inc | 27 +++++++++++++++++++++++---- 7.1/config/.drush/acapi.drush.inc | 27 +++++++++++++++++++++++---- 7.2/config/.drush/acapi.drush.inc | 27 +++++++++++++++++++++++---- 4 files changed, 92 insertions(+), 16 deletions(-) diff --git a/5.6/config/.drush/acapi.drush.inc b/5.6/config/.drush/acapi.drush.inc index 0d56fed4..b04b8a3c 100644 --- a/5.6/config/.drush/acapi.drush.inc +++ b/5.6/config/.drush/acapi.drush.inc @@ -34,7 +34,9 @@ function acapi_drush_command() { 'arguments' => array( ), 'options' => $options + array( - 'reset' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.', + 'reset' => array( + 'description' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.' + ), ), ); @@ -284,11 +286,20 @@ function acapi_drush_command() { 'description' => "List a site's tasks.", 'arguments' => array( ), - 'options' => array ( - 'state' => array ( + 'options' => array( + 'state' => array( 'description' => 'The task state to retrieve. If not specified, retrieve all tasks for the site.', 'example-value' => 'done', - )) + $options, + ), + 'days' => array( + 'description' => 'The number of days worth of tasks to retrieve. If not specified, retrieve, at a maximum, 7 days worth of tasks.', + 'example-value' => '5', + ), + 'limit' => array( + 'description' => 'The maximum number of tasks to retrieve. If not specified, retrieve a maximum of 50 tasks. The maximum value allowed is 1000.', + 'example-value' => '500' + ), + ) + $options, ); $items['ac-task-info'] = array( @@ -783,10 +794,18 @@ function drush_acapi_ac_task_list() { $api_args = acapi_get_site_args(); $format = acapi_get_option('format'); $state = drush_get_option('state', NULL); + $days = drush_get_option('days', NULL); + $limit = drush_get_option('limit', NULL); $params = array(); if (isset($state)) { $params['state'] = $state; } + if (isset($days)) { + $params['days'] = $days; + } + if (isset($limit)) { + $params['limit'] = $limit; + } list($status, $result) = acapi_call( 'GET', diff --git a/7.0/config/.drush/acapi.drush.inc b/7.0/config/.drush/acapi.drush.inc index 0d56fed4..b04b8a3c 100644 --- a/7.0/config/.drush/acapi.drush.inc +++ b/7.0/config/.drush/acapi.drush.inc @@ -34,7 +34,9 @@ function acapi_drush_command() { 'arguments' => array( ), 'options' => $options + array( - 'reset' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.', + 'reset' => array( + 'description' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.' + ), ), ); @@ -284,11 +286,20 @@ function acapi_drush_command() { 'description' => "List a site's tasks.", 'arguments' => array( ), - 'options' => array ( - 'state' => array ( + 'options' => array( + 'state' => array( 'description' => 'The task state to retrieve. If not specified, retrieve all tasks for the site.', 'example-value' => 'done', - )) + $options, + ), + 'days' => array( + 'description' => 'The number of days worth of tasks to retrieve. If not specified, retrieve, at a maximum, 7 days worth of tasks.', + 'example-value' => '5', + ), + 'limit' => array( + 'description' => 'The maximum number of tasks to retrieve. If not specified, retrieve a maximum of 50 tasks. The maximum value allowed is 1000.', + 'example-value' => '500' + ), + ) + $options, ); $items['ac-task-info'] = array( @@ -783,10 +794,18 @@ function drush_acapi_ac_task_list() { $api_args = acapi_get_site_args(); $format = acapi_get_option('format'); $state = drush_get_option('state', NULL); + $days = drush_get_option('days', NULL); + $limit = drush_get_option('limit', NULL); $params = array(); if (isset($state)) { $params['state'] = $state; } + if (isset($days)) { + $params['days'] = $days; + } + if (isset($limit)) { + $params['limit'] = $limit; + } list($status, $result) = acapi_call( 'GET', diff --git a/7.1/config/.drush/acapi.drush.inc b/7.1/config/.drush/acapi.drush.inc index 0d56fed4..b04b8a3c 100644 --- a/7.1/config/.drush/acapi.drush.inc +++ b/7.1/config/.drush/acapi.drush.inc @@ -34,7 +34,9 @@ function acapi_drush_command() { 'arguments' => array( ), 'options' => $options + array( - 'reset' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.', + 'reset' => array( + 'description' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.' + ), ), ); @@ -284,11 +286,20 @@ function acapi_drush_command() { 'description' => "List a site's tasks.", 'arguments' => array( ), - 'options' => array ( - 'state' => array ( + 'options' => array( + 'state' => array( 'description' => 'The task state to retrieve. If not specified, retrieve all tasks for the site.', 'example-value' => 'done', - )) + $options, + ), + 'days' => array( + 'description' => 'The number of days worth of tasks to retrieve. If not specified, retrieve, at a maximum, 7 days worth of tasks.', + 'example-value' => '5', + ), + 'limit' => array( + 'description' => 'The maximum number of tasks to retrieve. If not specified, retrieve a maximum of 50 tasks. The maximum value allowed is 1000.', + 'example-value' => '500' + ), + ) + $options, ); $items['ac-task-info'] = array( @@ -783,10 +794,18 @@ function drush_acapi_ac_task_list() { $api_args = acapi_get_site_args(); $format = acapi_get_option('format'); $state = drush_get_option('state', NULL); + $days = drush_get_option('days', NULL); + $limit = drush_get_option('limit', NULL); $params = array(); if (isset($state)) { $params['state'] = $state; } + if (isset($days)) { + $params['days'] = $days; + } + if (isset($limit)) { + $params['limit'] = $limit; + } list($status, $result) = acapi_call( 'GET', diff --git a/7.2/config/.drush/acapi.drush.inc b/7.2/config/.drush/acapi.drush.inc index 0d56fed4..b04b8a3c 100644 --- a/7.2/config/.drush/acapi.drush.inc +++ b/7.2/config/.drush/acapi.drush.inc @@ -34,7 +34,9 @@ function acapi_drush_command() { 'arguments' => array( ), 'options' => $options + array( - 'reset' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.', + 'reset' => array( + 'description' => 'Discard any existing stored values from a previous call. Without this option, new values will be merged with existing values.' + ), ), ); @@ -284,11 +286,20 @@ function acapi_drush_command() { 'description' => "List a site's tasks.", 'arguments' => array( ), - 'options' => array ( - 'state' => array ( + 'options' => array( + 'state' => array( 'description' => 'The task state to retrieve. If not specified, retrieve all tasks for the site.', 'example-value' => 'done', - )) + $options, + ), + 'days' => array( + 'description' => 'The number of days worth of tasks to retrieve. If not specified, retrieve, at a maximum, 7 days worth of tasks.', + 'example-value' => '5', + ), + 'limit' => array( + 'description' => 'The maximum number of tasks to retrieve. If not specified, retrieve a maximum of 50 tasks. The maximum value allowed is 1000.', + 'example-value' => '500' + ), + ) + $options, ); $items['ac-task-info'] = array( @@ -783,10 +794,18 @@ function drush_acapi_ac_task_list() { $api_args = acapi_get_site_args(); $format = acapi_get_option('format'); $state = drush_get_option('state', NULL); + $days = drush_get_option('days', NULL); + $limit = drush_get_option('limit', NULL); $params = array(); if (isset($state)) { $params['state'] = $state; } + if (isset($days)) { + $params['days'] = $days; + } + if (isset($limit)) { + $params['limit'] = $limit; + } list($status, $result) = acapi_call( 'GET', From 7139e24bb7b9ed622a0eb7f0746d462db9aaef8c Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 09:06:14 -0700 Subject: [PATCH 26/29] Added tests for config templates Also prefixed secrets with "SECRET_" and moved them from docksal.yml into docksal.env --- 5.6/Dockerfile | 2 +- 5.6/config/.acquia/cloudapi.conf.tmpl | 2 +- 5.6/config/.ssh/id_rsa.tmpl | 2 +- 5.6/startup.sh | 10 +++---- 7.0/Dockerfile | 2 +- 7.0/config/.acquia/cloudapi.conf.tmpl | 2 +- 7.0/config/.ssh/id_rsa.tmpl | 2 +- 7.0/startup.sh | 10 +++---- 7.1/Dockerfile | 2 +- 7.1/config/.acquia/cloudapi.conf.tmpl | 2 +- 7.1/config/.ssh/id_rsa.tmpl | 2 +- 7.1/startup.sh | 10 +++---- 7.2/Dockerfile | 2 +- 7.2/config/.acquia/cloudapi.conf.tmpl | 2 +- 7.2/config/.ssh/id_rsa.tmpl | 2 +- 7.2/startup.sh | 10 +++---- tests/.docksal/docksal.env | 12 ++++++++ tests/.docksal/docksal.yml | 1 + tests/test.bats | 40 +++++++++++++++++++++++++++ 19 files changed, 85 insertions(+), 32 deletions(-) create mode 100644 tests/.docksal/docksal.env create mode 100644 tests/.docksal/docksal.yml diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 9e756b25..72b27e47 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -237,7 +237,7 @@ RUN set -xe; \ # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ # gomplate - curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gomplate; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/5.6/config/.acquia/cloudapi.conf.tmpl b/5.6/config/.acquia/cloudapi.conf.tmpl index 8ee346e5..1cfd222f 100644 --- a/5.6/config/.acquia/cloudapi.conf.tmpl +++ b/5.6/config/.acquia/cloudapi.conf.tmpl @@ -1 +1 @@ -{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} +{"email":"{{ getenv "SECRET_ACAPI_EMAIL" }}","key":"{{ getenv "SECRET_ACAPI_KEY" }}"} diff --git a/5.6/config/.ssh/id_rsa.tmpl b/5.6/config/.ssh/id_rsa.tmpl index 969c101a..cc8fa3bb 100644 --- a/5.6/config/.ssh/id_rsa.tmpl +++ b/5.6/config/.ssh/id_rsa.tmpl @@ -1 +1 @@ -{{ getenv "SSH_PRIVATE_KEY" }} +{{ getenv "SECRET_SSH_PRIVATE_KEY" }} diff --git a/5.6/startup.sh b/5.6/startup.sh index 083fb325..e8997c9c 100755 --- a/5.6/startup.sh +++ b/5.6/startup.sh @@ -31,15 +31,15 @@ xdebug_enable() # Helper function to render configs from go templates using gomplate render_tmpl() { - local file=${1} + local file="${1}" local tmpl="${1}.tmpl" - if [[ ! -f ${tmpl} ]]; then + if [[ -f "${tmpl}" ]]; then + echo-debug "Rendering template: ${tmpl}..." + gomplate --file "${tmpl}" --out "${file}" + else echo-debug "Error: Template file not found: ${tmpl}" return 1 - else - echo-debug "Rendering tempalte: ${tmpl}..." - gompalte -f "${tmpl}" -o "${file}" fi } diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 9166fb56..55518c68 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -246,7 +246,7 @@ RUN set -xe; \ # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ # gomplate - curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gomplate; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.0/config/.acquia/cloudapi.conf.tmpl b/7.0/config/.acquia/cloudapi.conf.tmpl index 8ee346e5..1cfd222f 100644 --- a/7.0/config/.acquia/cloudapi.conf.tmpl +++ b/7.0/config/.acquia/cloudapi.conf.tmpl @@ -1 +1 @@ -{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} +{"email":"{{ getenv "SECRET_ACAPI_EMAIL" }}","key":"{{ getenv "SECRET_ACAPI_KEY" }}"} diff --git a/7.0/config/.ssh/id_rsa.tmpl b/7.0/config/.ssh/id_rsa.tmpl index 969c101a..cc8fa3bb 100644 --- a/7.0/config/.ssh/id_rsa.tmpl +++ b/7.0/config/.ssh/id_rsa.tmpl @@ -1 +1 @@ -{{ getenv "SSH_PRIVATE_KEY" }} +{{ getenv "SECRET_SSH_PRIVATE_KEY" }} diff --git a/7.0/startup.sh b/7.0/startup.sh index 083fb325..e8997c9c 100755 --- a/7.0/startup.sh +++ b/7.0/startup.sh @@ -31,15 +31,15 @@ xdebug_enable() # Helper function to render configs from go templates using gomplate render_tmpl() { - local file=${1} + local file="${1}" local tmpl="${1}.tmpl" - if [[ ! -f ${tmpl} ]]; then + if [[ -f "${tmpl}" ]]; then + echo-debug "Rendering template: ${tmpl}..." + gomplate --file "${tmpl}" --out "${file}" + else echo-debug "Error: Template file not found: ${tmpl}" return 1 - else - echo-debug "Rendering tempalte: ${tmpl}..." - gompalte -f "${tmpl}" -o "${file}" fi } diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 5866f858..3edd8f4e 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -246,7 +246,7 @@ RUN set -xe; \ # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ # gomplate - curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gomplate; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.1/config/.acquia/cloudapi.conf.tmpl b/7.1/config/.acquia/cloudapi.conf.tmpl index 8ee346e5..1cfd222f 100644 --- a/7.1/config/.acquia/cloudapi.conf.tmpl +++ b/7.1/config/.acquia/cloudapi.conf.tmpl @@ -1 +1 @@ -{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} +{"email":"{{ getenv "SECRET_ACAPI_EMAIL" }}","key":"{{ getenv "SECRET_ACAPI_KEY" }}"} diff --git a/7.1/config/.ssh/id_rsa.tmpl b/7.1/config/.ssh/id_rsa.tmpl index 969c101a..cc8fa3bb 100644 --- a/7.1/config/.ssh/id_rsa.tmpl +++ b/7.1/config/.ssh/id_rsa.tmpl @@ -1 +1 @@ -{{ getenv "SSH_PRIVATE_KEY" }} +{{ getenv "SECRET_SSH_PRIVATE_KEY" }} diff --git a/7.1/startup.sh b/7.1/startup.sh index 083fb325..e8997c9c 100755 --- a/7.1/startup.sh +++ b/7.1/startup.sh @@ -31,15 +31,15 @@ xdebug_enable() # Helper function to render configs from go templates using gomplate render_tmpl() { - local file=${1} + local file="${1}" local tmpl="${1}.tmpl" - if [[ ! -f ${tmpl} ]]; then + if [[ -f "${tmpl}" ]]; then + echo-debug "Rendering template: ${tmpl}..." + gomplate --file "${tmpl}" --out "${file}" + else echo-debug "Error: Template file not found: ${tmpl}" return 1 - else - echo-debug "Rendering tempalte: ${tmpl}..." - gompalte -f "${tmpl}" -o "${file}" fi } diff --git a/7.2/Dockerfile b/7.2/Dockerfile index 04c19bad..cd7b4898 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -252,7 +252,7 @@ RUN set -xe; \ # Blackfire CLI curl -sSL https://packages.blackfire.io/binaries/blackfire-agent/${BLACKFIRE_VERSION}/blackfire-cli-linux_static_amd64 -o /usr/local/bin/blackfire; \ # gomplate - curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gompalte; \ + curl -sSL https://github.com/hairyhenderson/gomplate/releases/download/v${GOMPLATE_VERSION}/gomplate_linux-amd64-slim -o /usr/local/bin/gomplate; \ # Make all binaries executable in one shot chmod +x /usr/local/bin/* diff --git a/7.2/config/.acquia/cloudapi.conf.tmpl b/7.2/config/.acquia/cloudapi.conf.tmpl index 8ee346e5..1cfd222f 100644 --- a/7.2/config/.acquia/cloudapi.conf.tmpl +++ b/7.2/config/.acquia/cloudapi.conf.tmpl @@ -1 +1 @@ -{"email":"{{ getenv "ACAPI_EMAIL" }}","key":"{{ getenv "ACAPI_KEY" }}"} +{"email":"{{ getenv "SECRET_ACAPI_EMAIL" }}","key":"{{ getenv "SECRET_ACAPI_KEY" }}"} diff --git a/7.2/config/.ssh/id_rsa.tmpl b/7.2/config/.ssh/id_rsa.tmpl index 969c101a..cc8fa3bb 100644 --- a/7.2/config/.ssh/id_rsa.tmpl +++ b/7.2/config/.ssh/id_rsa.tmpl @@ -1 +1 @@ -{{ getenv "SSH_PRIVATE_KEY" }} +{{ getenv "SECRET_SSH_PRIVATE_KEY" }} diff --git a/7.2/startup.sh b/7.2/startup.sh index 083fb325..e8997c9c 100755 --- a/7.2/startup.sh +++ b/7.2/startup.sh @@ -31,15 +31,15 @@ xdebug_enable() # Helper function to render configs from go templates using gomplate render_tmpl() { - local file=${1} + local file="${1}" local tmpl="${1}.tmpl" - if [[ ! -f ${tmpl} ]]; then + if [[ -f "${tmpl}" ]]; then + echo-debug "Rendering template: ${tmpl}..." + gomplate --file "${tmpl}" --out "${file}" + else echo-debug "Error: Template file not found: ${tmpl}" return 1 - else - echo-debug "Rendering tempalte: ${tmpl}..." - gompalte -f "${tmpl}" -o "${file}" fi } diff --git a/tests/.docksal/docksal.env b/tests/.docksal/docksal.env new file mode 100644 index 00000000..d525d907 --- /dev/null +++ b/tests/.docksal/docksal.env @@ -0,0 +1,12 @@ +DOCKSAL_STACK=node + +# Project secrets +SECRET_ACAPI_EMAIL="user@example.com" +SECRET_ACAPI_KEY="rSxVZN35bo4jTuncGS+CiKdmhxLPL0BaPuyOvf510sKb6c4ycxZsfFpC/vjJgaMvGvpKi06iHoqX" +SECRET_SSH_PRIVATE_KEY=" +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIMq4x61QtiUirrlN9AqlpniofwSUr674FhZoHGMsm2bDoAoGCCqGSM49 +AwEHoUQDQgAEKLfpo3ln+keZat/HYIG+g0H/Lt/+j0EUENHyGO8q2yqu02l833G8 +l2XRJT5kxNFRa3YGR0Jo1Knzyey8wFOOow== +-----END EC PRIVATE KEY----- +" diff --git a/tests/.docksal/docksal.yml b/tests/.docksal/docksal.yml new file mode 100644 index 00000000..193899e2 --- /dev/null +++ b/tests/.docksal/docksal.yml @@ -0,0 +1 @@ +version: "2.1" diff --git a/tests/test.bats b/tests/test.bats index c5ceffa5..e53c6b25 100755 --- a/tests/test.bats +++ b/tests/test.bats @@ -218,3 +218,43 @@ _healthcheck_wait () ### Cleanup ### docker rm -vf "$NAME" >/dev/null 2>&1 || true } + +@test "Check config templates" { + [[ $SKIP == 1 ]] && skip + + ### Setup ### + cd ../tests + echo "CLI_IMAGE=\"${IMAGE}\"" > .docksal/docksal-local.env + fin reset -f + + ### Tests ### + + # Load environment variables from docksal.env and confirm then are not empty + source .docksal/docksal.env + [[ "${SECRET_ACAPI_EMAIL}" != "" ]] + [[ "${SECRET_ACAPI_KEY}" != "" ]] + [[ "${SECRET_SSH_PRIVATE_KEY}" != "" ]] + + # Check Acquia Cloud API conf + run fin exec 'echo ${SECRET_ACAPI_EMAIL}' + [[ "${output}" != "" ]] + unset output + run fin exec 'echo ${SECRET_ACAPI_KEY}' + [[ "${output}" != "" ]] + unset output + run fin exec 'grep "${SECRET_ACAPI_EMAIL}" "$HOME/.acquia/cloudapi.conf" && grep "${SECRET_ACAPI_KEY}" "$HOME/.acquia/cloudapi.conf"' + [[ ${status} == 0 ]] + unset output + + # Check private SSH key + run fin exec 'echo ${SECRET_SSH_PRIVATE_KEY}' + [[ "${output}" != "" ]] + unset output + run fin exec 'echo "${SECRET_SSH_PRIVATE_KEY}" | diff $HOME/.ssh/id_rsa -' + [[ ${status} == 0 ]] + unset output + + ### Cleanup ### + fin rm -f + rm -f .docksal/docksal-local.env +} From 0d96fd6daace6d8bdd3365c13cf58ecb67d2e337 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 18:49:33 -0700 Subject: [PATCH 27/29] Added terminus auth:login in container startup --- 5.6/startup.sh | 15 ++++++++++++--- 7.0/startup.sh | 15 ++++++++++++--- 7.1/startup.sh | 15 ++++++++++++--- 7.2/startup.sh | 15 ++++++++++++--- 4 files changed, 48 insertions(+), 12 deletions(-) diff --git a/5.6/startup.sh b/5.6/startup.sh index e8997c9c..470679d4 100755 --- a/5.6/startup.sh +++ b/5.6/startup.sh @@ -13,7 +13,7 @@ echo-debug () [[ "$DEBUG" != 0 ]] && echo "$@" } -uid_gid_reset() +uid_gid_reset () { if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." @@ -22,14 +22,14 @@ uid_gid_reset() fi } -xdebug_enable() +xdebug_enable () { echo-debug "Enabling xdebug..." sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } # Helper function to render configs from go templates using gomplate -render_tmpl() +render_tmpl () { local file="${1}" local tmpl="${1}.tmpl" @@ -43,12 +43,21 @@ render_tmpl() fi } +terminus_login () +{ + echo-debug "Authenticating with Pantheon..." + terminus auth:login --machine-token="$SECRET_TERMINUS_TOKEN" +} + # Process templates # Private SSH key render_tmpl "$HOME_DIR/.ssh/id_rsa" # Acquia Cloud API config render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" +# Terminus authentication +[[ "$SECRET_TERMINUS_TOKEN" ]] && terminus_login + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.0/startup.sh b/7.0/startup.sh index e8997c9c..470679d4 100755 --- a/7.0/startup.sh +++ b/7.0/startup.sh @@ -13,7 +13,7 @@ echo-debug () [[ "$DEBUG" != 0 ]] && echo "$@" } -uid_gid_reset() +uid_gid_reset () { if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." @@ -22,14 +22,14 @@ uid_gid_reset() fi } -xdebug_enable() +xdebug_enable () { echo-debug "Enabling xdebug..." sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } # Helper function to render configs from go templates using gomplate -render_tmpl() +render_tmpl () { local file="${1}" local tmpl="${1}.tmpl" @@ -43,12 +43,21 @@ render_tmpl() fi } +terminus_login () +{ + echo-debug "Authenticating with Pantheon..." + terminus auth:login --machine-token="$SECRET_TERMINUS_TOKEN" +} + # Process templates # Private SSH key render_tmpl "$HOME_DIR/.ssh/id_rsa" # Acquia Cloud API config render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" +# Terminus authentication +[[ "$SECRET_TERMINUS_TOKEN" ]] && terminus_login + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.1/startup.sh b/7.1/startup.sh index e8997c9c..470679d4 100755 --- a/7.1/startup.sh +++ b/7.1/startup.sh @@ -13,7 +13,7 @@ echo-debug () [[ "$DEBUG" != 0 ]] && echo "$@" } -uid_gid_reset() +uid_gid_reset () { if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." @@ -22,14 +22,14 @@ uid_gid_reset() fi } -xdebug_enable() +xdebug_enable () { echo-debug "Enabling xdebug..." sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } # Helper function to render configs from go templates using gomplate -render_tmpl() +render_tmpl () { local file="${1}" local tmpl="${1}.tmpl" @@ -43,12 +43,21 @@ render_tmpl() fi } +terminus_login () +{ + echo-debug "Authenticating with Pantheon..." + terminus auth:login --machine-token="$SECRET_TERMINUS_TOKEN" +} + # Process templates # Private SSH key render_tmpl "$HOME_DIR/.ssh/id_rsa" # Acquia Cloud API config render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" +# Terminus authentication +[[ "$SECRET_TERMINUS_TOKEN" ]] && terminus_login + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset diff --git a/7.2/startup.sh b/7.2/startup.sh index e8997c9c..470679d4 100755 --- a/7.2/startup.sh +++ b/7.2/startup.sh @@ -13,7 +13,7 @@ echo-debug () [[ "$DEBUG" != 0 ]] && echo "$@" } -uid_gid_reset() +uid_gid_reset () { if [[ "$HOST_UID" != "$(id -u docker)" ]] || [[ "$HOST_GID" != "$(id -g docker)" ]]; then echo-debug "Updating docker user uid/gid to $HOST_UID/$HOST_GID to match the host user uid/gid..." @@ -22,14 +22,14 @@ uid_gid_reset() fi } -xdebug_enable() +xdebug_enable () { echo-debug "Enabling xdebug..." sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/ } # Helper function to render configs from go templates using gomplate -render_tmpl() +render_tmpl () { local file="${1}" local tmpl="${1}.tmpl" @@ -43,12 +43,21 @@ render_tmpl() fi } +terminus_login () +{ + echo-debug "Authenticating with Pantheon..." + terminus auth:login --machine-token="$SECRET_TERMINUS_TOKEN" +} + # Process templates # Private SSH key render_tmpl "$HOME_DIR/.ssh/id_rsa" # Acquia Cloud API config render_tmpl "$HOME_DIR/.acquia/cloudapi.conf" +# Terminus authentication +[[ "$SECRET_TERMINUS_TOKEN" ]] && terminus_login + # Docker user uid/gid mapping to the host user uid/gid [[ "$HOST_UID" != "" ]] && [[ "$HOST_GID" != "" ]] && uid_gid_reset From 862c588a477148a5d2c929ab4297ad4ebb1a4c8f Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Fri, 30 Mar 2018 20:08:01 -0700 Subject: [PATCH 28/29] Moved terminus from ~/.pantheon to ~/.terminus Terminus stores it's stuff in ~/.terminus, so we better install it there as well. --- 5.6/Dockerfile | 8 ++++---- 7.0/Dockerfile | 8 ++++---- 7.1/Dockerfile | 8 ++++---- 7.2/Dockerfile | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 72b27e47..52554d3d 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -279,7 +279,7 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 -ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ +ENV PATH=$PATH:$HOME/.terminus/vendor/bin \ TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH @@ -294,10 +294,10 @@ RUN set -xe; \ composer global require hirak/prestissimo >/dev/null; \ # Terminus # Installed in a dedicated directory to avoid dependency conflicts. - echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ - mkdir -p $HOME/.pantheon; \ + echo "\n"'PATH="$PATH:$HOME/.terminus/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.terminus; \ # Run in a subshell since we are doing directory switching - (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ + (cd $HOME/.terminus && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 55518c68..4ec97bf8 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -288,7 +288,7 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 -ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ +ENV PATH=$PATH:$HOME/.terminus/vendor/bin \ TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH @@ -303,10 +303,10 @@ RUN set -xe; \ composer global require hirak/prestissimo >/dev/null; \ # Terminus # Installed in a dedicated directory to avoid dependency conflicts. - echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ - mkdir -p $HOME/.pantheon; \ + echo "\n"'PATH="$PATH:$HOME/.terminus/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.terminus; \ # Run in a subshell since we are doing directory switching - (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ + (cd $HOME/.terminus && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 3edd8f4e..53b1d3ce 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -288,7 +288,7 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 -ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ +ENV PATH=$PATH:$HOME/.terminus/vendor/bin \ TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH @@ -303,10 +303,10 @@ RUN set -xe; \ composer global require hirak/prestissimo >/dev/null; \ # Terminus # Installed in a dedicated directory to avoid dependency conflicts. - echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ - mkdir -p $HOME/.pantheon; \ + echo "\n"'PATH="$PATH:$HOME/.terminus/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.terminus; \ # Run in a subshell since we are doing directory switching - (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ + (cd $HOME/.terminus && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache diff --git a/7.2/Dockerfile b/7.2/Dockerfile index cd7b4898..8f3968ed 100644 --- a/7.2/Dockerfile +++ b/7.2/Dockerfile @@ -294,7 +294,7 @@ RUN set -e; \ # Install Composer based dependencies ENV PATH=$PATH:$HOME/.composer/vendor/bin \ DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 -ENV PATH=$PATH:$HOME/.pantheon/vendor/bin \ +ENV PATH=$PATH:$HOME/.terminus/vendor/bin \ TERMINUS_VERSION=1.8.0 RUN set -xe; \ # Add composer bin directory to PATH @@ -309,10 +309,10 @@ RUN set -xe; \ composer global require hirak/prestissimo >/dev/null; \ # Terminus # Installed in a dedicated directory to avoid dependency conflicts. - echo "\n"'PATH="$PATH:$HOME/.pantheon/vendor/bin"' >> $HOME/.profile; \ - mkdir -p $HOME/.pantheon; \ + echo "\n"'PATH="$PATH:$HOME/.terminus/vendor/bin"' >> $HOME/.profile; \ + mkdir -p $HOME/.terminus; \ # Run in a subshell since we are doing directory switching - (cd $HOME/.pantheon && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ + (cd $HOME/.terminus && composer require pantheon-systems/terminus:${TERMINUS_VERSION}); \ # Cleanup composer clear-cache From eb3be001f93a062ea2c1aa620308cd8e31f4c5ef Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Apr 2018 16:38:13 -0700 Subject: [PATCH 29/29] Documented secrets [ci skip] --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index e689f1fc..63ab47e7 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,9 @@ This image(s) is part of the [Docksal](http://docksal.io) image library. - drush - registry_rebuild - coder-8.x + phpcs + - Acquia Cloud API commands - drupal console launcher + - terminus (Pantheon) - wp-cli - ruby - ruby @@ -75,3 +77,33 @@ cli ``` See [docs](https://docs.docksal.io/en/master/tools/xdebug) on using Xdebug for web and cli PHP debugging. + + +## Secrets and integrations + +`cli` can read secrets from environment variables and configure the respective integrations automatically at start. + +The recommended place store secrets in Docksal is the global `$HOME/.docksal/docksal.env` file on the host. From there, +secrets are injected into the `cli` container's environment. + +Below is the list of secrets currently supported. + +`SECRET_SSH_PRIVATE_KEY` + +Use to pass a private SSH key. The key is stored in `/home/docker/.ssh/id_rsa` inside `cli` and will be considered +by the SSH client **in addition** to the keys loaded in `docksal-ssh-agent` when establishing a SSH connection +from within `cli`. + +`SECRET_ACAPI_EMAIL` and `SECRET_ACAPI_KEY` + +Credentials used to authenticate with [Acquia Cloud API](https://docs.acquia.com/acquia-cloud/api). +Stored in `/home/docker/.acquia/cloudapi.conf` inside `cli`. + +Acquia Cloud API can be used via `ac-` group of commands in Drush. + +`SECRET_TERMINUS_TOKEN` + +Credentials used to authenticate [Terminus](https://pantheon.io/docs/terminus) with Pantheon. +Stored in `/home/docker/.terminus/` inside `cli`. + +Terminus is installed and available globally in `cli`.