Skip to main content
Skip table of contents

Gateway Deployment

Deployment (Docker Compose)

The primary deployment is two Docker containers orchestrated by Compose: an application container (Django + proxy tooling) and an nginx container (static files + reverse proxy).

Compose file location

In this repository the Compose file is:

docker/docker-compose.yml

Run Compose from the docker/ directory (or pass explicit paths) so that env_file: ./.env resolves to docker/.env.

Example:

CODE
cd docker
docker compose up -d

If your release package ships docker-compose.yml at the package root (as some package/start.sh flows expect), use that file path instead and keep .env beside it.

Services

app (gateway application)

  • Image name (local tag): camera-agent-gateway:<version> (version often matches package/version, e.g. 1.0.11, sometimes with a platform suffix in CI builds).

  • Purpose: Runs database migrations, collects static files, ensures an API token for the admin user, runs initialize_cameras.sh, then starts Django with runserver bound to 0.0.0.0:8000.

  • Volumes: static-data mounted at /vol/static so collected static assets are shared with nginx.

  • Environment: Loaded from ./.env next to the Compose file.

Startup command (abbreviated) runs:

  1. migrate

  2. collectstatic --noinput

  3. drf_create_token admin (intended to ensure a REST token for the admin user — ensure this management command exists in your build)

  4. initialize_cameras.sh — starts vxg-proxy-client for the gateway UUID and each active camera from SQLite

  5. runserver 0.0.0.0:8000 with access logs under /var/log/server/

nginx

  • Image name (local tag): uplink-gateway-nginx:<version>

  • Purpose: Serves /static/ from the shared volume and proxies / to http://app:8000.

  • Ports: 80:80 by default (host port 80 → container 80).

  • Depends on: app

  • Environment: APP_HOST=app, APP_PORT=8000, LISTEN_PORT=80 (see docker/Dockerfile.nginx).

Shared volume

  • static-data: Written by Django (STATIC_ROOT=/vol/static) and read by nginx for /static.

Building images

From CI / registry

GitLab CI (see .gitlab-ci.yml) builds:

  • Gateway image from docker/Dockerfile (x64) or docker/Dockerfile.arm (arm64), with BuildKit secrets for fetching the camera-agent artifact.

  • Nginx image from docker/Dockerfile.nginx.

Artifacts include *.img tarballs for loading with docker image load.

Local build (overview)

From the repository root, with Docker BuildKit and appropriate secrets (as required by the Dockerfile), build tags that match docker/docker-compose.yml:

CODE
# Example only — adjust tags and secrets to match your environment
docker build --secret id=gitlab_token,env=CAMERA_AGENT_ACCESS_TOKEN \
  -f docker/Dockerfile -t camera-agent-gateway:latest .

docker build -f docker/Dockerfile.nginx -t uplink-gateway-nginx:latest .

Set CAMERA_AGENT_GATEWAY_VERSION in the environment or Compose to pin image tags if you do not use :latest.

Packaged deployment (optional)

The package/ directory contains scripts (start.sh, stop.sh, env_setup.sh, etc.) that:

  • Detect architecture (x64 / arm64).

  • Load pre-built *.img images.

  • Prepare .env (see Gateway Configuration).

  • Run docker compose or docker-compose with project name camera_agent_gateway.

Consult package/start.sh for the exact filenames and layout expected in a shipped zip.

Health and logs

  • The app Dockerfile defines a HEALTHCHECK that runs python -m server.healthcheck (from the container workdir /code).

  • Application stdout/stderr from runserver may be redirected to /var/log/server/server-access.log per Compose command.

  • Camera and gateway proxy logs are written under /var/log/cameras/ and /var/log/server/ inside the app container.

Firewall and networking

  • Ensure TCP port 80 (or whatever you map for nginx) is reachable for UI and API clients.

  • initialize_cameras.sh uses the default gateway IP from the container’s routing table when forwarding; production networks may need additional routing or firewall rules for cameras and cloud connectivity.

Related documentation

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.