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, 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, for example, 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. But 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​
The file for Docker Compose that builds and sets up Workflow Server and PostgreSQL is available
in our repository on GitHub.
After running the compose-start.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/ after launch.
In order to understand the whole picture you need to understand a few things:
- 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 files 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 repo. - the server will be available at http://localhost:8077/ after launch.
Installation on Linux​
Install git following the instructions.
Install docker following the instructions.
Install docker compose following the instructions.
clone the repo:
git clone https://github.com/optimajet/WorkflowServer ~/optimajet-workflowserver
Execute these commands for run the Workflow Server with Postgres:
cd ~/optimajet-workflowserver
sudo chmod +x docker-files/wait-for-postgres.sh
sudo chmod +x startcontainer.sh
sudo ./startcontainer.shExecute these commands for run the Workflow Server with MongoDB:
cd ~/optimajet-workflowserver
sudo chmod +x docker-files/wait-for-mongo.sh
sudo docker-compose -f docker-files/docker-compose-mongo.yml build
sudo docker-compose -f docker-files/docker-compose-mongo.yml run --rm start_db
sudo docker-compose -f docker-files/docker-compose-mongo.yml upExecute these commands for run the Workflow Server with MSSQL:
cd ~/optimajet-workflowserver
sudo chmod +x docker-files/wait-for-mssql.sh
sudo docker-compose -f docker-files/docker-compose-mssql.yml build
sudo docker-compose -f docker-files/docker-compose-mssql.yml run --rm start_db
sudo docker-compose -f docker-files/docker-compose-mssql.yml up