# Configuring and Running DBSync Cloud CDM On Docker

## Prerequisites

**Install Docker**

Download and install Docker Desktop from [Docker](https://www.docker.com/products/docker-desktop/).

### Configuration

Create a docker-compose.yml file in your project directory with the following content:

docker-compose.yml

```html
version: '3'
services:
  dbsync-cdm-local:
    container_name: dbsync-cloud-cdm
    image: dbsync/cloud-cdm:latest
    ports:
      - "8080:8080"
    environment:
      - system_dir=/opt/data/db/conf
      - profile_db_path=/opt/data/db
      - storage_path=/opt/data/profiles
    volumes:
      - docker-volume:/opt/data
volumes:
  docker-volume:
    external: true # Set to false to create a new volume automatically
```

### Explanation of Configuration

services:

* dbsync-cdm-local: Defines the Docker service for DBSync Cloud CDM.
* container\_name: Specifies the name of the Docker container (<mark style="color:green;">dbsync-cloud-cdm</mark>).
* image: Specifies the Docker image (<mark style="color:green;">dbsync/cloud-cdm:ext\_9.0.3</mark>) to use for DBSync Cloud CDM.
* ports: Maps port 8080 of the Docker container to port <mark style="color:green;">8080</mark> of the host.
* environment: Sets environment variables required by DBSync Cloud CDM, based on the provided configuration:
* <mark style="color:green;">system\_dir</mark>: Externalizes  app specific system properties.
* <mark style="color:green;">profile\_db\_path</mark>: Externalizes profile database (profile\_db.mv.db). Used to store Application users and roles along with Profile log entries.
* <mark style="color:green;">storage\_path</mark>: Externalizes profiles (<mark style="color:green;">config.properties)</mark>.
* volumes: Mounts a Docker volume (<mark style="color:green;">docker-volume</mark>) to <mark style="color:green;">/opt/data</mark> in the container.

{% hint style="info" %}
You can configure the <mark style="color:red;">environment</mark> and <mark style="color:red;">volumes</mark> in the provided docker-compose.yaml as per the requirement
{% endhint %}

#### Running the Application

1. Start Docker Containers:

* Open a terminal and navigate to the directory containing your docker-compose.yml file.
* Run the following command to start DBSync Cloud CDM:

| docker-compose up -d |
| -------------------- |

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfAf9z-zWv_yCP887xEvFzRybvVpIabbwZGONPC7y4a7M5ByG9hLE22luzmI_n0LmfAKehvgRvu0zoEHm2rur4-IJId36Hhcsmhc_vNWINZlYvprmePFX6fRDLnEaJod_HA7pLEfIFsGd7dMhRBsPa5N6I?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

2. Check the running containers

| docker ps |
| --------- |

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfpN7xQZGAXAB97hlwX-oTNMSeh43KX1qBxjmfp2AuMav4ZjgJl-KxyorcPWVyIRDpMo-5dFub6Vs_0rpXx02LuNCD20txvKb3Axh3QK-YVxygaUWMA8kH788gPYtmgLZNFCjPQ-IkyShTbQpMHENTkd_dW?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

3. Login into docker with below command

```html
# From git bash
winpty docker exec -it <container id> bash

#For other terminals
docker exec -it <container id> bash
```

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdPubQtSvjH3qwgH5iLi-iaQ3mxkrnyNB1zxidOT2WK7H1yIcszx0opiSuZc7Y1Ivjmh9-dPe6TaKPxum1KP8RN5UcFrgS9MZBtEYZOYLeY-7T6OW7gxjrZzl6RI_TaMrBo9ffuQ6WJTUrd2DPBsYpz2Wv2?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

4. Check tomcat logs&#x20;

```html
# change your current directory to logs
cd logs


# To check running logs 
# Note the log file will be displayed with date
tail -f catalina.***.log


# To check logs from the beginning of tomcat
cat catalina.***.log
```

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXcUvibefeC6OItDLYcHjudDHNL2PK7Vu5KTRXMWa_0BUUeK7LuEo7JtVxslnlEggBjbd9ugisiaXsM9mhqV4UOEyWaiqPCco4MMIY1rSJO2oXgdo4Y1FIyYZ0mhSTRCwjjLPp62LE8xSiQ6SCEWOKHcsCTJ?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

5. Access DBSync Cloud CDM:

* Once Docker Compose has started the containers, access DBSync Cloud CDM at <http://localhost:8080/dbsync> in your web browser.

### Accessing application User Interface

You can open the following URL in your browser(with Javascript enabled)

<http://localhost:8080/dbsync>

Default login:

Username: admin\@localhost

Password: admin

Password can be changed after you login by heading to administration page, additional roles and users can also be added&#x20;

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXdMyoQL24sCnmNDg1xJ1ZzqnbuZHLq2ZtPAX3BVkGLAmCtN90Pyny6lnpbaOxKmKoqpYc8lpsTqAbHAA7uSkqb3oGlAiJoR1Kq_Zcv58HzZPiBphab-O1tBW1aQHtqrnUqBh3m8Rnq7OrlRCQskEbAOhRj3?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

<figure><img src="https://lh7-us.googleusercontent.com/docsz/AD_4nXfxXPQ1iqa6Dgv4_x7hRZOLxsyTMUEkxIMTYdkd69ydNXY-mNWtSK-6ndb258ISGf709az62hej0fj1f8ifEPffY39pOsoe7X5JnOutCrPXZGgPTwuqgOaIJSCgX1IYkd84dDcnH0aqUz7P_6ajidm4yisz?key=s7KuN0DwzritoLmJUJlcKA" alt=""><figcaption></figcaption></figure>

You can follow the [documentation](https://docs.mydbsync.com/cloud-replication-main) for more details on how to configure and get started with the replication of data.
