Skip to content

Commit

Permalink
Merge pull request #83 from docksal/develop
Browse files Browse the repository at this point in the history
Release 2.5.0
  • Loading branch information
lmakarov authored Sep 21, 2018
2 parents 3e9dffd + a7d45db commit d6b6482
Show file tree
Hide file tree
Showing 28 changed files with 355 additions and 164 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ install:
script:
# Build the base image
- cd ${TRAVIS_BUILD_DIR}/${VERSION}
- travis_retry make && make test # Retry builds, as pecl.php.net tends to time out often
- travis_retry make # Retry builds, as pecl.php.net tends to time out often
- make test
# Build the Cloud9 flavor
- cd ${TRAVIS_BUILD_DIR}/cloud9
- travis_retry make && make test
- travis_retry make
- make test

after_success:
- docker image ls
Expand Down
33 changes: 17 additions & 16 deletions 5.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ RUN set -xe; \
# Cleanup
apt-get clean; rm -rf /var/lib/apt/lists/*

# Set timezone and locale
# Set en_US.UTF-8 as the default locale
RUN set -xe; \
dpkg-reconfigure locales; \
locale-gen C.UTF-8; \
/usr/sbin/update-locale LANG=C.UTF-8
ENV LC_ALL C.UTF-8
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LC_ALL en_US.utf8

# Enable additional repos
RUN set -xe; \
Expand Down Expand Up @@ -195,6 +193,8 @@ RUN set -xe; \
;\
pecl update-channels; \
pecl install >/dev/null </dev/null \
# apcu-4.0.11 is the last version with php5 support
apcu-4.0.11 \
gnupg \
imagick \
memcache \
Expand All @@ -204,6 +204,7 @@ RUN set -xe; \
xdebug-2.5.5 \
;\
docker-php-ext-enable \
apcu \
gnupg \
imagick \
memcache \
Expand All @@ -222,7 +223,6 @@ RUN set -xe; \
ENV COMPOSER_VERSION=1.6.3 \
DRUSH_VERSION=8.1.16 \
DRUSH_LAUNCHER_VERSION=0.6.0 \
DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \
DRUPAL_CONSOLE_LAUNCHER_VERSION=1.7.0 \
WPCLI_VERSION=1.5.0 \
BLACKFIRE_VERSION=1.15.0 \
Expand Down Expand Up @@ -255,23 +255,25 @@ RUN set -xe; \
# Cleanup
apt-get clean; rm -rf /var/lib/apt/lists/*; \
# bundler
gem install bundler >/dev/null
# Home directory for bundle installs
ENV BUNDLE_PATH .bundler
gem install bundler >/dev/null; \
# Have bundler install gems locally (./.bundle) by default
echo "\n""export BUNDLE_PATH=.bundle" >> /home/docker/.profile

# All further RUN commands will run as the "docker" user
USER docker
ARG HOME=/home/docker

# PHP tools (installed as user)
ENV PATH=$PATH:$HOME/.composer/vendor/bin \
MG_CODEGEN_VERSION=1.10 \
ENV MG_CODEGEN_VERSION=1.10 \
TERMINUS_VERSION=1.8.1
RUN set -xe; \
\
# Set drush8 as a global fallback for Drush Launcher
echo "\n""export DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8" >> $HOME/.profile; \
# Composer based dependencies
# Add composer bin directory to PATH
echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \
echo "\n"'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \
# Reload updated PATH from profile to make composer/drush/etc. visible below
. $HOME/.profile; \
# Install cgr to use it in-place of `composer global require`
composer global require consolidation/cgr >/dev/null; \
# Composer parallel install plugin
Expand Down Expand Up @@ -311,9 +313,8 @@ USER root
# Copy mhsendmail binary from stage 1
COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail
# Copy configs and scripts
COPY --chown=docker:docker config/.acquia $HOME/.acquia
COPY --chown=docker:docker config/.drush $HOME/.drush
COPY --chown=docker:docker config/.ssh $HOME/.ssh
COPY --chown=docker:docker config/.drush /home/docker/.drush
COPY --chown=docker:docker config/.ssh /home/docker/.ssh
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY startup.sh /opt/startup.sh
COPY healthcheck.sh /opt/healthcheck.sh
Expand Down
1 change: 0 additions & 1 deletion 5.6/config/.acquia/cloudapi.conf.tmpl

This file was deleted.

2 changes: 1 addition & 1 deletion 5.6/config/.ssh/id_rsa.tmpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ getenv "SECRET_SSH_PRIVATE_KEY" }}
{{ getenv "SECRET_SSH_PRIVATE_KEY" | base64.Decode }}
1 change: 1 addition & 0 deletions 5.6/config/php/zz-php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ php_value[memory_limit] = 256M
php_value[max_execution_time] = 300
php_value[upload_max_filesize] = 500M
php_value[post_max_size] = 500M
php_value[max_input_vars] = 2000
2 changes: 2 additions & 0 deletions 5.6/php-modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[PHP Modules]
apc
apcu
bcmath
blackfire
bz2
Expand Down
62 changes: 47 additions & 15 deletions 5.6/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ uid_gid_reset ()
xdebug_enable ()
{
echo-debug "Enabling xdebug..."
sudo ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/
ln -s /opt/docker-php-ext-xdebug.ini /usr/local/etc/php/conf.d/
}

add_ssh_key ()
{
echo-debug "Adding a private SSH key from SECRET_SSH_PRIVATE_KEY..."
render_tmpl "$HOME_DIR/.ssh/id_rsa"
chmod 0600 "$HOME_DIR/.ssh/id_rsa"
}

# Helper function to render configs from go templates using gomplate
Expand Down Expand Up @@ -62,15 +69,30 @@ convert_secrets ()
done
}

# Pantheon authentication
# Acquia Cloud API login
acquia_login ()
{
echo-debug "Authenticating with Acquia..."
# This has to be done using the docker user via su to load the user environment
# Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user
local command="drush ac-api-login --email='${ACAPI_EMAIL}' --key='${ACAPI_KEY}' --endpoint='https://cloudapi.acquia.com/v1' && drush ac-site-list"
local output=$(su -l docker -c "${command}" 2>&1)
if [[ $? != 0 ]]; then
echo-debug "ERROR: Acquia authentication failed."
echo
echo "$output"
echo
fi
}

# Pantheon (terminus) login
terminus_login ()
{
echo-debug "Authenticating with Pantheon..."
# This has to be done using the docker user via su to load the user environment
# Note: 'su -' = 'su -l' = 'su --login'
local output
output=$(sudo su - docker -c "terminus auth:login --machine-token='${TERMINUS_TOKEN}'" 2>&1)
#>/dev/null 2>&1
# Note: Using 'su -l' to initiate a login session and have .profile sourced for the docker user
local command="terminus auth:login --machine-token='${TERMINUS_TOKEN}'"
local output=$(su -l docker -c "${command}" 2>&1)
if [[ $? != 0 ]]; then
echo-debug "ERROR: Pantheon authentication failed."
echo
Expand All @@ -79,12 +101,17 @@ terminus_login ()
fi
}

# Process templates
# Private SSH key
render_tmpl "$HOME_DIR/.ssh/id_rsa"
chmod 0600 "$HOME_DIR/.ssh/id_rsa"
# Acquia Cloud API config
render_tmpl "$HOME_DIR/.acquia/cloudapi.conf"
# Git settings
git_settings ()
{
# These must be run as the docker user
echo-debug "Configuring git..."
gosu docker git config --global user.email "${GIT_USER_EMAIL}"
gosu docker git config --global user.name "${GIT_USER_NAME}"
}

# Inject a private SSH key if provided
[[ "$SECRET_SSH_PRIVATE_KEY" != "" ]] && add_ssh_key

# Convert all Environment Variables Prefixed with SECRET_
convert_secrets
Expand All @@ -103,9 +130,11 @@ chown "${HOST_UID:-1000}:${HOST_GID:-1000}" -R "$HOME_DIR"
# We apply a fix/workaround for this at startup (non-recursive).
chown "${HOST_UID:-1000}:${HOST_GID:-1000}" /var/www

# Automatically authenticate with Pantheon in Terminus token is present
# Note: this has to happen after th home directory permissions are reset,
# otherwise the docker user may not have write access to /home/.terminus, where the auth session data is stored.
# These have to happen after the home directory permissions are reset,
# otherwise the docker user may not have write access to /home/docker, where the auth session data is stored.
# Acquia Cloud API config
[[ "$ACAPI_EMAIL" != "" ]] && [[ "$ACAPI_KEY" != "" ]] && acquia_login
# Automatically authenticate with Pantheon if Terminus token is present
[[ "$TERMINUS_TOKEN" != "" ]] && terminus_login

# If crontab file is found within project add contents to user crontab file.
Expand All @@ -114,6 +143,9 @@ if [[ -f ${PROJECT_ROOT}/.docksal/services/cli/crontab ]]; then
cat ${PROJECT_ROOT}/.docksal/services/cli/crontab | crontab -u docker -
fi

# Apply git settings
[[ "$GIT_USER_EMAIL" != "" ]] && [[ "$GIT_USER_NAME" != "" ]] && git_settings

# Initialization steps completed. Create a pid file to mark the container as healthy
echo-debug "Preliminary initialization completed."
touch /var/run/cli
Expand Down
32 changes: 16 additions & 16 deletions 7.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ RUN set -xe; \
# Cleanup
apt-get clean; rm -rf /var/lib/apt/lists/*

# Set timezone and locale
# Set en_US.UTF-8 as the default locale
RUN set -xe; \
dpkg-reconfigure locales; \
locale-gen C.UTF-8; \
/usr/sbin/update-locale LANG=C.UTF-8
ENV LC_ALL C.UTF-8
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
ENV LC_ALL en_US.utf8

# Enable additional repos
RUN set -xe; \
Expand Down Expand Up @@ -201,6 +199,7 @@ RUN set -xe; \
;\
pecl update-channels; \
pecl install >/dev/null </dev/null \
apcu \
gnupg \
imagick \
# Use memcached (not memcache) for PHP 7.x
Expand All @@ -211,6 +210,7 @@ RUN set -xe; \
xdebug \
;\
docker-php-ext-enable \
apcu \
gnupg \
imagick \
memcached \
Expand All @@ -230,7 +230,6 @@ RUN set -xe; \
ENV COMPOSER_VERSION=1.6.3 \
DRUSH_VERSION=8.1.16 \
DRUSH_LAUNCHER_VERSION=0.6.0 \
DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8 \
DRUPAL_CONSOLE_LAUNCHER_VERSION=1.7.0 \
WPCLI_VERSION=1.5.0 \
BLACKFIRE_VERSION=1.15.0 \
Expand Down Expand Up @@ -263,23 +262,25 @@ RUN set -xe; \
# Cleanup
apt-get clean; rm -rf /var/lib/apt/lists/*; \
# bundler
gem install bundler >/dev/null
# Home directory for bundle installs
ENV BUNDLE_PATH .bundler
gem install bundler >/dev/null; \
# Have bundler install gems locally (./.bundle) by default
echo "\n""export BUNDLE_PATH=.bundle" >> /home/docker/.profile

# All further RUN commands will run as the "docker" user
USER docker
ARG HOME=/home/docker

# PHP tools (installed as user)
ENV PATH=$PATH:$HOME/.composer/vendor/bin \
MG_CODEGEN_VERSION=1.10 \
ENV MG_CODEGEN_VERSION=1.10 \
TERMINUS_VERSION=1.8.1
RUN set -xe; \
\
# Set drush8 as a global fallback for Drush Launcher
echo "\n""export DRUSH_LAUNCHER_FALLBACK=/usr/local/bin/drush8" >> $HOME/.profile; \
# Composer based dependencies
# Add composer bin directory to PATH
echo "\n"'PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \
echo "\n"'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> $HOME/.profile; \
# Reload updated PATH from profile to make composer/drush/etc. visible below
. $HOME/.profile; \
# Install cgr to use it in-place of `composer global require`
composer global require consolidation/cgr >/dev/null; \
# Composer parallel install plugin
Expand Down Expand Up @@ -319,9 +320,8 @@ USER root
# Copy mhsendmail binary from stage 1
COPY --from=mhbuild /go/bin/mhsendmail /usr/local/bin/mhsendmail
# Copy configs and scripts
COPY --chown=docker:docker config/.acquia $HOME/.acquia
COPY --chown=docker:docker config/.drush $HOME/.drush
COPY --chown=docker:docker config/.ssh $HOME/.ssh
COPY --chown=docker:docker config/.drush /home/docker/.drush
COPY --chown=docker:docker config/.ssh /home/docker/.ssh
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY startup.sh /opt/startup.sh
COPY healthcheck.sh /opt/healthcheck.sh
Expand Down
1 change: 0 additions & 1 deletion 7.0/config/.acquia/cloudapi.conf.tmpl

This file was deleted.

2 changes: 1 addition & 1 deletion 7.0/config/.ssh/id_rsa.tmpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{ getenv "SECRET_SSH_PRIVATE_KEY" }}
{{ getenv "SECRET_SSH_PRIVATE_KEY" | base64.Decode }}
1 change: 1 addition & 0 deletions 7.0/config/php/zz-php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ php_value[memory_limit] = 256M
php_value[max_execution_time] = 300
php_value[upload_max_filesize] = 500M
php_value[post_max_size] = 500M
php_value[max_input_vars] = 2000
1 change: 1 addition & 0 deletions 7.0/php-modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[PHP Modules]
apcu
bcmath
blackfire
bz2
Expand Down
Loading

0 comments on commit d6b6482

Please sign in to comment.