Workflow Server in a Docker container
Starting with version 2.3, Workflow Server is published in a container on Docker Hub.
All server settings mentioned here can be passed to the server via environment variables. The names of environment
variables are set in accordance with the notation adopted in ASP.NET Core for nix systems with double underscore as a separator of nested
properties, for example as indicated here: DefaultLoggerConfig__FileSettings__FileName
. Since logging levels are defined through an array,
each element of the array is set via an environment variable with an index at the end separated by a double
underscore DefaultLoggerConfig__FileTarget__0
, DefaultLoggerConfig__FileTarget__1
, etc. You can read more on this
in this document
from Microsoft.
As an example, let's take a container configuration from a docker compose file.
workflowserver:
depends_on:
- db
image: optimajet/workflowserver
ports:
- "8077:8077"
volumes:
- ./logs:/app/wfs/logs
- ./license:/app/wfs/license
environment:
ConnectionString: HOST=db;User ID=dbuser;Password=dbuserpassword;Database=wfs;Port=5432
Provider: postgresql
CreateMetadata: "true"
LicensePath: /app/wfs/license/
DefaultLoggerConfig__FileTarget__0: Debug
DefaultLoggerConfig__FileTarget__1: Information
DefaultLoggerConfig__FileTarget__2: Error
DefaultLoggerConfig__FileSettings__FileName: /app/wfs/logs/log.txt
DefaultLoggerConfig__FileSettings__RollingInterval: Day
DefaultLoggerConfig__FileSettings__RetainedFileCountLimit: 30
Here we see the environment variables that will be transmitted to the server as its configuration. Variables with names starting
with DefaultLoggerConfig__
form an object in JSON that will be used as the default logging configuration. If you are familiar with Docker,
you can use the container on its own. However, we prepared a container composition (Workflow Server + PostgreSQL) which is deployed with a
few commands and is fully configured and operational.
Fast Workflow Server installation with Docker Compose
You need Docker with the Docker Compose plugin.
The file for Docker Compose that builds and sets up Workflow Server and PostgreSQL is available
in our repository on GitHub. After running
the startcontainer.bat
file, the following happens.
- the container with PostgreSQL is configured and started.
- the script waits for PostgreSQL to start.
- the container with Workflow Server, which connects to PostgreSQL, is configured, launched, and the script creates the necessary database objects in it.
You will get a fully functional Workflow Server available at http://localhost:8077/ once it is launched.
In order to understand the whole picture, is required to keep in mind the following:
- settings of all containers are located in the
docker-compose.yml
file. - two important folders are connected to the container:
- logs - all logs will be saved to this folder, when logging to file is enabled.
- license - the file with the license key will be loaded from this folder; this file will be saved to the same folder if the license key is loaded via the Workflow Server interface.
Running Workflow Server through Docker Compose differs depending on the operating system you are using.
Installation on Windows
- Clone or download the repository as an archive.
- Install Docker CE for Windows. Please note that Docker for Windows (with Linux containers) only works when Hyper-V is enabled. It cannot work simultaneously with VMWare, VirtualBox and most likely will not work inside a virtual machine.
- run the
startcontainer.bat
file which is located in the root of the repository. - the server will be available at http://localhost:8077/ once it is launched.
Installation on Linux
- Install git following the instructions.
- Install docker following the instructions.
- Install docker compose following the instructions.
- clone the repository:
git clone https://github.com/optimajet/WorkflowServer ~/optimajet-workflowserver
- Execute these commands for running the Workflow Server with Postgres:
cd ~/optimajet-workflowserver
chmod +x docker-files/wait-for-postgres.sh
chmod +x startcontainer.sh
./startcontainer.sh
- Execute these commands for running the Workflow Server with MongoDB:
cd ~/optimajet-workflowserver
chmod +x docker-files/wait-for-mongo.sh
docker compose -f docker-files/docker-compose-mongo.yml build
docker compose -f docker-files/docker-compose-mongo.yml run --rm start_db
docker compose -f docker-files/docker-compose-mongo.yml up
- Execute these commands for running the Workflow Server with MSSQL:
cd ~/optimajet-workflowserver
chmod +x docker-files/wait-for-mssql.sh
docker compose -f docker-files/docker-compose-mssql.yml build
docker compose -f docker-files/docker-compose-mssql.yml run --rm start_db
docker compose -f docker-files/docker-compose-mssql.yml up