# Installation within a Docker container

{% tabs %}
{% tab title="Docker" %}

#### Deployment <a href="#deployment" id="deployment"></a>

1. To install the **GitProtect** **worker** within a **Docker** container, use the images available on **Docker Hub** (or download the image from the [**Xopero** website](https://xopero.com/download/xopero_one/latest/client-image.tar)):

```docker
docker pull xopero/gitprotect-agent:latest
```

2. Create a host directory for the **GitProtect Management Service** container databases (which are located at `/app/Xopero` inside the container) to store databases outside the container:

```docker
mkdir -p /opt/gitprotect-agent/data
```

3. Run the container with the correct volume mounting and environment variables using the following command:

```docker
docker run -v /host/path:/container/path -e ENV_VAR=value image_name
```

```docker
docker run -d \
  --name <container_name> \
  -e ManagementServiceUrl="<your_gitprotect_service_URL>" \
  -e XoperoOverriddenHostName="<device_name>" \
  -v /opt/gitprotect-agent/data:/app/Xopero \
  --restart unless-stopped \
  xopero/gitprotect-agent:latest
```

{% code title="Example" overflow="wrap" %}

```docker
docker run -d \
  --name xopero-worker\
  -e ManagementServiceUrl="https://192.168.1.10:28555" \
  -e XoperoOverriddenHostName="Docker_agent" \
  -v /opt/gitprotect-agent/data:/app/Xopero \
  --restart unless-stopped \
  xopero/gitprotect-agent:latest
```

{% endcode %}

4. Check if the container works correctly by using the following command:

```docker
docker ps
```

5. Once all the above steps are completed, the **worker** will report to the **Management Service** panel for activation.
   {% endtab %}

{% tab title="QNAP NAS (CS > 3.0)" %}

<p align="center"><a href="#prerequisites" class="button primary" data-icon="circle-1">Prerequisites</a> <a href="#environment_setup" class="button primary" data-icon="circle-2">Environment setup</a> <a href="#deployment-1" class="button primary" data-icon="circle-3">Deployment</a></p>

#### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

**QNAP** with:

* x86 or x64 CPU (<mark style="color:red;">**ARM is not supported**</mark>)
* minimum 2GB RAM
* **Container Station** app from **AppCenter**

***

#### Environment setup <a href="#environment_setup" id="environment_setup"></a>

1. Download the **Container Station** app from the **AppCenter**.
2. Login to your **QNAP** web panel and open the **AppCenter** application. In **QNAP Store**, select **All Apps** and search for the **Container Station**.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-aadd67109846d6a9ac11c8f5e5375e3fc94d6304%2Fimage%20(882).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-13d4a7dfd6a8b883466a570a0e9742320cf057d3%2Fimage%20(883).png?alt=media" alt=""><figcaption></figcaption></figure>

3. Download and open the application. Select the path that will be used as a directory for your **Docker** container data, and click **Start Now** to proceed.

***

#### Deployment <a href="#deployment" id="deployment"></a>

1. Open the **Container Station** application, select the **Containers** tab, and click the **Create** button.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-d0040a60c19c9d1bcbe9f75e21ba9e16d6d45623%2Fimage%20(811).png?alt=media" alt=""><figcaption></figcaption></figure>

2. In **Image Configuration** choose the **Advanced mode** option. In the image type, select **Docker image**, and in the **Image** field, paste the following command:

```docker
xopero/gitprotect-agent:latest
```

3. Ensure the **Try pulling image from the registry before creating the container** option is checked, and hit **Next**.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-1d008cb425585c02480f93c52c6eb9c33c7b39e2%2Fimage%20(884).png?alt=media" alt=""><figcaption></figcaption></figure>

4. Within the **Configure Container** tab, the form contains several fields, with the most crucial being:

> **Name** — here you can set a custom name for the container
>
> **Restart policy** — defines if the container will star automatically in case of, for example, **QNAP** restart

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-9c89b941107c304671917b0cb62a743e8c911db5%2Fimage%20(819).png?alt=media" alt=""><figcaption></figcaption></figure>

5. In the **Configure Container** tab, navigate to ⚙️**Advanced Settings**.
6. Go to the **Environments** section and click **Add New Variable** to add new environment variables with the following values:

{% code title="ASPNETCORE\_URLS" overflow="wrap" %}

```docker
http://+:80
```

{% endcode %}

{% code title="DOTNET\_RUNNING\_IN\_CONTAINER" overflow="wrap" %}

```docker
true
```

{% endcode %}

{% code title="ManagementServiceUrl" overflow="wrap" %}

```docker
GitProtect Management Service address
```

{% endcode %}

{% code title="XoperoOverriddenHostName" %}

```docker
your custom QNAP container name
```

{% endcode %}

{% hint style="warning" %}
Replace `GitProtect Management Service address` with your **GitProtect Management Service** addres&#x73;**\***.
{% endhint %}

**‼️\*ManagementServiceUrl** – your **GitProtect Management Service** (address in one of the following formats (depending on the deployment model):

> a. `http://ipaddress:port`, i.e., `http://192.168.0.1:28555`
>
> b. `https://XMSID.ads.xopero.com`, i.e., `https://a00b0dc0-0116-0000-0000-d0000028960e.ads.xopero.com`

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-401723696b107a8117ea9f21d9dd7ec486a9b692%2Fimage%20(821).png?alt=media" alt=""><figcaption><p><em>Example of correctly filled environments variables.</em></p></figcaption></figure>

7. Click **Apply** to save your changes.
8. Navigate to **Storage** tab — here you can mount your **QNAP** volumes to the **GitProtect** **worker Docker** container.

{% hint style="success" %}
You can mount multiple directories to the container using **Add Volume** button and repeating the operation.
{% endhint %}

{% hint style="info" %}
To back up data from your **QNAP** device, choose **Bind Mount Host Path** under **Add Volume** drop-down menu — it lets you specify which data the **GitProtect** container can access. Select a directory from the host and enter the path visible inside the container in the **Container** field.
{% endhint %}

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-cae346db28c367165f31574eb3d2a7522fd62567%2Fimage%20(822).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-223f4220e0a9622ab34f208129d8249ee77697a1%2Fimage%20(823).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

9. Next, double-check and confirm your settings, then click **Finish** to create the container.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-fd704e24682f8f6593a20bff2c416e613a0b00d5%2Fimage%20(824).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

10. **Container Station** will download the latest **GitProtect** image and create the container based on that image.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-a1b7e1ac4913934f5439ed4ccddc872be440d10f%2Fimage%20(825).png?alt=media" alt=""><figcaption></figcaption></figure>

11. Once the container creation process is completed, your new container will be visible under **Container** tab in **Container Station**.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-85bf252b80b75906d6d930e85bda20531b53231c%2Fimage%20(826).png?alt=media" alt=""><figcaption></figcaption></figure>

12. You can now connect to your **GitProtect Management Service** admin panel to activate the **worker**.
    {% endtab %}

{% tab title="QNAP NAS (CS < 3.0)" %}

<p align="center"><a href="#prerequisites-sec" class="button primary" data-icon="circle-1">Prerequisites</a> <a href="#environment_setup-sec" class="button primary" data-icon="circle-2">Environment setup</a> <a href="#deployment-sec" class="button primary" data-icon="circle-3">Deployment</a></p>

#### Prerequisites <a href="#prerequisites-sec" id="prerequisites-sec"></a>

**QNAP** with:

* x86 or x64 CPU (<mark style="color:red;">**ARM is not supported**</mark>)
* minimum 2GB RAM
* **Container Station** app from **AppCenter**

***

#### Environment setup <a href="#environment_setup-sec" id="environment_setup-sec"></a>

1. Download the **Container Station** app from the **AppCenter**.
2. Login to your **QNAP** web panel and open the **AppCenter** application. In **QNAP Store**, select **All Apps** and search for the **Container Station**.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-aadd67109846d6a9ac11c8f5e5375e3fc94d6304%2Fimage%20(882).png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-13d4a7dfd6a8b883466a570a0e9742320cf057d3%2Fimage%20(883).png?alt=media" alt=""><figcaption></figcaption></figure>

3. Download and open the application. Select the path that will be used as a directory for your **Docker** container data, and click **Start Now** to proceed.
4. Once done, download the **GitProtect** **worker Docker** image, which is available [on our official server](https://xopero.com/download/xopero_one/latest/client-image.tar).

***

#### Deployment <a href="#deployment-sec" id="deployment-sec"></a>

1. Open the **Container Station** application and navigate the **Import** tab.
2. Click the ➕**Import** button to upload the previously downloaded **Docker** image file.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2F5Pih5ljjxIfjv5lNB9kg%2FImporting%20the%20docker%20file.png?alt=media&#x26;token=da8884f5-b541-4f81-b461-4e7861ec044d" alt="Importing the docker file"><figcaption></figcaption></figure>

3. In **Create Import Task** window, select the source type and file path of the **GitProtect** worker**Docker** image and hit **Next** to continue.

{% hint style="info" %}
Selecting a file from a local source enables you to choose files stored on your device. Alternatively, you can use the **NAS** option to access files directly from **QNAP**.
{% endhint %}

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Ff0K23kBAaBFbFKSXnNSc%2FCreating%20import%20task.png?alt=media&#x26;token=269a628c-7431-445d-a9d8-5872d5545993" alt="Creating import task" width="375"><figcaption></figcaption></figure>

4. Within the **Create Container** tab, the form contains several fields, with the most crucial being:

> **Name** — here you can set a custom name for the container
>
> **Auto start** — defines if the container will star automatically in case of, for example, **QNAP** restart
>
> **CPU Limit** — allows you to specify the percentage of CPU usage allocated for the container
>
> **Memory Limit** — RAM limit for the container

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2FmMCZrCxBR9b4pKJ40Meh%2FCreating%20container.png?alt=media&#x26;token=4946a995-c061-4173-bf80-5ffd714842e0" alt="Creating container"><figcaption></figcaption></figure>

5. Click the ⚙️**Advanced Settings >>** button and navigate to the **Environment** section.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-b04f178a2b7f716aafea1e5604d19414abc9cc33%2Fimage%20(885).png?alt=media" alt=""><figcaption></figcaption></figure>

6. To add a new environment variable, click the **Add** button, name it **ManagementServiceUrl**, and set its value to your **GitProtect Management Service** addres&#x73;**\***.

**‼️\*ManagementServiceUrl** – your **GitProtect Management Service** address in one of the following formats (depending on the deployment model):

> a. `http://ipaddress:port`, i.e., `http://192.168.0.1:28555`
>
> b. `https://XMSID.ads.xopero.com`, i.e., `https://a00b0dc0-0116-0000-0000-d0000028960e.ads.xopero.com`

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2FIe3jlf6PoZnWsNahmhCS%2Fcreate%20container.png?alt=media&#x26;token=2ff04f10-64ee-4510-a311-8c8f1247bd3b" alt="create container"><figcaption></figcaption></figure>

7. Go to the **Shared Folders** section — here you can mount your **QNAP** volumes to the **GitProtect** **worker** **Docker** container.

{% hint style="success" %}
You can mount multiple directories to the container using **Add** button in **Volume from host** section and repeating the operation.
{% endhint %}

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2FrHly3YxbpFL3oeXb5uzP%2FSetting%20shared%20folders.png?alt=media&#x26;token=942e9351-fa28-4c90-9959-5312f83c9bfd" alt="Setting shared folders"><figcaption></figcaption></figure>

8. To back up data from your **QNAP** device, choose **Add** under **Volume from host** section — it lets you specify which data the **GitProtect** container can access. Select a directory from the host in **Volume from host** field and enter the path visible inside the container in the **Mount Point** field.

{% hint style="info" %}
For instance, if you need to back up a directory named **Backup** inside a public shared folder, set the **Volume from the host** field to `/Public/Backup`. The **Mount Point** can be different, i.e., `/Backup`.
{% endhint %}

9. Once you're done with the above steps, click **Create** to continue.
10. In the **Summary** window double-check your settings, then click **OK** to finish the configuration.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2FHusxTmb5wa47aqgp3NHs%2FSummary%20window.png?alt=media&#x26;token=551de2a9-5b6c-445e-8a94-ea64984d5368" alt="Summary window"><figcaption></figcaption></figure>

10. You can now connect to your **GitProtect Management Service** admin panel to activate the agent.
    {% endtab %}

{% tab title="Synology NAS" %}

#### Deployment

{% hint style="warning" %}
To deploy the **GitProtect** **worker** on a **Synology** device using **Docker**, use the **Container Manager** application. If it's not installed, download it from the **Package Center**.
{% endhint %}

1. Navigate to the **Container** tab and click the **Create** button. Expand the **Image** section and click **Add image**, then search for `xopero/gitprotect-agent` image.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-3eb1f63a8bd236e0e9548e934d02884779c7714a%2F1%20(6).PNG?alt=media" alt="" width="563"><figcaption></figcaption></figure>

2. Select the image, click **Download**, and choose the version tagged as latest. Click **Select** to confirm.
3. Once the image is downloaded, select it from the **Image** field drop-down menu.
4. Next, define a custom name for the container. Additionally, configure container resource limits if needed.
5. Check the **Enable auto-restart** option to ensure the container automatically restarts when the device reboots, then click **Next** to proceed.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-ffa1807b0ad4bbfc0df75ae61414e16e3d27cf76%2F2.PNG?alt=media" alt="" width="563"><figcaption></figcaption></figure>

6. In the **Volume Settings** section, click the ➕**Add Folder** button, and select directories that require protection. The container needs to have external directories mounted to access them while performing backups.

{% hint style="info" %}
To protect data stored in the **Public** directory, select this folder and specify the same path to ensure consistency between the host and the container's file systems.
{% endhint %}

{% hint style="success" %}
You can mount multiple directories to the container by clicking ➕ **Add Folder** and repeating the operation.
{% endhint %}

7. Additionally, to ensure data persistence during container updates or maintenance operations, mount **worker** databases to an external directory. These databases are located in `/app/Xopero` and should be mapped to a designated location outside the container to avoid data loss or inconsistency.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-34b203c05021f43e5558087cd317dd4e8cc85e01%2F3%20(4).PNG?alt=media" alt=""><figcaption></figcaption></figure>

8. Next, in the **Environment** section, define the required variables:

> **ManagementServiceUrl** — your **GitProtect Management Service** address in one of the following formats (depending on the deployment model):
>
> a. `http://ipaddress:port`, i.e., `http://192.168.0.1:28555`
>
> b. `https://XMSID.ads.xopero.com`, i.e., `https://a00b0dc0-0116-0000-0000-d0000028960e.ads.xopero.com`
>
> **XoperoOverriddenHostName** — specify worker's name to facilitate identification

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-a45da56b14a395a6a73b701998ac2a087f052f06%2F4%20(1).PNG?alt=media" alt=""><figcaption></figcaption></figure>

9. Click **Next** to confirm the configuration. In **Summary** window, double-check your settings and if they're all correct, hit **Done** to finalize the process.

<figure><img src="https://696332517-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtsE6XtJyUIEKVdSxPlS3%2Fuploads%2Fgit-blob-8ab9b881984ccc6df3753e971b1df7253c02cfc1%2F5%20(1).PNG?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}
