services: prepare: image: alpine:3.21.2 container_name: tail2-pose-prepare restart: "no" volumes: - /mnt/user/appdata/tail2-pose-server:/target - ./:/source:ro command: - /bin/sh - -ec - | install -d -m 0755 /target/app /target/config /target/models /target/logs /target/secrets test ! -e /target/.foreign-project || { echo 'foreign project marker found'; exit 1; } cp -a /source/app/. /target/app/ cp -a /source/config/. /target/config/ cp /source/compose.yaml /source/requirements.lock /source/DEPLOYMENT.md /target/ if [ ! -s /target/secrets/api-token ]; then umask 077 printf 'tail2_%s' "$$(head -c 48 /dev/urandom | base64 | tr -d '\n=/+')" > /target/secrets/api-token fi chmod 600 /target/secrets/api-token touch /target/.tail2-pose-server-managed models: image: curlimages/curl:8.11.1 container_name: tail2-pose-models restart: "no" user: "0:0" volumes: - /mnt/user/appdata/tail2-pose-server/models:/models command: - /bin/sh - -ec - | fetch() { if [ ! -s "$$2" ]; then curl --fail --location --retry 5 --output "$$2.part" "$$1" test -s "$$2.part" mv "$$2.part" "$$2" fi } fetch https://github.com/open-mmlab/mmdetection/archive/refs/tags/v3.2.0.tar.gz /models/mmdetection-v3.2.0.tar.gz fetch https://github.com/open-mmlab/mmpose/archive/refs/tags/v1.3.2.tar.gz /models/mmpose-v1.3.2.tar.gz test -d /models/mmdetection/configs || { mkdir -p /models/mmdetection && tar -xzf /models/mmdetection-v3.2.0.tar.gz --strip-components=1 -C /models/mmdetection; } test -d /models/mmpose/configs || { mkdir -p /models/mmpose && tar -xzf /models/mmpose-v1.3.2.tar.gz --strip-components=1 -C /models/mmpose; } fetch https://download.openmmlab.com/mmdetection/v3.0/rtmdet/rtmdet_m_8xb32-300e_coco/rtmdet_m_8xb32-300e_coco_20220719_112220-229f527c.pth /models/rtmdet_m_8xb32-300e_coco_20220719_112220-229f527c.pth fetch https://download.openmmlab.com/mmpose/v1/projects/rtmw/rtmw-dw-x-l_simcc-cocktail14_270e-256x192-20231122.pth /models/rtmw-dw-x-l_simcc-cocktail14_270e-256x192-20231122.pth sha256sum /models/*.pth > /models/SHA256SUMS chmod -R a-w /models tail2-pose-server: image: tail2-pose-server:0.1.0 build: context: . dockerfile: Dockerfile container_name: tail2-pose-server network_mode: host gpus: all init: true restart: unless-stopped shm_size: 2gb read_only: true depends_on: prepare: condition: service_completed_successfully models: condition: service_completed_successfully tmpfs: - /tmp:size=512m,mode=1777 volumes: - /mnt/user/appdata/tail2-pose-server/app:/app:ro - /mnt/user/appdata/tail2-pose-server/config:/config:ro - /mnt/user/appdata/tail2-pose-server/models:/models:ro - /mnt/user/appdata/tail2-pose-server/logs:/logs - /mnt/user/appdata/tail2-pose-server/secrets/api-token:/run/secrets/api-token:ro environment: PYTHONPATH: /app API_BIND: 0.0.0.0 API_PORT: "18120" API_TOKEN_FILE: /run/secrets/api-token NDI_SOURCE_NAME: TAIL 2_1621D2 (OBSBOT) NDI_SOURCE_IP: 192.168.50.207 MODEL_PROFILE: balanced MAX_PEOPLE: "4" DETECTION_THRESHOLD: "0.35" NMS_IOU_THRESHOLD: "0.60" FRAME_QUEUE_SIZE: "1" LATEST_FRAME_ONLY: "true" SAVE_FRAMES: "false" SAVE_CROPS: "false" LOG_COORDINATES: "false" CUDA_VISIBLE_DEVICES: "0" DET_CONFIG: /models/mmdetection/configs/rtmdet/rtmdet_m_8xb32-300e_coco.py DET_CHECKPOINT: /models/rtmdet_m_8xb32-300e_coco_20220719_112220-229f527c.pth POSE_CONFIG: /models/mmpose/configs/wholebody_2d_keypoint/rtmpose/cocktail14/rtmw-l_8xb1024-270e_cocktail14-256x192.py POSE_CHECKPOINT: /models/rtmw-dw-x-l_simcc-cocktail14_270e-256x192-20231122.pth healthcheck: test: ["CMD", "python", "-c", "import json,pathlib,urllib.request; t=pathlib.Path('/run/secrets/api-token').read_text().strip(); r=urllib.request.Request('http://127.0.0.1:18120/v1/health',headers={'Authorization':'Bearer '+t}); raise SystemExit(0 if json.load(urllib.request.urlopen(r,timeout=3))['ready'] else 1)"] interval: 15s timeout: 5s retries: 6 start_period: 180s validate: image: tail2-pose-server:0.1.0 container_name: tail2-pose-validate network_mode: host gpus: all restart: "no" entrypoint: ["/bin/bash", "-lc"] depends_on: tail2-pose-server: condition: service_healthy volumes: - /mnt/user/appdata/tail2-pose-server/app:/app:ro - /mnt/user/appdata/tail2-pose-server/models:/models:ro - /mnt/user/appdata/tail2-pose-server/logs:/logs:ro - /mnt/user/appdata/tail2-pose-server/secrets/api-token:/run/secrets/api-token:ro - ./validation:/validation command: - | set -euo pipefail chmod -R a+rwX /validation python -m pytest -q /opt/tail2-tests > /validation/unit-tests.txt 2>&1 python /app/tail2/validate_runtime.py > /validation/runtime.json python -m pip freeze | sort > /validation/pip-freeze.txt find / -xdev -type f -name 'libndi.so*' -print > /validation/ndi-runtime-files.txt 2>/dev/null || true nvidia-smi --query-gpu=name,driver_version,memory.total,memory.used,temperature.gpu --format=csv,noheader > /validation/gpu.csv sha256sum /models/*.pth > /validation/model-sha256.txt cp /logs/offline-benchmark.json /validation/offline-benchmark.json chmod 0666 /validation/*.txt /validation/*.json /validation/*.csv soak: image: tail2-pose-server:0.1.0 container_name: tail2-pose-soak network_mode: host restart: "no" entrypoint: ["/bin/bash", "-lc"] depends_on: tail2-pose-server: condition: service_healthy volumes: - /mnt/user/appdata/tail2-pose-server/app:/app:ro - /mnt/user/appdata/tail2-pose-server/secrets/api-token:/run/secrets/api-token:ro - ./validation:/validation command: - | set -euo pipefail chmod -R a+rwX /validation test -s /validation/soak-10m.json || python /app/tail2/soak.py chmod 0666 /validation/soak-10m.json