From 524359de9f4f9909058b904fe3790213befb7ca9 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 9 Jun 2026 13:14:47 -0400 Subject: [PATCH] Made requested changed to docker setup --- .env.example | 8 +++++++ .gitignore | 1 + README.md | 53 ++++++++++++++++++++++++++++++++++------------ docker-compose.yml | 26 +++++++++++------------ 4 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..4128bc4 --- /dev/null +++ b/.env.example @@ -0,0 +1,8 @@ +# Docker image tag or fully qualified image reference. +PYMC_REPEATER_IMAGE=pymcdev/pymc-repeater:main + +# Host group IDs used for GPIO and SPI device access. +# Raspberry Pi OS commonly uses 986 for gpio and 989 for spi, but check your +# host with `getent group gpio` and `getent group spi`. +GPIO_GID=986 +SPI_GID=989 diff --git a/.gitignore b/.gitignore index 4cacd56..3c56d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ htmlcov/ *~ # Config +.env config.yaml config.yaml.backup identity.json diff --git a/README.md b/README.md index 37444c2..4a52561 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,13 @@ integrations. - [Policy Engine](#policy-engine) - [Upgrading](#upgrading) - [Proxmox LXC Installation](#proxmox-lxc-installation) +- [Uninstallation](#uninstallation) - [Docker Compose](#docker-compose) +- [Roadmap](#roadmap) - [Contributing](#contributing) - [Support](#support) +- [Disclaimer](#disclaimer) +- [License](#license) ## Overview @@ -388,21 +392,36 @@ The script prompts before each optional removal step. ## Docker Compose -You can run pyMC Repeater in Docker using the published image: +You can run pyMC Repeater in Docker using the published image. -```yaml -image: ${PYMC_REPEATER_IMAGE:-pymcdev/pymc-repeater:main} +Copy `.env.example` to `.env` before starting: + +```bash +cp .env.example .env ``` +Set `GPIO_GID` and `SPI_GID` from `getent group gpio` and `getent group spi` +if your host values are different. + +Default storage should use Docker named volumes. This avoids Portainer creating +root-owned `./config` and `./data` bind mount folders on first start. If you +want host bind mounts, use absolute host paths and pre-create/chown them to +`15888:15888`. + +Do not mount `./config.yaml:/etc/pymc_repeater/config.yaml`; Docker can create +that source as a directory, which breaks startup. + ### Setup -1. Configure `docker-compose.yml` for your hardware and device paths. -2. Comment out or remove device mappings that do not apply to your hardware. -3. Pull and start the container. +1. Copy `.env.example` to `.env`. +2. Review `.env` and update `PYMC_REPEATER_IMAGE`, `GPIO_GID`, or `SPI_GID` + if needed. +3. Configure `docker-compose.yml` for your hardware and device paths. +4. Uncomment the USB device mapping only if your host has that device path. +5. Pull and start the container. ```bash -docker compose pull -docker compose up -d --force-recreate +docker compose up -d ``` ### Example `docker-compose.yml` @@ -410,29 +429,35 @@ docker compose up -d --force-recreate ```yaml services: pymc-repeater: - image: pymcdev/pymc-repeater:main + image: ${PYMC_REPEATER_IMAGE:-pymcdev/pymc-repeater:main} container_name: pymc-repeater restart: unless-stopped ports: - 8000:8000 devices: - # SPI devices. Your paths may differ. + # SPI devices. Your paths may differ. Remove if not using SPI hardware. - /dev/spidev0.0 - /dev/gpiochip0 - # USB devices. Your paths may differ. - - /dev/bus/usb/002:/dev/bus/usb/002 + # USB devices. Uncomment/change only if needed. + # - /dev/bus/usb/002:/dev/bus/usb/002 cap_add: - SYS_RAWIO group_add: + - "${GPIO_GID:-986}" + - "${SPI_GID:-989}" - plugdev volumes: - - ./config:/etc/pymc_repeater - - ./data:/var/lib/pymc_repeater + - ${PYMC_CONFIG_VOLUME:-pymc-repeater-config}:/etc/pymc_repeater + - ${PYMC_DATA_VOLUME:-pymc-repeater-data}:/var/lib/pymc_repeater + +volumes: + pymc-repeater-config: + pymc-repeater-data: ``` ## Roadmap diff --git a/docker-compose.yml b/docker-compose.yml index 647db59..af8dffd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,26 +1,26 @@ services: pymc-repeater: - build: - context: . - args: - PUID: ${PUID:-1000} - PGID: ${PGID:-1000} + image: ${PYMC_REPEATER_IMAGE:-pymcdev/pymc-repeater:main} container_name: pymc-repeater restart: unless-stopped ports: - 8000:8000 devices: - # SPI DEVICES (Your path may differ) + # SPI devices. Your paths may differ. Remove if not using SPI hardware. - /dev/spidev0.0 - /dev/gpiochip0 - # USB DEVICES (Your path may differ) - - /dev/bus/usb/002:/dev/bus/usb/002 - # SPI DEVICES PERMISSIONS + # USB devices. Uncomment/change only if needed. + # - /dev/bus/usb/002:/dev/bus/usb/002 cap_add: - SYS_RAWIO - # USB DEVICSE PERMISSIONS group_add: - - plugdev + - "${GPIO_GID:-986}" + - "${SPI_GID:-989}" + - plugdev volumes: - - ./config:/etc/pymc_repeater - - ./data:/var/lib/pymc_repeater + - ${PYMC_CONFIG_VOLUME:-pymc-repeater-config}:/etc/pymc_repeater + - ${PYMC_DATA_VOLUME:-pymc-repeater-data}:/var/lib/pymc_repeater + +volumes: + pymc-repeater-config: + pymc-repeater-data: