How to Set Up the Docker Container

The Sync Service is available as a Docker image from the following repository:

rg.nl-ams.scw.cloud/sendent-public/sendent-sync:latest

You can quickly get started by using our custom-made Docker Compose file, which deploys the following two containers:

  • The synchronization service itself

  • A PostgreSQL database

Preparations

Make sure you have the Sendent Synchroniser app for Nextcloud installed.

  1. Download and install the Sendent Synchroniser app from Nextcloud here: https://apps.nextcloud.com/apps/sendentsynchroniser

  2. Login as an administrator, go to apps and search for ‘Sendent Synchronizer’ and enable the app. 

Creating your volumes

You can create volumes in your Docker installation to access the database files or modify settings of the Sync Service without needing to redeploy using Docker Compose. The volumes you can create are listed below:

  • sendentsynchronisersettings: Can be mapped to access the appsettings.json file.

  • sendentsynchroniserdb: Can be mapped to access database files (useful for backup purposes, for example).

To specify where the volumes need to be mapped on your server's disk, you can use the following commands:

docker volume create --driver local \
    --opt type=none \
    --opt device=/<path to the desired directory> \
    --opt o=bind sendentsynchronisersettings

 

docker volume create --driver local \
    --opt type=none \
    --opt device=/<path to the desired directory> \
    --opt o=bind sendentsynchroniserdb

After successfully creating the volumes, you can proceed to the next section.

Preparing your docker-compose file

We provide an example docker-compose.yml file that you can edit to match your specifications. If everything is correctly configured, you can use the following command on your Docker machine to deploy the Sync Service, including the database service:

docker compose up

You can check the status of the deployment using this command:

docker compose ls

Default Configuration

The settings you provide in the docker-compose.yml file will always take precedence over the appsettings.json file, which is exposed using the sendentsynchronisersettings volume. 

The settings in the docker-compose.yml file are optional unless you don't provide a correct appsettings.json file in the volume-mapped directory for the sendentsynchronisersettings volume.

docker-compose.yml

version: '3.4'

services:
  sendent.synchronisation.service:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-sync:latest
    build:
      context: .
      dockerfile: Dockerfile
    depends_on:
      sendent.synchronisation.db:
        condition: service_healthy
    restart: on-failure
    environment:
      - Service__NextcloudBaseUrl=
      - Service__NextcloudServiceUsername=
      - Service__NextcloudServicePassword=
      - Service__MicrosoftTenantId=
      - Service__MicrosoftAppId=
      - Service__MicrosoftClientSecret=
      - Service__ExchangeType=1
      - Service__ExchangeOnPremUrl=https://outlook.office365.com/EWS/Exchange.asmx
      - Service__ExchangeOnPremDomain=
      - Service__ExchangeOnPremUsername=
      - Service__ExchangeOnPremPassword=
      - Service__SharedSecret=
      - Service__OsVersion=Sendent-Sync
      - Service__DatabaseEncryptionKey=
      - Service__IntervalRefreshInMinutes=1
      - Service__MaxParallelProcessingUsers=5
      - Service__BatchLimit=60
      - Service__ForceRefreshCredentialsUsersStartUp=false
      - ConnectionStrings__DatabaseConnectionString=Host=sendent.synchronisation.db;Port=5432;Username=pguser;Password=pguser;Database=pgdb

  sendent.synchronisation.db:
    image: postgres
    volumes:
     - sendentsynchroniserdb:/var/lib/postgresql/data
    expose:
      - "5432" 
    environment:
      POSTGRES_USER: pguser
      POSTGRES_PASSWORD: pguser
      POSTGRES_DB: pgdb
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U pguser -d pgdb"]
      interval: 10s
      timeout: 5s
      retries: 5
volumes:
  sendentsynchroniserdb:
    external: true

Hosting PostgreSQL elsewhere

The PostgreSQL database can be hosted outside of docker, make sure that you modify the ConnectionStrings__DatabaseConnectionString that it reflects the login to your PostgreSQL server. In comparison with the above docker-compose file, the sendent.synchronisation.db container is removed.

version: '3.4'

services:
  sendent.synchronisation.service:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-sync:latest
    build:
      context: .
      dockerfile: Dockerfile
    restart: on-failure
    environment:
      - Service__NextcloudBaseUrl=
      - Service__NextcloudServiceUsername=
      - Service__NextcloudServicePassword=
      - Service__MicrosoftTenantId=
      - Service__MicrosoftAppId=
      - Service__MicrosoftClientSecret=
      - Service__ExchangeType=1
      - Service__ExchangeOnPremUrl=https://outlook.office365.com/EWS/Exchange.asmx
      - Service__ExchangeOnPremDomain=
      - Service__ExchangeOnPremUsername=
      - Service__ExchangeOnPremPassword=
      - Service__SharedSecret=
      - Service__OsVersion=Sendent-Sync
      - Service__DatabaseEncryptionKey=
      - Service__IntervalRefreshInMinutes=1
      - Service__MaxParallelProcessingUsers=5
      - Service__BatchLimit=60
      - Service__ForceRefreshCredentialsUsersStartUp=false
      - ConnectionStrings__DatabaseConnectionString=Host=sendent.synchronisation.db;Port=5432;Username=pguser;Password=pguser;Database=pgdb

Self-signed certificates

Often on-premise Microsoft Exchange environments come with self-signed certificates. In order to get that working you must do the following.

  1. Volume will be added
  2. Certificate will be installed in container on start-up.

In this example the certificate name is your-ca.crt, modify that name that it reflects the actual certificate name. It is possible to install PEM certificate format as well. 

Then place your certificate file where the volume is located sendentsynchronisersettings. Modify the following docker-compose.yml file, that it reflects your situation. These are the important parts to get it working

  1. volume was added
  2. entrypoint was added

Note for the entrypoint, that '/app/settings/your-ca.crt' reflects the actual filename of your certificate.

version: '3.4'

services:
  sendent.synchronisation.service:
    image: rg.nl-ams.scw.cloud/sendent-public/sendent-sync:latest
    build:
      context: .
      dockerfile: Dockerfile
    restart: on-failure
    volumes:
      - ./sendentsynchronisersettings:/app/settings
    environment:
      - Service__NextcloudBaseUrl=
      - Service__NextcloudServiceUsername=
      - Service__NextcloudServicePassword=
      - Service__MicrosoftTenantId=
      - Service__MicrosoftAppId=
      - Service__MicrosoftClientSecret=
      - Service__ExchangeType=1
      - Service__ExchangeOnPremUrl=https://outlook.office365.com/EWS/Exchange.asmx
      - Service__ExchangeOnPremDomain=
      - Service__ExchangeOnPremUsername=
      - Service__ExchangeOnPremPassword=
      - Service__SharedSecret=
      - Service__OsVersion=Sendent-Sync
      - Service__DatabaseEncryptionKey=
      - Service__IntervalRefreshInMinutes=1
      - Service__MaxParallelProcessingUsers=5
      - Service__BatchLimit=60
      - Service__ForceRefreshCredentialsUsersStartUp=false
      - ConnectionStrings__DatabaseConnectionString=Host=sendent.synchronisation.db;Port=5432;Username=pguser;Password=pguser;Database=pgdb
    entrypoint: ["/bin/sh", "-c", "cp '/app/settings/your-ca.crt' /usr/local/share/ca-certificates/ && update-ca-certificates && dotnet Sendent.Synchronisation.Service.dll"]


Was this article helpful?