Docker Compose Installation

Prerequisites

  • Docker engine 26.0.0 or later.

  • Docker compose 2.26.0 or later.

  • Zip file containing the MTG KMS in docker compose form (accessible via MTG Download Center).

  • Configured domain name resolution for the external IP address to be used.

  • Network access to the MTG docker registry "repo.mtg.de" and other public docker image registries.

  • A high entropy source. For OSes with linux kernel > 5.4 or Windows systems, no additional actions are needed. For older OSes the haveged service can be installed.

  • The 'sse2' cpu flag must be available in virtualized environment. Otherwise, some components cannot work correctly. To check if the flag is present and available, you can use:

if [[ ! -z $( cat /proc/cpuinfo | grep -E 'sse2' ) ]] ; then echo sse2 flag is presented ; else
echo no sse2 flags presented ; fi

Hardware Requirements

Minimum Requirements

  • 8 GB RAM

  • 4 CPU cores

  • 50 GB hard disk

  • 32 GB RAM

  • 8 CPU cores

  • 200 GB hard disk

MTG Docker Registry Configuration

Login to MTG docker repository with the username and password you were provided via:

docker login -u <MTG_DOCKER_REPO_USER> repo.mtg.de

If you want to verify access for MTG CPKI, make sure you are able to download a container image:

docker pull repo.mtg.de/releases/ers/clm/mtg-clm-ui:4.1.0

or if you want to verify access for MTG KMS:

docker pull repo.mtg.de/releases/ers/kms/kms-ui:3.3.0

First Time Installation

Unzipping

Unzip the contents of the provided zip file at a location of your choice and navigate to the "mtg-ers" folder.

Environment Variables

Rename the default ".template.env" to ".env", in order for it to be available for execution by the installation scripts. This file is located in the same directory as the "docker-compose.yml". Edit the default ".env" file according to your needs. This file is the main configuration file of the docker compose installation. This file also includes a plethora of passwords and secrets, used for various purposes within the application. All passwords have been randomly generated by MTG. Before continuing, you have the option to change them to values of your choice. Try to maintain the same password characteristics to avoid unforeseen errors (e.g., through special secret characters).

Choosing a Database

The docker compose installation provides two options for the database. You can either use an included "embedded" MariaDB or Postgres database, or connect to an external MariaDB or Postgres database. For simple installations, the embedded database method is recommended.

Configuring the Embedded Database

In order to use the embedded database, the compose profile "embedded-db" must be included in the "COMPOSE_PROFILES" configuration option. All "DB_*" options must also be set for the embedded database.

Configuring the External Database

For CLM 6.17.0, use MariaDB 11.4 or PostgreSQL 16 or 18, as listed in the component compatibility table. Verify that the Docker Compose distribution supports the selected database version. It must be configured via the "DB_*" configuration options. There are two options for the external database:

  • Externally maintained; the required empty databases and database users are prepared before the initial installation.

  • Maintained by the provided tooling (found under "mtg-ers/tools"); to use those tools, a form of privileged access (root) to the database is needed. The privileged database containers must be configured via "DB_ROOT_USER" and "DB_ROOT_PASSWORD".

External Database Initialization

This procedure requires privileged access.

Execute the following:

  • Linux:

cd tools/create-dbs && sh create-dbs.sh && cd ../../
  • Windows:

cd tools\create-dbs
.\create-dbs.ps1
cd ..\..\

Bootstrapping

The bootstrapping scripts will load and start all container images needed. They will also remove any temporary containers that are used exclusively in the bootstrap process. Eventually, you will only have the production containers running in your docker infrastructure.

Execute the following and wait until its finished:

  • Linux:

sh bootstrap.sh
  • Windows:

.\bootstrap.ps1

TLS Configuration

During the bootstrapping phase, installation specific data are generated and placed in the "ssl" folder.

In the root of the ssl folder:

  • "truststore.p12" ⇒ Truststore file which includes the CARA Default Root CA or the MiniCA Root in PKCS12 format.

  • "apache-truststore.pem" ⇒ Truststore file which includes the CARA RA Root, CARA Default Sub CA and KMS MiniCA Sub CA in PEM format. Used by the apache reverse proxy, to authenticate TLS client connections.

In cara folder (available only if "cpki" profile is active):

  • Management Root CA ("rootRa.pem") ⇒ for user certificates used to administer the PKI platform.

  • Management Admin User Certificate ("ra.p12") ⇒ for accessing the CA Admin UI under <domain-name>/cara-admin/. It must be imported in the browser, to be used for TLS client authentication. The password for this file can be found in ".env", under the "DEFAULT_PKI_MANAGEMENT_ADMIN_USER_P12_PASS" variable. Additionally, the Management Root CA must be imported and trusted in the browser/OS.

  • Default Root CA ("rootCA.pem") and one default Sub CA based on the provided configurations that will be used as the default chain for all CPKI use cases. This Root CA should be distributed as the root of trust for issued certificates.

In acme folder (available only if "cpki" profile is active):

  • Server Certificate ("server.*.pem") ⇒ for platform reverse proxy to secure the external TLS connections for UIs and APIs.

In kms folder (available only if "kms" profile is active):

  • "minica_root.pem" ⇒ Default MiniCA Root CA.

  • "minica_sub.pem" ⇒ Default MiniCA Sub CA.

  • "minica_server_cert.pem" ⇒ Default server certificate issued via MiniCA Sub CA, only in cases when "cpki" profile is deactivated.

  • "minica_server_key.pem" ⇒ Default server certificate key issued via MiniCA Sub CA, only in cases when "cpki" profile is deactivated.

  • "kms-tenant-users.json" ⇒ Credentials for the tenant users created for the "Default" KMS tenant.

  • "kms-client.json" ⇒ KMIP & Basic Auth credentials for the kms client user created in the "Default" KMS tenant.

  • "kms-client-ui.json" ⇒ GUI Keycloak credentials for the kms client user created in the "Default" KMS tenant.

  • "kms-client-keystore.p12" ⇒ TLS client auth credentials for the kms client user created in the "Default" KMS tenant.

  • "kms-client-keystore-pass.txt" ⇒ TLS client auth credentials for the kms client user created in the "Default" KMS tenant.

  • "kms-tcp2http-keystore.p12" ⇒ Keystore file containing the minica_server_cert and key in p12 format, to be used as a server certificate by the KMS TCP2HTTP server if the "tcp2http" is enabled.

Starting the MTG Docker Infrastructure

Execute the following and wait until its finished:

  • Linux:

sh start.sh
  • Windows:

.\start.ps1

You may check your running containers with:

docker ps --format "table {{.ID}}\t{{.Status}}\t{{.Names}}"

You’ll get an output that looks like this and depends on the enabled profiles:

   mtg-ers~$ docker ps --format "table {{.ID}}\t{{.Status}}\t{{.Names}}"
   CONTAINER ID   STATUS                    NAMES
   5b3b48b32189   Up 8 minutes (healthy)    mtg-acme-server
   0e13f3d9841c   Up 8 minutes (healthy)    mtg-scep-server
   1e3d933cb72b   Up 8 minutes (healthy)    mtg-clm-frontend
   479e9b86855c   Up 9 minutes (healthy)    mtg-clm-backend
   d8ddf63cbe1a   Up 9 minutes (healthy)    reverse-proxy
   d928f4b81f21   Up 9 minutes (healthy)    cara-ris
   56213b2cae7f   Up 10 minutes (healthy)   cara-admin
   5521bb264fdc   Up 11 minutes (healthy)   cara-server
   74593095b12a   Up 11 minutes (healthy)   ers-keycloak
   9e0e9c9e91a2   Up 11 minutes (healthy)   ers-db

Stopping the MTG Docker Infrastructure

Execute the following and wait until its finished:

  • Linux:

sh stop.sh
  • Windows:

.\stop.ps1

Product Documentation

Online documentation can be found at docs.mtg.de.

Available URL Paths

Corporate PKI:

  • CARA Admin UI: /cara-admin/

  • CARA REST API: /cara-ws/

  • CLM UI: /clm-ui/

  • Keycloak Admin UI: /auth/

  • CLM API: /clm-api/swagger-ui.html

  • ACME: /acme/v2/directory

  • SCEP: /scep

  • CMP: /cmp

  • EST: /.well-known/est

  • AEC: /aec

Key Management System:

  • KMS UI: /kms-ui/

  • MINI CA UI: /mini-ca/

  • KMIP HTTP API: /kms/

  • KMIP TCP API: <domain-name>:5696

  • KMS REST API: /kms-crypto-api/

Log Files

To view application logs go from root to logs directory:

cd logs

Backups

Backup-relevant objects include the following:

  1. "ssl" folder that includes all platform TLS data.

  2. ".env" config file that includes all the configuration options.

  3. Database backup. Depending on the mode used (embedded or external) and the database type (MariaDB or Postgres), different methods apply.

External Postgres / MariaDB Backups

Backup your databases according to your provider’s instructions. The following databases must be backed up.

Corporate PKI:

  • keycloakdb

  • clmdb

  • acmedb

  • caradb

KMS:

  • keycloakdb

  • minicadb

  • kmsdb

Embedded Postgres DB

Run the following commands from the mtg-ers directory. First, create the backup directory and restrict permissions on newly created backup files:

umask 077
mkdir -p backup

Each command below writes the database dump to an SQL file in backup and runs gzip only if the dump succeeds. After successful compression, gzip removes the SQL file and leaves the compressed .sql.gz archive. Move existing archives to a secure location before repeating a backup with the same filename. If a command fails, check the error before retrying; an SQL file left by a failed dump may be incomplete.

Make sure to transfer the created files to a secure location.

Corporate PKI:

For caradb execute:

docker exec ers-db pg_dump -U postgres caradb > backup/caradb-backup.sql && gzip backup/caradb-backup.sql

For clmdb execute:

docker exec ers-db pg_dump -U postgres clmdb > backup/clmdb-backup.sql && gzip backup/clmdb-backup.sql

For acmedb execute:

docker exec ers-db pg_dump -U postgres acmedb > backup/acmedb-backup.sql && gzip backup/acmedb-backup.sql

For keycloakdb execute:

docker exec ers-db pg_dump -U postgres keycloakdb > backup/keycloakdb-backup.sql && gzip backup/keycloakdb-backup.sql

KMS:

For minicadb execute the following:

docker exec ers-db pg_dump -U postgres minicadb > backup/minica-backup.sql && gzip backup/minica-backup.sql

For kmsdb execute the following:

docker exec ers-db pg_dump -U postgres kmsdb > backup/kmsdb-backup.sql && gzip backup/kmsdb-backup.sql

For keycloakdb execute the following:

docker exec ers-db pg_dump -U postgres keycloakdb > backup/keycloakdb-backup.sql && gzip backup/keycloakdb-backup.sql

Embedded MariaDB

If you use the MariaDB embedded-db option, the docker volume "mtg-ers_ersdbdata" includes all database content for the MTG infrastructure. Docker volumes can be backed up in multiple ways, one of which is described below.

Assuming you’ve chosen the MariaDB embedded-db option in your MTG ERS Docker infrastructure, and you’re using a Linux host. For scheduled backups, adapt the following example according to the guidance below.

Do not copy the MariaDB backup command below unchanged into a crontab.

  • Remove -it from docker exec; cron jobs do not have an interactive terminal.

  • Use bash -o pipefail -c inside the container so that a failed mariadb-backup causes the command to fail even if gzip succeeds.

  • Remove the trailing period after the closing quote so that the archive filename ends in .gz, not .gz..

  • Prefer placing the adapted command in a Bash script and invoking that script by its absolute path from cron. If you put the command directly in a crontab, escape every % in the date format as \%, even inside quotes; cron otherwise treats these characters as line breaks.

Check the command’s exit status and capture its error output when scheduling it. An archive left by a failed backup may be empty or incomplete and must not be used for restoration.

docker exec -it ers-db bash -c 'mariadb-backup --backup --user root --password "$MARIADB_ROOT_PASSWORD" --stream=mbstream | gzip > /backup/$(date +%Y_%m%d_%H%M)_backup.stream.gz'.

The above command will fetch a full backup of MariaDB and place it upon the mounted directory backup (which should be under the mtg-ers directory).

To back up the TLS files, run the following commands from your deployment’s mtg-ers directory. The ssl directory is populated during bootstrapping, as described in TLS Configuration. Verify that ./ssl/ exists and contains the generated TLS files before continuing. If it is missing, check the deployment path and bootstrap output.

umask 077
mkdir -p ./backup
zip -r "./backup/$(date +%Y_%m%d_%H%M)_ssl.zip" ./ssl/

The archive contains the ssl directory and its contents and is stored in ./backup/. To include logs in the same archive, append ./logs/ after ./ssl/ in the zip command.

Restoring

Restore the configuration, TLS files and databases from a matching backup set before starting the application services.

Do not run bootstrap.sh, bootstrap.ps1 or the password autocompletion script during restoration. These initialize new data or secrets and can overwrite values needed by the restored installation. Keep application services stopped while restoring the databases.

Preparing the Restore

  1. Obtain the Docker Compose distribution and component versions used when the backups were created. Restore those versions first; follow Upgrading separately after verifying the restored installation.

  2. If an installation is already running at the destination, stop it as described in Stopping the MTG Docker Infrastructure.

  3. Work from the restored distribution’s mtg-ers directory.

  4. Restore the backed-up .env file and the contents of the backed-up ssl directory to their original locations. Preserve their access permissions and verify that the configured credentials match the databases being restored.

  5. Identify the database type, whether it is embedded or external and how the backup was produced. Choose the matching procedure below and restore every database used by the enabled application profiles, including Keycloak.

Restoring Embedded PostgreSQL

The manual commands in Embedded Postgres DB produce gzip-compressed SQL dumps. Use the procedure below for those .sql.gz files. If the backup was created by the distribution’s backup.sh, use the matching restore.sh procedure in Database Backup and Restoration Scripts for Embedded Postgres and MariaDB and check its expected backup filenames and location.

  1. Start only the embedded database service, leaving application services stopped:

    docker compose up -d --no-deps ers-db
  2. Wait for PostgreSQL to accept connections. You can check readiness with:

    docker exec ers-db pg_isready -U postgres
  3. Ensure the required database roles and empty application databases exist, with ownership and permissions matching the original deployment. Use the database setup procedure supplied with your distribution or have your database administrator prepare them. The per-database pg_dump backups do not include cluster roles.

  4. Check the compressed backup before importing it. For example, for caradb:

    gzip -t backup/caradb-backup.sql.gz

    A successful gzip check verifies the compressed file’s integrity; it does not prove that the database dump is complete or restorable.

  5. In Bash, import the SQL into the matching database:

    set -o pipefail
    gzip -dc backup/caradb-backup.sql.gz | docker exec -i ers-db psql -U postgres --dbname=caradb --set=ON_ERROR_STOP=on

    -i passes the SQL to psql without allocating a terminal. pipefail reports decompression failures and ON_ERROR_STOP stops the import on an SQL error.

  6. Repeat the check and import for each required database, changing both the backup filename and the target database name. For example, the manual minicadb backup is named backup/minica-backup.sql.gz.

If an import fails, resolve the error and restore into a clean target database before proceeding. Keep the application services stopped while doing so.

Restoring Embedded MariaDB

The manual mariadb-backup --stream=mbstream command in Embedded MariaDB produces a compressed physical backup. It must be restored using the physical backup procedure, rather than imported as SQL.

  1. Keep the MariaDB container stopped while restoring its data files.

  2. Follow the MariaDB container backup and restoration procedure using the database version and data volume configured for the installation. This includes decompressing and extracting the backup stream, preparing the backup with mariadb-backup and restoring it to the target data directory with the ownership required by the container.

  3. Start only the restored database service and check its logs for successful startup before starting applications.

For backups created with the distribution’s embedded backup tooling, use its matching restore procedure in Database Backup and Restoration Scripts for Embedded Postgres and MariaDB and verify that the backup format and location match what the script expects.

Restoring External Databases

Keep application services stopped and restore the required databases using your database provider’s procedure. Restore the necessary database users, ownership and permissions as well as the application data. Confirm that the database addresses and credentials in the restored .env file match the restored database server.

If the backups were created using the provided external database tooling, follow Database Backup and Restoration Scripts for External Postgres and MariaDB with the Compose configuration for the database type being restored.

Starting and Verifying the Restored Installation

  1. Confirm that every required database restore completed successfully and that the database server is ready.

  2. Confirm that the restored .env file and TLS files belong to the same installation as the database backups.

  3. Start the application services as described in Starting the MTG Docker Infrastructure.

  4. Check container status and application logs for database connection, authentication or startup errors.

  5. Sign in to the restored application and verify known records, such as realms, policies and certificates. Check the enabled application profiles and their connections before returning the installation to normal use.

Keep the original backup set until verification is complete.

Upgrading

Before upgrading, check the upgrade requirements and the release notes for the target CLM release and any required intermediate releases. Select compatible component versions together rather than updating each component independently to its latest version.

New version notifications are sent via the MTG Download Center. For this product, each update will include a new zip file with up-to-date:

  • docker infrastructure components

  • documentation

  • release notes

  • migration information (if applicable)

Configure the container image versions in the ".env" file using the versions required by the target release:

  • CARA_VERSION

  • CLM_VERSION

  • KEYCLOAK_VERSION

  • KMS_VERSION

  • MARIADB_VERSION or POSTGRES_VERSION

First, stop the infrastructure (Stopping the MTG Docker Infrastructure) and download the latest release version zip file at a location on your machine (preferably your home folder).

Extract the zip file.

Copy the contents of the mtg-ers/ssl folder and the mtg-ers/.env file from your old docker components directory into the new one which you just downloaded.

Copy the contents of the mtg-ers/logs folder from your old docker components directory into the new one which you just downloaded.

Make the change in the ".env" file, stating compatible versions of CARA, CLM, KEYCLOAK, KMS, POSTGRES or MARIADB, according to the release notes for the target release, and start it up again (Starting the MTG Docker Infrastructure).

The above should be enough for most upgrades. You should get notified when there’s a new version for ERS components, regardless of any upgrades in the Docker Compose Infrastructure zip file.

In cases where changes are also required in the docker-compose files, a new version for the Docker Compose Infrastructure will be released and instructions will be explicitly included in the migration documentation.

Purging the MTG Docker Infrastructure

Use this procedure only when intentionally deleting all installation data to reset the infrastructure. For a new installation, follow First Time Installation; for an update, follow Upgrading.

The purge procedure will:

  • stop and delete all containers

  • delete the mtg-ers_ersdbdata docker volume or the databases in your external configured server

  • delete the ssl directory

Database Deletion

This procedure requires privileged access.

Run the following commands from the mtg-ers directory. They stop the running applications before deleting the installation data:

  • Linux:

sh stop.sh && cd tools/delete-all && sh delete-all.sh && cd ../../
  • Windows:

.\stop.ps1
cd tools\delete-all
.\delete-all.ps1
cd ..\..\

Appendix

Configure Custom Keycloak Truststore

This procedure applies to Keycloak 26, including Keycloak 26.8.1 listed in the component compatibility table. For older Keycloak versions, consult the documentation for the installed version before changing its truststore configuration. See Configuring trusted certificates for the Keycloak truststore settings.

Use this procedure when Keycloak must trust a private certificate authority for outgoing TLS connections, such as LDAPS or an HTTPS identity provider. It configures trusted CA certificates and does not replace Keycloak’s server certificate or private key.

  1. Work from your deployment’s mtg-ers directory.

  2. Create a dedicated directory for the trusted CA certificates:

    mkdir -p ssl/keycloak-trusted-cas
  3. Place the required root CA certificates and any required intermediate CA certificates in that directory as PEM files with a .pem extension. Verify the certificates with the CA administrator before trusting them. Include certificates only, without private keys, and ensure that the Keycloak container user can read the files and traverse the directory.

  4. In common/common-compose.yml, add the following bind mount to the existing volumes list of the ers-keycloak service. Replace /absolute/path/to/mtg-ers with the absolute path of your deployment directory. Preserve the service’s existing mounts and other settings.

    - /absolute/path/to/mtg-ers/ssl/keycloak-trusted-cas:/var/mtg/conf/keycloak-trusted-cas:ro

    An absolute host path avoids ambiguity about how Compose resolves relative paths across the distribution’s Compose files.

  5. In common/keycloak.env, add or update the following setting:

    # Trusted CA certificates for outgoing TLS connections
    KC_TRUSTSTORE_PATHS=/var/mtg/conf/keycloak-trusted-cas

    If KC_TRUSTSTORE_PATHS already specifies other required paths, retain them in the comma-separated list. When migrating from the previous procedure, remove the KC_SPI_TRUSTSTORE_FILE_* settings after adding the required CA certificates to the new directory. Use # for comments in this environment file. Retain Keycloak’s default hostname verification and ensure the destination hostname matches its certificate.

  6. Validate the Compose configuration, then recreate only Keycloak to apply the environment and mount changes:

    docker compose config --quiet

    If validation succeeds and the installation’s database and other required services are running, execute:

    docker compose up -d --no-deps --force-recreate ers-keycloak

    Recreating Keycloak briefly interrupts authentication.

  7. Check Keycloak’s startup logs and test the configured LDAPS or identity provider connection. Resolve certificate-chain or hostname errors before relying on the connection.

Useful Administration Tools

Passwords and Secrets Autocompletion Script for env file (.env)

Avoid executing this script after bootstrap process, since it will overwrite all your docker infrastructure’s passwords in the .env file! A lock protection has been implemented in order to protect your .env file by an accidental execution of the autocomplete.sh script.

This is a script for auto-completing .env file with auto-generated passwords and secrets which are needed the ERS bootstrap process

Procedure:

  • .env file must be located to the /mtg-ers directory

  • While inside the /mtg-ers directory, execute below command before proceeding with the bootstrap process:

cd tools/env-autocompletion/ && PASS_LENGTH=<password_character_length> SPECIAL_LENGTH=<special_character_length> docker compose -f docker-compose-env.yml up && cd ../../

Below you may find a common execution example:

cd tools/env-autocompletion/ && PASS_LENGTH=20 SPECIAL_LENGTH=2 docker compose -f docker-compose-env.yml up && cd ../../
This script will generate passwords according to the length you give as a first argument, including an amount of special characters you give as a second argument.

CASES:

Case 1: All following passwords are generated following the principle of the inputs - arguments:

    SMTPSERVER_PASS
    DB_ROOT_PASSWORD
    OPENSEARCH_ADMIN_PASSWORD
    DB_KEYCLOAK_PASS
    KEYCLOAK_ADMIN_USER_PASS
    ERS_ADMIN_API_CLIENT_SECRET
    TRUSTSTORE_PASS
    DEFAULT_PKI_MANAGEMENT_ADMIN_USER_P12_PASS
    DEFAULT_PKI_MANAGEMENT_ADMIN_USER_PASSWORD
    DB_CLM_PASS
    DB_ACME_PASS
    KEYCLOAK_CLM_SERVER_CLIENT_SECRET
    CLM_ACME_API_CLIENT_SECRET
    CLM_SCEP_API_CLIENT_SECRET
    CLM_EST_API_CLIENT_SECRET
    CLM_CMP_API_CLIENT_SECRET
    CLM_AEC_API_CLIENT_SECRET
    DB_CARA_PASS
    CARA_ADMIN_APP_SECRET
    CARA_ADMIN_SECRET
    CARA_ADMIN_BASIC_PASS
    CARA_CLM_APP_SECRET
    CARA_RIS_APP_SECRET
    DB_MINICA_PASS
    KMS_MINICA_ADMIN_PASSWORD
    KMS_MINICA_CLIENT_PASSWORD
    KMS_MINICA_HSM_KEYSTORE_PASSWORD
    DB_KMS_PASS
    KEYCLOAK_KMS_SERVER_CLIENT_SECRET
    KMS_HSM_KEYSTORE_PASSWORD
    KMS_TCP2HTTP_KEYSTORE_PASS

Case 2: The following is generated by hashing the matching passwords using bcrypt:

KMS_MINICA_ADMIN_PASSWORD_BCRYPT
KMS_MINICA_CLIENT_PASSWORD_BCRYPT
  • Command that is being used inside the script to perform the hashing:

htpasswd -bnBC 10 "" "$password" | tr -d ':\n' | sed 's/\$2y/\$2a/'

Case 3: The following is generated by using this command: openssl rand -base64 32:

KMS_MINICA_HSM_ENCRYPTION_AES_KEY=
KMS_DB_PROTECTION_SECRET=

Case 4: The following is generated by using this command: openssl rand -base64 64

KMS_MINICA_JWT_SERCET=
After this execution you may check the .env file and proceed with the bootstrap process.

Database Backup and Restoration Scripts for Embedded Postgres and MariaDB

Execute these scripts (backup.sh, restore.sh) while in mtg-ers root folder, in case you need to use it for your embedded databases backups.

backup.sh - Execution Summary: Creates the databases backups and stores them as gzip compressed files on /backup directory (ers-db container volume).

# At least 2 arguments are needed to run this script
# 1st argument is the database type -> postgres or mariadb (Mandatory)
# 2nd argument is the database name -> caradb or clmdb or acmedb or keycloakdb or kmsdb or minicadb (Mandatory)
# ... (Optional)
# 7th argument is the database name -> caradb or clmdb or acmedb or keycloakdb or kmsdb or minicadb (Optional)

# Execution Example: ./tools/embedded/embedded-backup/backup.sh mariadb caradb clmdb acmedb keycloakdb kmsdb minicadb
# Execution Example: ./tools/embedded/embedded-backup/backup.sh postgres caradb clmdb acmedb keycloakdb kmsdb minicadb
# Execution Example: ./tools/embedded/embedded-backup/backup.sh postgres caradb minicadb
# Execution Example: ./tools/embedded/embedded-backup/backup.sh postgres keycloakdb acmedb

restore.sh - Execution Summary: Restores the databases previous states using the backup files which are already stored on /backup directory (ers-db container volume)

# At least 2 arguments are needed to run this script
# 1st argument is the database type -> postgres or mariadb (Mandatory)
# 2nd argument is the database name -> caradb or clmdb or acmedb or keycloakdb or kmsdb or minicadb (Mandatory)
# ... (Optional)
# 7th argument is the database name -> caradb or clmdb or acmedb or keycloakdb or kmsdb or minicadb (Optional)

# Execution Example: ./tools/embedded/embedded-restore/restore.sh mariadb caradb clmdb acmedb keycloakdb kmsdb minicadb
# Execution Example: ./tools/embedded/embedded-restore/restore.sh postgres caradb clmdb acmedb keycloakdb kmsdb minicadb
# Execution Example: ./tools/embedded/embedded-restore/restore.sh postgres caradb minicadb
# Execution Example: ./tools/embedded/embedded-restore/restore.sh postgres keycloakdb acmedb

Database Backup and Restoration Scripts for External Postgres and MariaDB

Execute these scripts (external-backup.sh, external-restore.sh) while in mtg-ers root folder, in case you need to use it for your external databases backups. To run these scripts, Docker Compose files are needed as well.

external-backup.sh - Execution Summary: Creates the databases backups and stores them as gzip compressed files on /backup directory.

If you are using external Postgres and need backups, run below command while being in mtg-ers root folder:

cd tools/externaldb-backup/ && docker compose -f docker-compose-postgres.yml up && cd ../../
  • After usage, remove the container running the below command:

cd tools/externaldb-backup/ && docker compose -f docker-compose-postgres.yml down && cd ../../

If you are using external MariaDB and need backups, run below command in mtg-ers root folder:

cd tools/externaldb-backup/ && docker compose -f docker-compose-maria.yml up && cd ../../

After usage, remove the container running the below command:

cd tools/externaldb-backup/ && docker compose -f docker-compose-maria.yml down && cd ../../

external-restore.sh - Execution Summary: Restores the databases' previous states using the backup files which are already stored on /backup directory.

If you are using external PostgreSQL and need to restore backups, run below command in mtg-ers root folder:

cd tools/externaldb-restore/ && docker compose -f docker-compose-postgres.yml up && cd ../../

After usage, remove the container running the below command:

cd tools/externaldb-restore/ && docker compose -f docker-compose-postgres.yml down && cd ../../

If you are using external MariaDB and need to restore backups, run below command in mtg-ers root folder:

cd tools/externaldb-restore/ && docker compose -f docker-compose-maria.yml up && cd ../../

After usage, remove the container running below command:

cd tools/externaldb-restore/ && docker compose -f docker-compose-maria.yml down && cd ../../

Running Tests against your Infrastructure

Bare in mind that the tests will create data in your infrastructure. To run these scripts, Docker Compose files are needed as well.
  • RIS tests: docker compose up ris-test --no-deps

  • ACME tests: docker compose up acme-test --no-deps

  • SCEP tests**: docker compose up scep-test --no-deps

  • CMP tests**: docker compose up cmp-test --no-deps

  • EST tests**: docker compose up est-test --no-deps

**These tests require some preparation. Specifically, using CLM-UI, you’ll have to create an End Entity and a password for the corresponding policy, i.e. the SCEP, CMP or EST policy. After that, update the values in the .env file with the password, the End Entity id and common name, in the section 'TESTS ENV'.