Skip to main content
Version: Next

Docker

The docker image contains the following components:

  • agosense.symphony application
  • Java environment
  • PostgreSQL database

The docker image is published through docker hub https://hub.docker.com/r/agosense/symphony/tags , the image name is agosense/symphony and tags are created for each release.

Volumes#

Use a volume to persist the content of the database independent of the docker container. The volume target is /home/db/data.

An additional volume is advisable for the target /home/app/conf to make sure configuration changes are also persisted outside the container.

Environment Variables#

NameDescription
NUCLEUS_HTTP_ENABLEDUsed to enable the plain http port, e.g. when operating behind a reverse proxy that enforces https towards users
SYMPHONY_JAVA_VM_OPTIONSUsed to apply custom Java VM Options

Docker Compose Configuration Example#

version: '3.8'services:  symphony:    container_name: symphony    image: agosense/symphony:<version>    environment:      - SYMPHONY_JAVA_VM_OPTIONS=-Xms1G -Xmx1G    volumes:      - symphony-db-data:/home/db/data      - symphony-conf:/home/app/conf    ports:      - 8443:8443
volumes:  symphony-db-data: null  symphony-conf: null

In this example the memory consumption for symphony is set using the according environment variable.

Additionally two volumes are specified:

  • symphony-db-data points to docker directory /home/db/data
  • symphony-conf points to docker directory /home/app/conf

For each volume specified docker will create an according local folder (Mountpoint) where the data is saved to. Changes to the folders (e.g. changing the logback.xml to activate a specific logger) are reflected inside the docker accordingly.

You can list all docker volumes using the following command:

docker volume ls

To find out the local folder (Mountpoint) that docker created for the volume you can use the following command:

docker volume inspect docker_symphony-conf

Docker Networking and License#

The docker container engine acts as a DHCP server for the containers and their assignemnt to ip addresses.

To prevent symphonys activation hash from changing randomly, you should make sure to connect the container to a predefined network and define a fixed ip address.

Add this directly under the symphony service configuration:

   networks:      symphony:        ipv4_address: 172.31.0.2

Add this to the global configuration:

networks:  symphony:    name: symphony

PostgreSQL Database#

The docker image always includes an up-to-date version of the PostgreSQL database. The database installation itself is located in the /home/db folder in the docker image.

If you wish to execute SQL commands you can enter the docker container like:

docker exec -it symphony bash

This will open the shell inside the docker container, now run the following commands to enter the PostgreSQL shell:

cd /home/dbbin/psql -U app

This will connect the database with the default user app. When prompted for the password type in agosensegmbh. You can now use the PostgreSQL shell to execute SQL commands. See PostgreSQL documentation for further details.

The database used is also called app

Backup and Restore#

To backup data you can use the command pg_dump. To restore the data psql can be used.

An example command for dumping the complete symphony database (classic and one) would be:

docker exec -i symphony /home/db/bin/pg_dump -U app app > /dump.sql

PostgreSQL documentation provides a wide range of options to customize the dump e.g. excluding specific tables (like reporting tables) to limit the size of the dumps or splitting the dump file to handle growing database size.

To load the dump back (e.g. in case of a crash of the server) you would follow these steps:

Clear existing schemas#

Assuming symphony is running again, it has created a new empty database initially. Before restoring the existing data you need to remove the existing schemas so they can be recreated based on the dump file. To do so you need to enter the PostgreSQL shell first:

cd /home/dbbin/psql -U app

Next you need to drop the existing schemas:

drop schema public cascade;drop schema symphony_main cascade;

Restore data#

Then exit the PostgreSQL shell, copy the dump file into the docker container and enter the following command to restore the data:

bin/psql --user app app < /dump.sql

This will recreate the two schemas along with all data that was included in the backup.