# Quick Start: Deploying via Docker (Single Instance)

Source: https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/deploying-via-docker-single-instance

This guide explains how to install and deploy the **Nextcloud Exchange Connector** in a **Single-instance** architecture using Docker.

## Pre-requirements

Before deploying the application, ensure the following dependencies are ready and reachable by the connector:

1. The Nextcloud service account details are available ([Configuring Nextcloud](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/configuring-nextcloud))
2. The Exchange service account or app registration details are configured (Refer to [Authentication &amp; Prerequisites](https://help.sendent.com/nextcloud-exchange-connector-1/9739/authentication-prerequisites)
    
    articles)
3. A supported database is available and reachable from the application

**Which databases are supported?**

- PostgreSQL ([PostgreSQL official installation guide](https://www.postgresql.org/docs/current/tutorial-install.html))
- Microsoft SQL Server ([Microsoft SQL Server official installation guide](https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server?view=sql-server-ver17))
- MariaDB ([MariaDB official installation guide](https://mariadb.com/docs/server/mariadb-quickstart-guides/installing-mariadb-server-guide))
- MySQL ([MySQL official installation guide](https://dev.mysql.com/doc/mysql-installation-excerpt/5.7/en/))



4. Docker is installed on your host machine ([Docker official installation guide](https://docs.docker.com/engine/install/))

## Step 1. Prepare the Deployment Files

1. Create a dedicated deployment directory on your host machine to store your configuration files.
2. Navigate to the [Docker Compose Deployment Files](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/docker-compose-deployment-files) article and copy the required `.yml` configurations. Save them as standard text files inside your new directory, ensuring the filenames match exactly. For a minimal single-instance setup, you need:
    
    
    1. The base `docker-compose.yml`
    2. A database configuration file like `docker-compose.postgres.yml` (Optional: only needed if you want Docker to host your database).

In most cases you do not need to alter docker-compose.yml.

Compose reads settings from your .env file automatically. However, some variables aren't listed under its environment: section yet, so their .env values are ignored until you add them there directly.



The provided configuration will automatically pull the latest official container image from the public repository: `rg.nl-ams.scw.cloud/sendent-public/sendent-sync:latest`

## Step 2. Configure the Environment Variables (`.env`)

**Why this is needed:** The application requires credentials and connection strings to communicate with Nextcloud, Exchange, and your database.

Create the `.env` file by copy-pasting the following code **in the same directory** as your Docker compose files:

.env Code

```bash
# Database Configuration
# Allowed Database types: Postgres(0), SqlServer(1), MariaDB(2), MySql(3)
DatabaseConfiguration__DatabaseType=0
DatabaseConfiguration__DatabaseEncryptionKey=YourSuperSecretKey123!
DatabaseConfiguration__ConnectionString=Host=postgres_db;Port=5432;Database=SendentDB;Username=postgres;Password=YourStrong!Pass123

# Exchange Configuration
# Allowed Exchange Types: Cloud(1), OnPremKerberos(2), OnPremBasicAuth(3), OnPremADFS(4)
Service__ExchangeConfiguration__ExchangeType=1
Service__ExchangeConfiguration__ExchangeOnPremUrl=https://outlook.office365.com/EWS/Exchange.asmx
Service__ExchangeConfiguration__ExchangeOnPremDomain=your-domain
Service__ExchangeConfiguration__ExchangeOnPremAdfsAuthorityUrl=your-adfs-authority-url
Service__ExchangeConfiguration__ExchangeTenantId=your-exchange-tenant-id
Service__ExchangeConfiguration__ExchangeAdminFile=

# Sync Clients — REQUIRED. Without this block, no EventSyncClients are registered
# and synchronization will not run.
EventSyncClients__0__Identifier=ews
EventSyncClients__0__Provider=Ews
EventSyncClients__0__Settings__ExchangeType=1
EventSyncClients__0__Settings__TenantId=your-exchange-tenant-id
EventSyncClients__0__Settings__AppId=your-app-id
EventSyncClients__0__Settings__ClientSecret=your-client-secret

EventSyncClients__1__Identifier=dav
EventSyncClients__1__Provider=Dav
EventSyncClients__1__Settings__BaseUrl=your-nextcloud-base-url
EventSyncClients__1__Settings__ServiceUsername=your-nextcloud-admin
EventSyncClients__1__Settings__ServicePassword=your-nextcloud-password
EventSyncClients__1__Settings__SharedSecret=your-shared-secret

# Sync Pairs and Priority — REQUIRED
EventSync__Pairs__0__SourceClientId=ews
EventSync__Pairs__0__TargetClientId=dav
EventSync__CalendarPriorityOrder__0=ews
EventSync__CalendarPriorityOrder__1=dav

# Logging (Serilog & Loki)
# default is Information; set explicitly for production
Serilog__MinimumLevel__Default=Error
Service__LoggingConfiguration__LogsOutput=3
```



To understand the meaning of each parameter in `.env` file, refer to the [Configuring the .env File](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/configuring-the-env-file).

**Warning: Escaping Special Characters in Docker**

When configuring passwords, connection strings, or secrets in your `.env` file, be aware of Docker's character constraints. Specifically, the dollar sign (`$`) is reserved for variable interpolation. If your actual password contains a literal `$`, you **must** escape it by doubling the character (e.g., a password of `Pa$word` must be written as `Pa$$word` in the `.env` file).

**Failure to escape this will cause Docker to drop the character, resulting in severe authentication errors.**



**Warning: Shared Secret Mismatch**

Your `Service__NextcloudConfiguration__SharedSecret` value must **exactly match** the shared secret configured in the Sendent Sync app within your Nextcloud web interface.



**Warning: Strict File Naming**

The environment file must be named exactly `.env` with no prefix. Naming the file like `settings.env` will cause Docker to fail to read the configuration.



## Step 3. Set Up Exchange Credentials (`admins.json`)

Inside your deployment folder, create a directory named `exchangeAdmins` and place your `admins.json` file inside it. Update your `.env` file to point to this file (e.g., `Service__ExchangeConfiguration__ExchangeAdminFile=globalAdmins/admins.json`).

**Pro Tip for Environments:** You can organize multiple JSON files in subfolders (e.g., `testAdmins/admins.json` or `globalAdmins/admins.json`). To switch environments, simply update the file path in your `.env` variable without needing to rebuild or rewrite files.



**Warning: Do Not Mix Exchange Types**

Do not mix different Exchange connection types (e.g., Cloud and On-Premise) in a single `admins.json` file. The application instance connects to one specified Exchange type at a time. The `"ExchangeType"` field inside the `admins.json.example` file acts merely as a visual comment. The actual active connection type is dictated strictly by the `Service__ExchangeConfiguration__ExchangeType` parameter in your `.env` file.



Refer to [Managing Service Accounts (admins.json)](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/managing-exchange-service-accounts) article to know more about managing service accounts.

## Step 4. Start the Application

These commands tell Docker to pull the required images, map the volumes, and start the containers in the background.

The Sendent deployment is modular. You must build your startup command by chaining `-f` flags depending on which database and monitoring tools you want Docker to host for you.

Build your command by starting with the base file, adding your optional components, and ending with `up`:

**1. The Base Command (Required):** `docker compose -f docker-compose.yml`

**2. Append your Database Container (Optional if using an external DB):**

- For PostgreSQL: `-f docker-compose.postgres.yml`
- For MariaDB: `-f docker-compose.mariadb.yml`
- For SQL Server: `-f docker-compose.sqlserver.yml`

**3. Append Monitoring (Optional):**

- For Loki &amp; Grafana: `-f docker-compose.grafana.yml`

**Examples of complete commands:**

*Running with a local PostgreSQL container and Grafana:*

```bash
docker compose -f docker-compose.yml -f docker-compose.postgres.yml -f docker-compose.grafana.yml up
```

*Running with an external database (no local DB container) and no Grafana:*

```bash
docker compose -f docker-compose.yml up
```

## Step 5. Verify Container Status

**Why this is needed:** To ensure the primary synchronization service and your database containers are running without startup crashes.

Run the following command in your terminal:

```bash
docker compose ps
```

## Step 6. Monitor Application Logs

**Why this is needed:** Logs are essential for verifying successful synchronization, reviewing scheduled runs, and troubleshooting errors.

To view real-time console logs, your `Service__LoggingConfiguration__LogsOutput` parameter in the `.env` file should be set to `1`



Run:

```bash
docker compose logs
```

For comprehensive instructions on configuring alternative logging methods (such as Grafana or File System), please refer to [Logging &amp; Monitoring](https://help.sendent.com/nextcloud-exchange-connector-1/9742/logging-monitoring).

For handling self-signed certificates in On-Premise Exchange setups, see [Advanced: Handling Self-Signed Certificates (On-Premise Exchange)](https://help.sendent.com/sendent-nextcloud-workspace/nextcloud-for-exchange/handling-self-signed-certificates-on-premise-exchange) article.

## Next Step

[Logging &amp; Monitoring](https://help.sendent.com/nextcloud-exchange-connector-1/9742/logging-monitoring)
