Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Hostmaster container upgradable. #15

Merged
merged 19 commits into from Mar 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6dc730f
Adding 3.7 release dockerfile.
jonpugh Sep 7, 2016
3495fdc
Add upgrade capability!
jonpugh Sep 8, 2016
d1c9d66
Merge branch 'master' into fixed-hostmaster-path
helmo Sep 13, 2016
fe1bef2
Merge branch 'master' into fixed-hostmaster-path
helmo Nov 10, 2016
154c4d1
Merge branch 'master' into fixed-hostmaster-path
jonpugh Mar 23, 2017
cac54a7
Removing redundant messaging.
jonpugh Mar 23, 2017
e48bc42
Remove install of provision in upstream repo. It's the job of tagged …
jonpugh Mar 23, 2017
e9f7638
Tagging version of registry rebuild.
jonpugh Mar 23, 2017
7b0da79
Install provision in entrypoint script, using $AEGIR_VERSION instead …
jonpugh Mar 23, 2017
84b09a6
Enable hosting queued. Accidentally removed in a merge fix.
jonpugh Mar 23, 2017
50c8cfb
Fix the provision destination so other containers can replace it.
jonpugh Mar 23, 2017
faf1424
Only download provision if it does not exist at /var/aegir/.drush/com…
jonpugh Mar 23, 2017
b05ad61
Build platform and get provision in tagged image.
jonpugh Mar 23, 2017
797d5a8
When checking for existing hostmaster site, double check if upgrade p…
jonpugh Mar 23, 2017
9c4cb59
Put back the hostmaster-migrate command, accidentally deleted.
jonpugh Mar 23, 2017
dd43fc4
Adding a drush uli call back to the end of the entrypoint.
jonpugh Mar 23, 2017
083050c
Fixing Aegir 3.7 dockerfile.
jonpugh Mar 23, 2017
6e4a29f
Adding Dockerfiles for versions 3.9 through 3.10
jonpugh Mar 23, 2017
a78032f
Ading docker compose for testing, using that in .travis.yml.
jonpugh Mar 23, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -49,16 +49,7 @@ before_install:

# First build stock image, and one for own user.
- sudo docker build --rm -t aegir/hostmaster .
- sudo docker build --rm -t aegir/hostmaster:own --build-arg AEGIR_UID=1000 .

# Then build local image. Only difference is /var/aegir is volume.
- sudo docker build --rm -t aegir/hostmaster:local -f Dockerfile-local .

# Then build test image. Only difference is CMD defaults to run-tests.sh
- sudo docker build --rm -t aegir/hostmaster:test -f Dockerfile-test .

# Go to tests/travis folder. Docker-compose files are in there.
- cd tests/travis
script:

# Launch docker-compose.yml file within tests repo.
@@ -59,12 +59,13 @@ RUN mkdir /var/log/aegir
RUN chown aegir:aegir /var/log/aegir
RUN echo 'Hello, Aegir.' > /var/log/aegir/system.log

# Install Provision for all.
ENV PROVISION_VERSION 7.x-3.x
RUN mkdir -p /usr/share/drush/commands
RUN drush dl --destination=/usr/share/drush/commands provision-$PROVISION_VERSION -y

RUN drush dl --destination=/usr/share/drush/commands registry_rebuild-7.x -y
# Don't install provision. Downstream tags will do this with the right version.
## Install Provision for all.
#ENV PROVISION_VERSION 7.x-3.x
#RUN mkdir -p /usr/share/drush/commands
#RUN drush dl --destination=/usr/share/drush/commands provision-$PROVISION_VERSION -y
ENV REGISTRY_REBUILD_VERSION 7.x-2.5
RUN drush dl --destination=/usr/share/drush/commands registry_rebuild-$REGISTRY_REBUILD_VERSION -y

USER aegir

@@ -75,9 +76,9 @@ RUN mkdir /var/aegir/.drush
ENV AEGIR_CLIENT_EMAIL aegir@aegir.docker
ENV AEGIR_CLIENT_NAME admin
ENV AEGIR_PROFILE hostmaster
ENV PROVISION_VERSION 7.x-3.x
ENV AEGIR_VERSION 7.x-3.x

# We do not want a dynamic path for hostmaster, as the upgrade process for Docker is to replace the container.
# Must be fixed across versions so we can upgrade containers.
ENV AEGIR_HOSTMASTER_ROOT /var/aegir/hostmaster

WORKDIR /var/aegir
@@ -95,4 +96,4 @@ VOLUME /var/aegir

# docker-entrypoint.sh waits for mysql and runs hostmaster install
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["drush @hostmaster hosting-queued"]
CMD ["drush @hostmaster hosting-queued"]
@@ -0,0 +1,33 @@
version: '2'

services:

hostmaster:
image: aegir/hostmaster
command:
- run-tests.sh
ports:
- 80:80
hostname: aegir.local.computer
links:
- database
depends_on:
- database
environment:
VIRTUAL_HOST: aegir.local.computer
MYSQL_ROOT_PASSWORD: strongpassword
tty: true
stdin_open: true

database:
image: mariadb

# Disable logging for this container, for testing environment.
logging:
driver: "none"
environment:
MYSQL_ROOT_PASSWORD: strongpassword

# These options are needed for Drupal 7.50 and up for full UTF-8 support.
# See https://www.drupal.org/node/2754539
command: mysqld --innodb-large-prefix --innodb-file-format=barracuda --innodb-file-per-table
@@ -6,6 +6,7 @@ echo 'ÆGIR | Hello! '
echo 'ÆGIR | When the database is ready, we will install Aegir with the following options:'
echo "ÆGIR | -------------------------"
echo "ÆGIR | Hostname: $HOSTNAME"
echo "ÆGIR | Version: $AEGIR_VERSION"
echo "ÆGIR | Database Host: $AEGIR_DATABASE_SERVER"
echo "ÆGIR | Makefile: $AEGIR_MAKEFILE"
echo "ÆGIR | Profile: $AEGIR_PROFILE"
@@ -23,6 +24,16 @@ ls -lah /var/aegir/.drush
echo "ÆGIR | -------------------------"


if [ ! -d '/var/aegir/.drush/commands/provision' ]; then
echo "ÆGIR | Installing provision $AEGIR_VERSION ..."
drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y
else
echo "ÆGIR | Provision found. Moving on."
fi

echo "ÆGIR | -------------------------"


# Returns true once mysql can connect.
# Thanks to http://askubuntu.com/questions/697798/shell-script-how-to-run-script-after-mysql-is-ready
mysql_ready() {
@@ -35,14 +46,29 @@ do
echo "ÆGIR | Waiting for database host '$AEGIR_DATABASE_SERVER' ..."
done

echo "========================="
echo "Hostname: $HOSTNAME"
echo "Database Host: $AEGIR_DATABASE_SERVER"
echo "Makefile: $AEGIR_MAKEFILE"
echo "Profile: $AEGIR_PROFILE"
echo "Version: $AEGIR_VERSION"
echo "Client Name: $AEGIR_CLIENT_NAME"
echo "Client Email: $AEGIR_CLIENT_EMAIL"
echo "ÆGIR | Database active! Checking for Hostmaster Install..."

# Check if @hostmaster is already set and accessible.
drush @hostmaster vget site_name > /dev/null 2>&1
if [ ${PIPESTATUS[0]} == 0 ]; then
echo "ÆGIR | Hostmaster site found... Checking for upgrade platform..."

# Only upgrade if site not found in current containers platform.
if [ ! -d "$AEGIR_HOSTMASTER_ROOT/sites/$HOSTNAME" ]; then
echo "ÆGIR | Site not found at $AEGIR_HOSTMASTER_ROOT/sites/$HOSTNAME, upgrading!"
echo "ÆGIR | Running 'drush @hostmaster hostmaster-migrate $HOSTNAME $AEGIR_HOSTMASTER_ROOT -y'...!"
drush @hostmaster hostmaster-migrate $HOSTNAME $AEGIR_HOSTMASTER_ROOT -y
else
echo "ÆGIR | Site already found at $AEGIR_HOSTMASTER_ROOT/sites/$HOSTNAME"
fi


# if @hostmaster is not accessible, install it.
else
echo "ÆGIR | Hostmaster not found. Continuing with install!"
fi

sleep 3

echo "-------------------------"
echo "Running: drush cc drush"
@@ -64,18 +90,18 @@ drush hostmaster-install -y --strict=0 $HOSTNAME \
# Exit on the first failed line.
set -e

echo "ÆGIR | -------------------------"
echo "ÆGIR | Enabling Hosting Task Queue..."
echo "ÆGIR | Running 'drush cc drush' ... "
drush cc drush

echo "ÆGIR | Enabling hosting queued..."
drush @hostmaster en hosting_queued -y

echo "ÆGIR | -------------------------"
echo "ÆGIR | Hostmaster Log In Link: "
drush @hostmaster uli
ls -lah /var/aegir

echo "ÆGIR | Running: drush cc drush "
drush cc drush
# We need a ULI here because aegir only outputs one on install, not on subsequent verify.
echo "ÆGIR | Getting a new login link ... "
drush @hostmaster uli

# Run whatever is the Docker CMD.
echo "ÆGIR | -------------------------"
echo "ÆGIR | Running $@ ..."
`$@`
# Run whatever is the Docker CMD, typically drush @hostmaster hosting-queued
echo "ÆGIR | Running '$@' ..."
`$@`
@@ -0,0 +1,13 @@
FROM aegir/hostmaster

ENV AEGIR_VERSION 7.x-3.10
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION

ENV AEGIR_HOSTMASTER_ROOT /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION

# Prepare next hostmaster platform.
# This is done in the Dockerfile so that we can ship upgrades with the codebase, then run hostmaster-migrate when a new
# version is detected.

RUN drush make $AEGIR_MAKEFILE $AEGIR_HOSTMASTER_ROOT
RUN drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y
@@ -1,22 +1,13 @@
FROM aegir/hostmaster

ENV AEGIR_CLIENT_EMAIL aegir@aegir.docker
ENV AEGIR_CLIENT_NAME admin
ENV AEGIR_PROFILE hostmaster
ENV AEGIR_VERSION 7.x-3.6
ENV PROVISION_VERSION 7.x-3.6

USER root

# Remove stock provision, install provision-$PROVISION_VERSION
RUN rm -rf /usr/share/drush/commands/provision
RUN drush dl --destination=/usr/share/drush/commands provision-$PROVISION_VERSION -y
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION

USER aegir
ENV AEGIR_HOSTMASTER_ROOT /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION

# For Releases:
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION
# Prepare next hostmaster platform.
# This is done in the Dockerfile so that we can ship upgrades with the codebase, then run hostmaster-migrate when a new
# version is detected.

# Prepare hostmaster platform.
RUN drush make $AEGIR_MAKEFILE /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION
RUN drush cc drush
RUN drush make $AEGIR_MAKEFILE $AEGIR_HOSTMASTER_ROOT
RUN drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y
@@ -0,0 +1,13 @@
FROM aegir/hostmaster

ENV AEGIR_VERSION 7.x-3.7
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION

ENV AEGIR_HOSTMASTER_ROOT /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION

# Prepare next hostmaster platform.
# This is done in the Dockerfile so that we can ship upgrades with the codebase, then run hostmaster-migrate when a new
# version is detected.

RUN drush make $AEGIR_MAKEFILE $AEGIR_HOSTMASTER_ROOT
RUN drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y
@@ -0,0 +1,13 @@
FROM aegir/hostmaster

ENV AEGIR_VERSION 7.x-3.8
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION

ENV AEGIR_HOSTMASTER_ROOT /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION

# Prepare next hostmaster platform.
# This is done in the Dockerfile so that we can ship upgrades with the codebase, then run hostmaster-migrate when a new
# version is detected.

RUN drush make $AEGIR_MAKEFILE $AEGIR_HOSTMASTER_ROOT
RUN drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y
@@ -0,0 +1,13 @@
FROM aegir/hostmaster

ENV AEGIR_VERSION 7.x-3.9
ENV AEGIR_MAKEFILE http://cgit.drupalcode.org/provision/plain/aegir-release.make?h=$AEGIR_VERSION

ENV AEGIR_HOSTMASTER_ROOT /var/aegir/$AEGIR_PROFILE-$AEGIR_VERSION

# Prepare next hostmaster platform.
# This is done in the Dockerfile so that we can ship upgrades with the codebase, then run hostmaster-migrate when a new
# version is detected.

RUN drush make $AEGIR_MAKEFILE $AEGIR_HOSTMASTER_ROOT
RUN drush dl provision-$AEGIR_VERSION --destination=/var/aegir/.drush/commands -y