Skip to content

Docker and Deployment

farzad edited this page Oct 7, 2026 · 2 revisions

Docker and Deployment

Docker

docker build -t peykan .
docker run -d --name peykan -p 6278:6278 peykan

Then use http://localhost:6278/sse and http://localhost:6278/dashboard as usual.

The image (Dockerfile, Ubuntu 22.04, Python 3.10) installs the pinned requirements.txt and the package, runs as a non-root user, and starts peykan demo --port 6278, so the simulator and server share one process and one virtual bus. It sets PEYKAN_MCP_HOST=0.0.0.0 so the port mapping works (the server otherwise listens on loopback only). A health check calls /healthz every 30 s.

Compose

cd docker
docker compose up -d --build

One peykan service running demo. The simulator and server must stay in one container: separate containers can't share the virtual bus.

Real hardware in a container

Run peykan server instead of demo, and give the container access to the adapter: for SocketCAN that means host networking (--network host) with the can0 link configured on the host; for USB adapters, pass the device through. Set PEYKAN_CAN_INTERFACE / PEYKAN_CAN_CHANNEL and the transmit settings from Real Hardware and Safety.

Exposing the server

0.0.0.0 makes the tools reachable by anyone who can reach the port, with no authentication. Inside Docker on your own machine that's fine; on a shared network, keep it behind a firewall or an authenticating reverse proxy.

Releasing to PyPI

The package is published as peykan by .github/workflows/release.yml when a v*.*.* tag is pushed. The workflow refuses to publish if the tag doesn't match __version__ in src/peykan/__init__.py.

Release steps:

  1. Set __version__ in src/peykan/__init__.py, and move the changelog's "Unreleased" notes under a heading for the new version.
  2. Commit and push.
  3. Tag that commit and push the tag:
    git tag v0.2.1
    git push origin v0.2.1

PyPI can take a few minutes to list a new version; pip install --no-cache-dir peykan==0.2.1 fetches it directly.

The workflow currently authenticates with a PYPI_API_TOKEN secret. PyPI's trusted publishing (no stored token) is an optional upgrade.

Clone this wiki locally