Skip to content

Installation and startup

Requirements

  • Python ≥ 3.12
  • uv package manager

Install

uv sync

Run

Cang runs as two separate processes that share the same database and snapshot store.

Start the ingest daemon (cangcang):

uv run cangcang /path/to/cang.toml

Start the web server (cangjian) in a separate terminal or systemd service:

uv run cangjian /path/to/cang.toml

Or, after installing the package:

cangcang /path/to/cang.toml
cangjian /path/to/cang.toml

On startup cangcang will:

  1. Open (or create) the SQLite database at <output_dir>/cang.db.
  2. Scan each configured camera root for existing snapshots and ingest any that are not yet in the database. Snapshots are stored under <output_dir>/<camera-name>/snapshots/<YYYY-MM-DD>/ (see storage layout).

cangjian starts the web UI on http://<host>:<port> (default: http://0.0.0.0:8080). It does not scan cameras or run cleanup — those are cangcang's job.

New snapshots are picked up by cangcang on each periodic scan — by default every 300 seconds. Lower scan_interval in your config for faster pickup.

Configuration

See config.md for a full reference. Minimum working example:

[server]
output_dir = "/var/lib/cang/snapshots"

[[camera]]
name = "front-door"
adapter = "dahua"
root = "/mnt/nvr/front-door"

Database location

The SQLite database is created at <server.output_dir>/cang.db. Ensure the process has read/write access to that directory.

Running in a container

Cang is also available as an OCI container image. See the container guide for Docker Compose and systemd Quadlet setup instructions.