> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/developer-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/developer-documentation/deploying/vms/network-optix/configuration.md).

# Configuration

Start the EyePop Vision AI container and approve it in NX

Install EyePop Vision AI on the machine that runs Docker, approve it in the NX desktop client, and add your EyePop API key.

## Before you start

You'll need:

* An NX Server prepared as in [Prerequisites](https://docs.eyepop.ai/developer-documentation/deploying/vms/network-optix/prerequisites.md)
* An EyePop account
* An [EyePop API key](https://docs.eyepop.ai/developer-documentation/api-keys)

{% stepper %}
{% step %}

#### Create a folder and .env file

On the machine that runs Docker, create a new folder and add a `.env` file:

```dotenv
# EyePop image
EYEPOP_IMAGE=registry.eyepop.ai/vms-bridge/eyepop-nx-integration
EYEPOP_IMAGE_TAG=<version>

# The NX Server. This address is for Docker on the NX Server machine.
EYEPOP_NX__URL=https://host.docker.internal:7001

# Any four digits. The NX administrator enters it to approve EyePop Vision AI.
EYEPOP_NX__PIN_CODE=4821
```

| Variable                           | Description                                                                                                                                                                                                                                                                               |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `EYEPOP_IMAGE`, `EYEPOP_IMAGE_TAG` | The image path and version to pull.                                                                                                                                                                                                                                                       |
| `EYEPOP_NX__URL`                   | **Required.** The NX Server, as reached from inside the container. With Docker on the NX Server machine, use `https://host.docker.internal:7001`. With Docker on another machine, use `https://<nx-server-ip-or-hostname>:7001`. Change the port if your server doesn't listen on `7001`. |
| `EYEPOP_NX__PIN_CODE`              | **Required.** Any four digits, for example `4821`. Share it with whoever approves integrations on your site: they enter it to approve EyePop Vision AI.                                                                                                                                   |
| `EYEPOP_NX__VERIFY_TLS`            | Optional, `false` by default. NX ships with a self-signed certificate; set `true` once the server has a trusted one.                                                                                                                                                                      |
| `EYEPOP_LOG__LEVEL`                | Optional, `INFO` by default. `DEBUG`, `INFO`, `WARNING`, or `ERROR`.                                                                                                                                                                                                                      |

{% hint style="warning" %}
A site with several NX Servers needs one EyePop Vision AI container for each server that hosts cameras, each with that server's address.
{% endhint %}
{% endstep %}

{% step %}

#### Docker Compose file

Create a new file `compose.release.yaml` in the same folder as `.env`:

```yaml
name: eyepop

services:
  eyepop-nx-integration:
    container_name: eyepop-nx-integration
    image: ${EYEPOP_IMAGE}:${EYEPOP_IMAGE_TAG}
    env_file:
      - .env
    extra_hosts:
      - "host.docker.internal:host-gateway"
    volumes:
      - nx-integration-data:/app/data
    tmpfs:
      - /tmp
    read_only: true
    restart: unless-stopped

volumes:
  nx-integration-data:
```

{% hint style="warning" %}
The `nx-integration-data` volume keeps EyePop Vision AI's approval. If it is removed, the integration has to be approved in NX again.
{% endhint %}
{% endstep %}

{% step %}

#### Start container

From the folder containing your `.env` and `compose.release.yaml`, run:

```shell
docker compose -f compose.release.yaml up -d
```

Then check its log:

```shell
docker compose -f compose.release.yaml logs -f
```

Once it has reached the NX Server, the log asks for approval:

```
Registered with NX. To finish setup, approve 'EyePop Vision AI' with PIN 4821 in the NX client (Site Administration → Integrations).
```

{% endstep %}

{% step %}

#### Approve EyePop Vision AI

In the NX desktop client, open the top menu > *Site Administration* > *Integrations*. Select *EyePop Vision AI*, enter the PIN from your `.env`, and click *Approve*.

The container's log shows `Approved` and then `Connected to NX`.
{% endstep %}

{% step %}

#### Set API key

Close the integration's settings and open them again from *Site Administration* > *Integrations* > *EyePop Vision AI*. Under **EyePop**, paste your EyePop API key into **API key** and click *Apply*.

{% hint style="info" %}
The settings shown right after approving can be out of date: the `default` workflow under **Workflows** may look empty until you close and reopen them.
{% endhint %}

Leave **EyePop URL** empty to use EyePop's cloud. Only an on-premises EyePop needs it.
{% endstep %}
{% endstepper %}

### Next steps

* [Running Detection](https://docs.eyepop.ai/developer-documentation/deploying/vms/network-optix/running-detection.md) — turn EyePop on for a camera and see bounding boxes.
* [Workflows](https://docs.eyepop.ai/developer-documentation/deploying/vms/network-optix/workflows.md) — control what each camera detects.
