Apps hosted on GIT and mounted as volumes

Applications based on CMS such as Wordpress and Drupal are not easy to pack into a docker container, as the user is allowed to manage them with web panel.

The solution for this situation could be to:

1. Configuring environment globally

The general concept is to have a single organization on github, bitbucket, gogs or other git server, and multiple repositories in it. But it is of course possible to have multiple and leave some of the global fields empty.

Just play with those environment variables in the .env file:

# git deployment specification for applications

Remember, that all of those variables can be later overwritten by single repository configuration.

2. Making application manageable by environment

In ./apps/repos-enabled create a bash script, it’s actually not a script, but a configuration in shell syntax. Variables are inherited from .env file, so you can overwrite them there per-repository.


export GIT_PROJECT_NAME=some-app
export GIT_PROJECT_DIR=some-app
export WRITABLE_DIRS="files store cache"

# Install the assets
post_update () {
    echo "I'm a post_update hook, i'm in $1 directory"

Good practice tip: It is good to have a read-only deployment user, to not leak your passwords with write-access

3. Deploying

Volume-based applications are deployed during make deployment_pre, when deploying with Ansible. To trigger a manual deploy, please check:

# deploy all git-volume-based applications
make update_all

# deploy single application
make update APP_NAME=some-app

What is the update command doing?

The update command is cloning the repository IF IT DOES NOT EXIST, in other case it is doing a git pull.