Public | Automated Build

Last pushed: a year ago
Short Description
Image for the AIRE application's kiosk part (orchestra & choir planning).
Full Description

Theater project's Docker setup


Install Docker and Docker Compose

After installing the Docker, in case of not having to run commands using sudo,
add your user to docker group. sudo usermod -aG docker yourusername. Log out
and log in into your account again to make an effect after running this command.

NB! Make sure that your docker version is at least 1.10.0 and docker-compose
version at least 1.6.0.


Add the following hosts to your hosts file:

  • aire.l (main AIRE application);
  • kiosk.l (planning for orchestras and choirs);
  • plaan.l (calendar application for all employees);
  • pma.l (phpMyAdmin console);
  • es.l (dashboard for ElasticSearch is at http://es.l:9200/_plugin/head/);
  • mailcatcher.l (catches all e-mails sent by the application);

Setting up aire, kiosk and plaan projects

The projects should be located under [project name]/data/http, where [project name]
should be either aire, kiosk or plaan. If you already have the projects set up on
your host machine, you could symlink them to the according folders, if not, you
could just set them up in the directories mentioned earlier.
Symlink example:

# (This example presumes you have all your projects in /home/user/projects/)
$ cd /home/user/projects/docker-setup/aire/data
$ ln -s ../../../aire http

PS! Do not use ~ in here !!!

Next you will have to run composer install in both of the projects' containers
(aire and kiosk). We'll go over how to access the containers later down the line.

PS! If you are not starting fresh(you have the projects already set up on your host and
you're just moving/renaming directories), you need to delete app/config/parameters.yml
files in aire and kiosk projects before running composer install.

Into the plaan project's params.php you need enter the following:
'db_host' => getenv('ENV_DB_HOST'),
'db_user' => getenv('ENV_DB_USER'),
'db_pass' => getenv('ENV_DB_PASS'),
'db_aire_name' => 'aire',
'db_estonia_name' => 'estonia',
'kiosk_host' => getenv('KIOSK_HOST'),
'plaan_host' => getenv('PLAAN_HOST'),
'aire_host' => getenv('AIRE_HOST'),

Booting and accessing the containers

docker-compose up is what you run in this project's root dir(.../docker-setup) to
boot up the containers(add the flag -d if you want to run them in the background)

To enter a specific container, ie Aire's container, you need to run

docker-compose run --rm aire bash

(adding --rm to run will remove the container
after you log out, otherwise you soon end up with many useless leftover-containers).
Similarly you can enter the other containers(services) such as kiosk, plaan, db,
es.. To see all of the services and their configuration open docker-compose.yml.

Be sure to run npm install the first time you enter the containers aswell.
This step can not be automated because during the building of the container data
volumes are not yet mounted and there is no packages.json file in /data/http directory.
Data volumes are mounted during the creation of the containers.

Database reset

When first setting up your project you also need to run bin/ dev in
aire's container in the data/http directory. This sets up the aire database.
In addition to that, you also need to set up the estonia database (look below).
The reset script is also useful later on if you manage to mess up your database
and/or migrations. When that happens, then just rerun bin/ dev in aire's
container (bear in mind you lose all the data in your aire database, you only
keep the data that is generated by the fixtures)

Importing database estonia

First you need to get an sql dump of the database, ask a fellow coworker to share
it with you. When you have a copy of the database, move it to your computer's
/tmp directory and make sure the dump is named opera-estonia.sql. Next navigate
to your docker-setup directory and if you have not done so already, run
docker-composer up (remember the -d flag, if you want to run the containers in
the background). When the containers are running, create a new database named
estonia (check below) and run the next command to import the database:

docker-compose run --rm db sh -c 'exec mysql -h"$DB_PORT_3306_TCP_ADDR" -P"$DB_PORT_3306_TCP_PORT" -uroot -p"$DB_ENV_MYSQL_ROOT_PASSWORD" estonia < /tmp/opera-estonia.sql'

Creating a new database

By this point you should already be running your containers so open your browser
and go to pma.l, log in using root root, click Databases, enter the name
estonia, choose utf8_general_ci from the Collation dropdown and click Create.

Manual deployment

We do have CI set up, but when you need to deploy new code manually (for example
to the beta server), you can do that in docker-setup project's root directory
from your host machine (where you run the docker-compse commands). All that has
to be done, is to enter bin/ and follow the instructions on screen
(pay attention, you also have the option to deploy to the live servers).

Blackfire profiling

If you'd like to profile AIRE using Blackfire, you must set up the
tokens and ids (you can get them from the installation instructions)
as environment variables in the host machine. Requests must be made using the
IP address rather than the host. The
following illustrates this:

 $ docker-compose up -d
 $ docker ps | grep aire
 50da766f2693        dockertheater_aire   [...]
 $ docker exec -it 50da766f2693 bash -c "cat /etc/hosts" | grep 50da766f2693    50da766f2693
 $ docker run -it --rm \
     blackfire/blackfire \
     blackfire curl ''
Docker Pull Command
Source Repository