Docker Compose
Docker Registry Login
Please log in to Sonra’s Docker registry before running a Docker container.
The username and password can be obtained from the Sonra team.
docker login docker.sonra.io
License Setup
To run the Flexter Docker containers, you must make the license file (flexter.lic) available.
You can obtain flexter.lic from the Sonra team.
Consider starting with the following project structure, where you can add flexter.lic:
- PROJECT_FOLDER/
- conf/
- flexter.lic
- conf/
$ mkdir -p PROJECT_FOLDER/conf
$ PROJECT_FOLDER
$ cp /pathFrom/flexter.lic conf/flexter.lic
Docker Compose Deployment
Quick Start
To quickly start the Flexter Docker containers with minimal configuration, use Docker Compose.
In the project’s root folder, create a docker-compose.yml file with the following content.
- PROJECT_FOLDER/
- conf/
- flexter.lic
- docker-compose.yml
- conf/
docker-compose.yml
services:
db:
image: docker.sonra.io/flexter/flexter-db
container_name: flexter-db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
ports:
- "5432:5432"
cmd:
image: docker.sonra.io/flexter/flexter-cmd
container_name: flexter-ui
command: ui
depends_on:
- db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
ports:
- "8080:8080"
To start the containers, run:
$ docker compose up -d
After that, the Flexter UI is available at: http://localhost:8080
If everything is working as expected, you’ll see the Flexter UI Workflow page with empty rows.
Run the smoke tests as described in Installation / Direct Installation / Post-Installation/ Smoke Tests.
You can run individual commands in separate containers using the samples included in the image.
Examples:
$ docker compose run --rm cmd xml2er /usr/share/flexter/samples/donut.xml.gz
$ docker compose run --rm cmd xsd2er -a1 -g3 /usr/share/flexter/samples/donut.xsd.gz
$ docker compose run --rm cmd xml2er -x2 -o /tmp/test /usr/share/flexter/samples/donut.xml.gz
After that, the Flexter UI will show a new row in the Workflow.
When you finish testing, you can stop the containers and remove all generated data:
$ docker compose down
Persisting data
To persist data, you must mount volumes for both the db and cmd services.
For db there is a PGDATA
variable already set to PGDATA=/home/flexter/pg_data
.
You can mount the pg_data
folder to the host machine or use a named volume.
In our sample project, we mount the project’s ./pg_data
folder to /home/flexter/pg_data
in the db
service:
- PROJECT_FOLDER/
- conf/
- flexter.lic
- pg_data/
- docker-compose.yml
- conf/
$ mkdir -m 777 pg_data
docker-compose.yml
services:
db:
...
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./pg_data:/home/flexter/pg_data:rw
For cmd service, mount the project’s ./data
folder to /data
in the container.
This folder makes input and output files available on the host machine.
- PROJECT_FOLDER/
- conf/
- flexter.lic
- data/
- pg_data/
- docker-compose.yml
- conf/
$ mkdir -m 777 data
docker-compose.yml
services:
cmd:
...
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./data:/data:rw
The final docker-compose.yml file should look like this:
docker-compose.yml
services:
db:
image: docker.sonra.io/flexter/flexter-db
container_name: flexter-db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./pg_data:/home/flexter/pg_data:rw
ports:
- "5432:5432"
cmd:
image: docker.sonra.io/flexter/flexter-cmd
container_name: flexter-ui
command: ui
depends_on:
- db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./data:/data:rw
ports:
- "8080:8080"
Recreating the containers will not remove the data.
$ docker compose up -d
Pulling Samples for Testing
To repeat the same tests using the samples inside the container, you can copy the samples from the image.
- PROJECT_FOLDER/
- conf/
- flexter.lic
- data/
- samples/
- pg_data/
- docker-compose.yml
- conf/
$ docker compose cp cmd:/usr/share/flexter/samples ./data/
With the samples available, you can run the tests:
$ docker compose run --rm cmd xml2er /data/samples/donut.xml.gz
$ docker compose run --rm cmd xsd2er -a1 -g3 /data/samples/donut.xsd.gz
$ docker compose run --rm cmd xml2er -x2 -f tsv -o /data/out/donut/ /data/samples/donut.xml.gz
If it works as expected, the output files will be available in the ./data/out
folder.
Configuration
In the docker-compose.yml file shown above, both services start with the default settings.
To change the default settings, use configuration files or environment variables.
More details about configuration options can be found in the Configuration section.
Environment Variables
Here is an example of using environment variables with docker-compose.yml:
docker-compose.yml
services:
db:
image: docker.sonra.io/flexter/flexter-db
container_name: flexter-db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./pg_data:/home/flexter/pg_data:rw
ports:
- "5432:5432"
environment:
POSTGRES_DB: x2er
POSTGRES_SCHEMA: flexmeta
POSTGRES_USER: flex2er
POSTGRES_PASSWORD: flexter
PGDATA: /home/flexter/pg_data/
cmd:
image: docker.sonra.io/flexter/flexter-cmd
container_name: flexter-ui
command: ui
depends_on:
- db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./data:/data:rw
ports:
- "8080:8080"
environment:
JAVA_OPTS: -Dconfig.override_with_env_vars=true
CONFIG_FORCE_metadata_path: jdbc:postgresql://flexter-db:5432/x2er
CONFIG_FORCE_metadata_user: flex2er
CONFIG_FORCE_metadata_password: flexter
Files
Here is another example using conf/flexter.conf:
conf/flexter.conf
metadata{
path = "jdbc:postgresql://flexter-db:5432/x2er"
user = "flex2er"
password = "flexter"
}
docker-compose.yml
services:
db:
image: docker.sonra.io/flexter/flexter-db
container_name: flexter-db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./pg_data:/home/flexter/pg_data:rw
ports:
- "5432:5432"
environment: # flexter-db works only with variables
POSTGRES_DB: x2er
POSTGRES_SCHEMA: flexmeta
POSTGRES_USER: flex2er
POSTGRES_PASSWORD: flexter
PGDATA: /home/flexter/pg_data/
cmd:
image: docker.sonra.io/flexter/flexter-cmd
container_name: flexter-ui
command: ui
depends_on:
- db
volumes:
- ./conf/flexter.lic:/etc/flexter/conf/flexter.lic:ro
- ./conf/flexter.conf:/etc/flexter/conf/flexter.conf:ro
- ./data:/data:rw
ports:
- "8080:8080"