# Deploying Custom Connectors

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

### Deploying Custom Connectors in Kubernetes

#### Prerequisites

* You have developed your custom connector. See [Developing Custom Connectors](https://docs.cybus.io/2-0-1/documentation/industry-protocol-details/custom-connectors/developing-custom-connectors).

#### Procedure

Custom connectors are packaged as container images. First, build and publish the image to a registry. Then, deploy it using the `connectware-agent` Helm chart. Finally, register it in the Connectware Admin UI.

1. Publish your custom connector to your preferred container registry.
2. Use the `connectware-agent` Helm chart - just as you would when [installing an agent](https://docs.cybus.io/2-0-1/documentation/agents/agents-in-kubernetes/installing-connectware-agents-using-the-connectware-agent-helm-chart) - to deploy your custom connector on Kubernetes. Make the following customizations in your `values.yaml` file:

   * **Custom registry**: Override the default image registry to point to your registry. See [Using a Custom Image Registry for the connectware-agent Helm Chart](https://docs.cybus.io/2-0-1/documentation/agents/agents-in-kubernetes/configuring-agents-with-the-connectware-agent-helm-chart/using-a-custom-image-registry-for-the-connectware-agent-helm-chart).
   * **Image name & tag**: Specify the image name and tag of your custom connector. See [Configuring image name & version for the connectware-agent Helm chart](https://docs.cybus.io/2-0-1/documentation/agents/agents-in-kubernetes/configuring-agents-with-the-connectware-agent-helm-chart/configuring-image-name-and-version-for-the-connectware-agent-helm-chart).

   Once the custom connector is deployed, access the Admin UI to register it and make it available for use.
3. To register the custom connector as an agent in Connectware, log in to the [Admin UI](https://docs.cybus.io/2-0-1/getting-started/admin-ui) and select **User** > **Client Registry**.
4. In the Client Registry view, click **Unlock** to allow the agent to register with Connectware.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-84ad638052b59056a08740bd02c5554a6f59db0f%2Fcustom_connectors_client_registry_1.png?alt=media" alt="Client Registry view showing the Unlock button."><figcaption></figcaption></figure>

5. Once the client appears in the list, click it.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-1d814de43baf075b59a0033a9012669f93b059c2%2Fcustom_connectors_client_registry_2.png?alt=media" alt="Client Registry view with a client listed."><figcaption></figcaption></figure>

6. In the **Grant Access** dialog, click **Allow**. By default, the default permissions are assigned to the client.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-834f48ec73abe6468877ea1b104631b665a91dc4%2Fcustom_connectors_client_registry_grant_access.png?alt=media" alt="Grant Access dialog in the Admin UI."><figcaption></figcaption></figure>

**Result:** You can now use your custom connector.
{% endtab %}

{% tab title="Docker" %}

### Deploying Custom Connectors in Docker

#### Prerequisites

* You have developed your custom connector. See [Developing Custom Connectors](https://docs.cybus.io/2-0-1/documentation/industry-protocol-details/custom-connectors/developing-custom-connectors).

#### Procedure

Custom connectors rely on pre-built Docker images, requiring you to specify the image tag during the build process.

1. Create a `docker-compose.yml` file. The following code example deploys the agent with a server with the `BASEIMAGE_VERSION` tag set to `2.0.0`.

{% code lineNumbers="true" %}

```bash
docker-compose build --build-arg BASEIMAGE_VERSION=2.0.0
```

{% endcode %}

**Example**

{% code lineNumbers="true" %}

```yaml
version: '2.4'
services:
  # Run the example server
  server:
    build: .
    network_mode: host # Using host network
    entrypoint: ''
    command: sh -c 'cd /app/src/protocols/custom/utils && node runServer.js'

  agent:
    build: .
    network_mode: host # Using host network
    volumes:
      - agentData:/data
    environment:
      CYBUS_HOSTNAME_INGRESS: localhost # Assuming Cybus Connectware to be reachable on local system
      CYBUS_AGENT_MODE: distributed
      CYBUS_AGENT_NAME: CustomConnectorAgent
      CYBUS_LOG_LEVEL: info

volumes:
  agentData:
```

{% endcode %}

2. To deploy your custom connector, use the following code:

{% code lineNumbers="true" %}

```bash
docker-compose up -d
```

{% endcode %}

```
Once the custom connector is deployed, access the Admin UI to register it and make it available for use.
```

3\. To register the custom connector as an agent in Connectware, log in to the [Admin UI](https://docs.cybus.io/2-0-1/getting-started/admin-ui) and select **User** > **Client Registry**. 4. In the Client Registry view, click **Unlock** to allow the agent to register with Connectware.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-84ad638052b59056a08740bd02c5554a6f59db0f%2Fcustom_connectors_client_registry_1.png?alt=media" alt="Client Registry view showing the Unlock button."><figcaption></figcaption></figure>

5. Once the client is registered, click it.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-1d814de43baf075b59a0033a9012669f93b059c2%2Fcustom_connectors_client_registry_2.png?alt=media" alt="Client Registry view with a client listed."><figcaption></figcaption></figure>

6. In the **Grant Access** dialog, click **Allow**. By default, the default permissions are assigned to the client.

<figure><img src="https://3981784145-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff0nDJzNyTKwsbixM8E4H%2Fuploads%2Fgit-blob-834f48ec73abe6468877ea1b104631b665a91dc4%2Fcustom_connectors_client_registry_grant_access.png?alt=media" alt="Grant Access dialog in the Admin UI."><figcaption></figcaption></figure>

**Result:** You can now use your custom connector.
{% endtab %}
{% endtabs %}
