Dockerized Upgrade

Requirements

Deployment

On the production calendar server

whoami && pwd
calendar
/home/calendar
docker exec calendar.service /bin/cat /var/www/calendar_server/Specific/config.php > ./config.php
docker exec calendar.service /bin/cat /var/www/calendar_server/Specific/config.system.php > ./config.system.php

On the build server

scp calendar@your.calendar.server.example.org:config.php ./resources
scp calendar@your.calendar.server.example.org:config.system.php ./resources
RUN curl -LO https://github.com/fruux/Baikal/releases/download/0.4.6/baikal-0.4.6.zip && unzip baikal-0.4.6.zip && \
    rm -f baikal-0.4.6.zip
# The Baïkal administration wizard creates these two config files when first run.  Preserve them
# and save them to the resources/ directory.  These files must be preserved for upgrades.
# Both files are already in the .gitignore file.
#
# To use them:  uncomment these two lines and copy them to the Specific/ directory, per the
# Baïkal upgrade instructions at:  http://sabre.io/baikal/upgrade/
COPY resources/config.php /var/www/calendar_server/Specific/
COPY resources/config.system.php /var/www/calendar_server/Specific/
imageName="yourdockerhubname/calendar"; \
docker build -t "$imageName" --rm=true . && \
docker push "$imageName"

On the production calendar server

docker stop calendar.service
docker rm calendar.service
docker pull "yourdockerhubname/calendar"
docker run --name "calendar.service" \
    --privileged=true \
    -h "calendar" \
    -e "CONTAINER_DOMAIN_NAME=yourdomain.name" \
    -v "$(pwd)/db":"/var/www/calendar_server/" \
    -p "8800:80" \
    -d "yourdockerhubname/calendar"
docker ps -a
CONTAINER ID        IMAGE                        COMMAND             CREATED             STATUS              PORTS                  NAMES
83d209fefa91        yourdockerhubname/calendar   "/runapache2"       2 minutes ago       Up 2 minutes        0.0.0.0:8800->80/tcp   calendar.service

Implementation notes

The config.sys and config.system.php files

These files are updated on every new installation. They contain important, site-specific data. The most important datum is the BAIKAL_ADMIN_PASSWORDHASH used for authentication. Keep the configuration files in a safe place or delete them after building the image.

Help! I deployed the upgrade without preserving the configuration files!

First: don't panic.

Log on to the admin console as soon as the Baïkal instance is running and follow the configuration wizard. Only the BAIKAL_ADMIN_PASSWORDHASH configuration files are changed. The users, calendars, and address books database is intact, and will become available as soon as the configuration is complete.


Comments