Table of Contents
Deployment
This guide explains how to deploy DCR.Agent using docker images, either for development or deployment.
Using the DCR container registry
The DCR Container Registry is located at the Scaleway Amsterdam
datacenter.
You will have been provided a scaleway secret (SCW_SECRET_KEY) key to access this
registry. Log in as follows:
docker login rg.nl-ams.scw.cloud/dcrsolutions -u nologin -p [SCW_SECRET_KEY]
Retrieve the latest DCR.Agent/DCR.Agent image:
docker run rg.nl-ams.scw.cloud/dcrsolutions/flow:latest
Configuring DCR.Agent
For DCR.Agent to operate, you need to set up:
- Database access,
- A tenant,
- A first user,
- A token for DCR repo access.
We will return to (1) in later sections. For (2)--(4),
here is a sample JSON configuration tenant.json:
{
"DefaultUser": {
"FirstName": "Anette",
"LastName": "Case",
"Email": "anette@dcr.test",
"Role": "Admin,Janitor",
"Password": "Foobar1!"
},
"DefaultTenant": {
"Slug": "agent",
"Name": "DCR Agent",
"Logo": {
"ImageUrl": "https://www.docker.com/wp-content/uploads/2024/05/icon-atom.svg",
"LinkUrl": "https://dcrsolutions.net/",
"Text": "AGENT"
},
"DCRRepoLink": {
"Url": "https://repository.dcrgraphs.net",
"Token": "<redacted>"
}
}
We will return to how to provide this file to running flow below.
DCR Workflow configuration can be provided under
DefaultTenant:WorkflowConfiguration.
Refer to the DCR.Agent deployment guide for information on additional
configuration.
Running: with included throw-away Postgres database
NB! THE DATABASE WILL BE LOST WHEN THE IMAGE IS DELETED. Use this option
exclusively for development.
This option uses postgres bundled with DCR.Agent via docker-compose.
Use the following docker-compose.yml file :
services:
flow:
image: rg.nl-ams.scw.cloud/dcrsolutions/flow:latest
ports:
- "8080:8080"
volumes:
- ./config_data:/app/Config
depends_on:
- db
environment:
Db: postgres
ConnectionStrings__Postgres: "Host=db;Port=5432;Database=flow_db;Username=postgres;Password=kaffe123;"
db:
image: postgres:latest
environment:
POSTGRES_DB: flow_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "kaffe123"
ports:
- "5432:5432" # Expose PostgreSQL port
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:
config_data:
To use this docker:
- Copy this file to
docker-compose.yml. - In the same directory, create a sub-directory
config_data. - Copy your JSON
tenant.jsonabove to thisconfig_data.
Run with
docker compose up
Destroy with
docker compose down -v
The postgres instance can be accessed on localhost:5432.
Running the image with a remote database
Configuration for Postgres postgres.json:
{
"ConnectionStrings":
{
"Postgres": "Server=host.docker.internal,5432;Database=postgres;User Id=postgres;Password=kaffe123;"
}
}
DCR.Agent is known to work with the mcr.microsoft.com/mssql/server:2022-latest docker image.
Configuration for Microsoft SqlServer sqlserver.json:
{
"ConnectionStrings":
{
"SqlServer": "Server=host.docker.internal,5432;Database=postgres;User Id=postgres;Password=kaffe123;"
}
}
DCR.Agent is known to work with the postgres:17 image.
In either case, replace host.docker.internal if your database is not
running on the docker host machine.
Proceed as follows:
- Create a
config_datadirectory - Place your
tenant.jsonin this directory - Place either
postgres.jsonorsqlserver.jsonin this
directory.
Now run:
docker run \
-v ./config_data:/app/Config \
-p 8080:8080 \
rg.nl-ams.scw.cloud/dcrsolutions/flow:latest
Flow will be available on localhost:8080.
Common problems
Note that reports of exceptions in the logs is expected on first
start: Exceptions will be raised when DCR.Agent attempts to access a
database that has yet to be created.
Incorrect connection string
Symptom:
[12:16:28 ERR] An exception occurred while iterating over the results of a query for context type 'DCR.Case.Models.Db.PostgresFlowContext'.
System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Cause:
The connection string is invalid.
Remedy:
Provide a correct connection string.
Incorrect json configuration
Symptom:
agent-flow-1 | ---> System.FormatException: Could not parse the JSON file.
agent-flow-1 | ---> System.Text.Json.JsonReaderException: ''' is an invalid start of a property name. Expected a '"'. LineNumber: 1 | BytePositionInLine: 4.
Cause:
Provided json configuration (via docker volume) is incorrect (here on
line 1, column 4).
Symptom:
Provide syntactically correct json configuration.
