/jahia-docker

Docker version of Jahia CMS installations

Primary LanguageShell

Jahia Docker

Jahia logo

About

The purpose of this project is to provide some "ready to use" Jahia installations using Docker.

It currently provides the following versions :

  • Digital Experience Manager Enterprise Distribution 7.1.2.1
  • Digital Experience Manager Enterprise Distribution 7.2.2.0

Technical details

This project requires :

  • 🐳 Docker (minimum version 17)
  • 🐋 Docker compose 3.5

New Jahia image will be based on the following official images from Docker Hub :

When running the docker-compose file, it will create 2 images :

  • jahia-x.x.x.x_mysql : MySQL image (pulled from Docker Hub)
  • jahia-x.x.x.x_tomcat : Jahia Tomcat image (created from the related Dockerfile)

The MySQL image is simply pulled from Docker Hub if it does not exist. We add an alternative my.cnf file on start because Jahia requires a higher max_allowed_packet. If not set, an error is thrown during the installation :

Value for max_allowed_packet is not enough, should be at least 100M)

The Jahia image is created from its Dockerfile, it just prepares the server for the Jahia installation, it will not be installed at build time!

Indeed installation process requires the MySQL database to be up, so the installation cannot be done on image build but has to be done on container run. Therefore a test is done on container start to check if Jahia is already installed, and install it only if needed.

3 Shell scripts are executed when running this container from the compose file, in the following order :

  1. wait.sh : wait for MySQL to be up
  2. install.sh : launch Jahia installation
  3. start.sh : start Jahia

The Jahia installation process is automated using an automatic installation script (IzPack XML file), it is passed as argument in the compose file (that file can be generated by running a fake Jahia installation on another machine using the GUI, then click "Generate an automatic installation script" at the end of the installation process).

ℹ️ It is also possible to use the Expect library to automate user input. I used it on first try and kept the .exp file just in case... To use it just add the required dependency (expect.x86_64) in the Jahia Dockerfile, adjust the CONF_FILE parameter in the docker-compose file and run expect /tmp/configuration.exp in the install.sh script instead of directly executing the JAR file).

Modules from the modules folder will automatically be deployed.

Tomcat is executed with JPDA support so it can be directly debugged from your local IDE.

Finally you should end up with 2 running containers :

  • jahia-x.x.x.x_mysql : MySQL container listening on port 3306 (exposed as 3306)
  • jahia-x.x.x.x_tomcat : Jahia container with Tomcat listening on port 8080 (exposed as 8080)

Instructions

Windows

  1. Get the project

    git clone git@github.com:Yann39/jahia-docker.git C:\Git\jahia-docker

  2. Modify the docker-compose file (docker-compose.yml) to match the version of Jahia you want to run

  3. Adjust settings in the corresponding installation file (passwords, e-mail addresses, etc.)

  4. Start your Docker engine

  5. Open a PowerShell command prompt

  6. Navigate to the project root directory

    cd C:\Git\jahia-docker

  7. Run compose up

    docker-compose up

  8. Open a browser and reach http://localhost:8080/site (in case of 'site' context installation)

⚠️ Once the images exist, if you change a configuration then you will have to rebuild the images using docker-compose build (you can also use docker-compose down to remove old containers) before running again docker-compose up.

Mac/Linux

Almost the same as Windows. Do not forget to change the volumes path in the docker-compose file.

License

Refer to the Jahia license.

Regarding the code I wrote, please refer to the WTFPL license :)