콘텐츠로 이동
이 페이지를 편집

시작하기

이 페이지의 영어 버전이 더 최신입니다. 영어 버전 읽기.

사전 요구 사항

  • Docker와 Compose v2 플러그인 2.23.1 이상 버전이 필요합니다. docker compose version으로 확인합니다. 이전 버전은 compose 파일 안의 인라인 설정을 읽지 못합니다. Docker Desktop에는 이 플러그인이 포함되어 있습니다. Linux의 기본 Docker Engine에서는 Docker의 패키지 저장소에서 설치합니다 (https://docs.docker.com/compose/install/linux/). Colima를 사용하는 macOS에서는 Homebrew로 설치한 다음 Docker 플러그인으로 연결합니다:

    brew install docker-compose
    mkdir -p ~/.docker/cli-plugins
    ln -sfn "$(brew --prefix)/opt/docker-compose/bin/docker-compose" ~/.docker/cli-plugins/docker-compose
    
  • Linux, macOS 또는 Windows 호스트(amd64 또는 arm64)

  • CashPilot과 관리 대상 서비스에 쓸 수 있는 1 GB 이상의 RAM
  • Docker 호스트 하나에 CashPilot 하나. 아래 경고를 참고하십시오.

Docker 호스트 하나에 CashPilot 하나

Docker 호스트 하나에 CashPilot 설치를 두 개 실행하지 마십시오. compose 파일은 고정된 컨테이너 이름(cashpilot-ui, cashpilot-worker, cashpilot-socket-proxy)을 사용하므로, 파일의 두 번째 사본은 이름 충돌로 실패합니다. 이를 피하려고 이름을 바꾸어도 두 설치는 여전히 호스트를 공유합니다. 각 워커는 어느 설치가 만들었든 CashPilot의 레이블이 붙은 모든 컨테이너를 관리합니다. 그래서 각 대시보드가 다른 설치의 수익 앱을 표시하고, 중지하고, 교체합니다. 두 설치는 cashpilot-isolated 네트워크, 수익 앱 이름 (cashpilot-<service>), 호스트 포트, 그리고 mysterium-data 같은 볼륨도 공유합니다. 두 번째 설치에는 다른 호스트나 VM을 사용하십시오. 더 많은 서버에서 수익 앱을 실행하려면 대신 대시보드 하나에 워커를 추가하십시오(플릿).

빠른 시작

1. compose 파일을 받아 실행하기

curl -fsSLO https://raw.githubusercontent.com/GeiserX/CashPilot/main/docker-compose.yml
docker compose up -d

이 명령은 장기 실행 컨테이너 세 개를 시작합니다. 그 전에 일회성 cashpilot-migrate가 up할 때마다 실행되고 코드 0으로 종료되므로, docker compose ps -a에는 Exited (0)으로 표시됩니다. 이는 정상입니다.

컨테이너 포트 용도
cashpilot-migrate 없음 한 번 실행되고 종료됩니다. 이전 릴리스가 만든 데이터를 소켓 프록시가 허용하는 볼륨으로 옮기며, 새 설치에서는 할 일이 없습니다
cashpilot-ui 8080 웹 대시보드, 수익 수집, 서비스 카탈로그
cashpilot-worker 8081 서비스 컨테이너를 배포하고 모니터링하는 Docker 에이전트
cashpilot-socket-proxy 없음 Docker 소켓을 보유하고 워커에게 필터링된 사본을 제공합니다(보안 기본값)

2. 대시보드 열기

브라우저에서 http://localhost:8080으로 이동합니다. 아직 계정이 없으므로 환영 페이지가 열리며, 이 페이지에서 소유자 계정을 만듭니다.

포트 8080이 이미 사용 중입니까?

compose 파일을 편집하는 대신 docker-compose.yml 옆의 .env 파일에서 다른 호스트 포트를 지정하십시오:

printf '\nCASHPILOT_UI_PORT=8088\n' >> .env
docker compose up -d

그런 다음 http://localhost:8088 주소를 엽니다. 앱 내 업데이트는 셸이 아니라 그 파일을 읽으므로 값을 .env에 그대로 두십시오. (printf가 줄바꿈으로 시작하므로, 이 줄이 기존 .env의 마지막 줄에 붙는 일이 없습니다.)

이 변수를 쓰려면 ports: 줄이 ${CASHPILOT_UI_PORT:-8080}:8080인 docker-compose.yml이 필요합니다. v1.61 이하의 파일은 8080:8080이 하드코딩되어 있어 이 변수를 무시합니다. 현재 파일을 내려받거나, 직접 편집한 포트 매핑을 유지하십시오. 앱 내 업데이트는 그것도 허용합니다.

최초 실행 설정 토큰 필요

처음 시작할 때 CashPilot은 일회용 설정 토큰을 생성하여 cashpilot-ui 컨테이너 로그에 출력합니다:

docker compose logs cashpilot-ui

다음과 같은 줄을 찾으십시오:

FIRST-RUN SETUP: no account exists yet. Open /register and enter this
one-time setup token to create the owner account: <token>

환영 페이지의 Owner account (소유자 계정) 단계에 있는 Setup token (설정 토큰) 필드에 이 토큰을 사용자 이름, 비밀번호와 함께 복사해 넣어 첫 번째 (소유자) 계정을 만듭니다. 이 토큰은 로그에만 표시되고 URL에는 절대 나타나지 않으며, 소유자 계정이 생기면 영구히 폐기됩니다.

3. 서비스 카탈로그 둘러보기

Catalog (카탈로그) 페이지는 모든 서비스를 플랫폼, 월 예상 수익, 필요한 것(가정용 IP, GPU)과 함께 나열합니다. 카테고리(Bandwidth (대역폭), DePIN (DePIN), Storage (스토리지), Compute (컴퓨팅), Mining (채굴))로 필터링하거나 이름으로 검색합니다. Add (추가)는 해당 서비스로 설정 마법사를 열고, Details (세부 정보)는 서비스 설명, 지급, 배포 위험을 보여 줍니다. Docker에서 실행되지 않는 서비스에는 대신 Visit (방문) 링크가 표시됩니다.

두 종류의 서비스는 먼저 자세히 살펴봐야 합니다. 하나는 Anyone Protocol, Sia, Flux처럼 토큰을 스테이킹해 묶어 둔 뒤에만 지급하는 서비스이고, 다른 하나는 IP를 공개하는 릴레이입니다. 릴레이는 가정용 대역폭 앱이 지급하는 금액을 낮출 수 있습니다. 배포 전에 확인할 두 가지를 참고하십시오.

4. 마법사로 서비스 추가하기

소유자 계정이 생기면 Add services (서비스 추가)가 설정 마법사를 엽니다. 이후에는 상단 표시줄의 + Add service (+ 서비스 추가) 버튼으로 다시 열 수 있습니다. 카테고리를 고른 다음 서비스를 고릅니다. 마법사는 서비스마다 Sign Up (가입) 링크를 보여 주고, 해당 서비스에 필요한 자격 증명(이메일과 비밀번호, API 토큰 등)만 요청하며, 서비스를 실행할 워커를 선택하게 합니다. Deploy (배포)를 클릭하면 CashPilot이 이미지를 가져오고, 컨테이너를 만들고, 감시를 시작합니다.

5. 대시보드에서 지켜보기

대시보드는 배포된 각 서비스를 상태, 잔액과 함께 보여 주고, Fleet (플릿) 페이지는 모든 워커를 보여 줍니다.

작동 방식

graph LR
    A[User] -->|Browse & Configure| B[CashPilot UI<br>Port 8080]
    B -->|Deploy Commands| C[CashPilot Worker<br>Port 8081]
    C -->|Docker API| D[Service Containers]
    D -->|Health & Status| C
    C -->|Heartbeat| B
    B -->|Collect Earnings| E[Service APIs]
    E -->|Balance Data| B
  1. 사용자가 설정합니다: 웹 UI에서 서비스를 고르고, 자격 증명을 입력하고, 배포를 클릭합니다.
  2. UI가 보냅니다: 컨테이너 사양(이미지, 환경 변수, 볼륨)을 REST API로 워커에 보냅니다.
  3. 워커가 만듭니다: Docker 컨테이너를 만들고 헬스 모니터링을 시작합니다.
  4. 워커가 보고합니다: 하트비트로 60초마다 컨테이너 상태를 UI에 보고합니다.
  5. UI가 수집합니다: 설정 가능한 일정(기본값: 1시간마다)에 따라 서비스 API에서 수익을 수집합니다.
  6. 대시보드가 보여 줍니다: 합산 수익, 서비스별 내역, 컨테이너 헬스를 보여 줍니다.

설정

UI 환경 변수

변수 기본값 설명
TZ UTC 일정과 표시에 쓰는 시간대
CASHPILOT_SECRET_KEY (자동 생성) 로그인 세션 서명 키. /data/.secret_key에 저장됩니다. 자격 증명을 암호화하지 않습니다
CASHPILOT_ENCRYPTION_KEY (자동 생성) 저장된 자격 증명을 저장 상태에서 암호화하는 Fernet 키. /data/.fernet_key에 저장됩니다. 그 파일이 없을 때만 사용되며, /data에는 절대 기록되지 않습니다. CASHPILOT_ENCRYPTION_KEY_FILE(경로)이 둘 모두보다 우선합니다. 데이터 폴더 밖의 암호화 키를 참고하십시오
CASHPILOT_API_KEY (/fleet에서) 워커용 공유 등록 키. 각 워커는 등록할 때 자체 키를 받습니다. 플릿을 참고하십시오
CASHPILOT_COLLECT_INTERVAL 60 수익 수집 주기 사이의 분
CASHPILOT_UI_PORT 8080 UI가 게시되는 호스트 포트. 8080이 사용 중이면 .env에서 설정하십시오
CASHPILOT_BIND_ADDR 127.0.0.1 UI 포트가 게시되는 호스트 인터페이스. 기본값은 루프백입니다: 대시보드는 Docker 소켓 워커에 명령할 수 있으므로, 처음 설치한 상태에서는 네트워크에 노출되지 않습니다. 노출하려면 특정 IP(예: Tailscale/VPN 주소)나 0.0.0.0을 설정하거나, (권장) 앞단에 인증을 수행하는 리버스 프록시를 두십시오

컨테이너 안의 UI 웹 포트는 8080으로 고정되어 있습니다(컨테이너의 CMD로 설정). CASHPILOT_UI_PORT와 CASHPILOT_BIND_ADDR은 그 포트가 게시되는 호스트 포트와 인터페이스만 선택합니다.

워커 환경 변수

변수 기본값 설명
TZ UTC 시간대
CASHPILOT_UI_URL -- UI 컨테이너의 URL. 예: http://cashpilot-ui:8080
CASHPILOT_API_KEY -- UI의 등록 키와 일치해야 합니다. 등록할 때만 필요하며, 그 뒤 워커는 자체 키를 사용합니다
CASHPILOT_WORKER_NAME (호스트 이름) 플릿 대시보드에서 이 워커의 표시 이름
CASHPILOT_WORKER_URL (자동 감지) UI가 이 워커에 접속할 때 쓰는 URL. 예: http://192.168.1.50:8081. 여러 호스트에 걸친 플릿에서는 명시적으로 설정하십시오. 자동 감지는 접속할 수 없는 컨테이너 내부 IP를 보고할 수 있습니다
CASHPILOT_WORKER_BIND_ADDR 127.0.0.1 플릿 및 원격 워커 compose 전용 (docker-compose.fleet.yml): 워커의 Docker 소켓 API 포트가 게시되는 호스트 인터페이스로, 기본값은 루프백입니다. 기본 docker-compose.yml은 포트 8081을 전혀 게시하지 않습니다. 워커 API는 어떤 컨테이너든 배포하거나 중지할 수 있으므로(= 호스트의 root), 원격 워커에서는 사설/VPN 인터페이스(예: Tailscale IP)에 바인딩하고 공인 IP에는 절대 바인딩하지 마십시오
CASHPILOT_PORT 8081 워커가 UI에 알리는 포트. 수신 포트는 이미지의 CMD로 고정되어 있으며 이 값으로 바뀌지 않습니다. 설정 레퍼런스를 참고하십시오

Docker Compose 예시

# CashPilot - Self-hosted passive income orchestrator
# https://github.com/GeiserX/CashPilot
#
# UI + Worker on the same server. For multi-server fleet, see docker-compose.fleet.yml
#
#   Start / update:  docker compose pull && docker compose up -d
#
# ONE CashPilot per Docker host. The container names in this file are fixed,
# and a worker manages every container on its Docker engine that carries
# CashPilot's labels, whichever install made it. A second install on the same
# host would list, stop and replace the first one's earners. Put it on another
# host or VM. docs/getting-started.md has the details.
#
# Images are PINNED to a major.minor tag, which is what the lines below say.
# `docker compose pull && up -d` therefore gets the newest patch of that series,
# not the newest release overall. To move to a newer series, read UPGRADING.md
# first, then edit the tags on the UI host first and on every worker after it.
#
# This header used to claim the file tracked `latest` while pinning 1.4, and the
# string `:latest` it told you to replace did not appear anywhere. Following the
# quickstart therefore installed a version many releases behind, and issue #188
# is someone hitting a first-run bug that had been fixed for months because of
# it. Keep this comment honest about what the file actually does.
# See https://hub.docker.com/r/drumsergio/cashpilot/tags for available tags.
# NOTE: versions before 1.0.0 predate the per-worker fleet-key auth cutover and
# are not compatible with a worker running 1.x -- pin UI and worker together.
# Building from source? Use: docker compose -f docker-compose.build.yml up -d

services:
  cashpilot-ui:
    image: drumsergio/cashpilot:3.3
    pull_policy: always
    container_name: cashpilot-ui
    # Published on loopback by default: the dashboard can command the Docker-socket
    # worker, so it must not be exposed to your LAN/the internet out of the box.
    # To reach it from another machine, point CASHPILOT_BIND_ADDR at a specific
    # interface (e.g. a Tailscale/VPN IP) or, better, run an authenticating reverse
    # proxy in front. CASHPILOT_BIND_ADDR=0.0.0.0 publishes on all interfaces.
    # Host port 8080 already taken? Set CASHPILOT_UI_PORT=8088 (and CASHPILOT_BIND_ADDR)
    # in a .env file next to this compose file, not on the command line. The in-app
    # update reads .env and never sees your shell. The container port stays 8080.
    ports:
      - "${CASHPILOT_BIND_ADDR:-127.0.0.1}:${CASHPILOT_UI_PORT:-8080}:8080"
    volumes:
      - cashpilot_data:/data
      - cashpilot_fleet_owned:/fleet
    environment:
      - TZ=${TZ:-UTC}
      - CASHPILOT_SECRET_KEY=${CASHPILOT_SECRET_KEY:-}
      # Optional: only needed to RESTORE credentials onto a fresh volume.
      # An existing /data/.fernet_key always wins, so setting this is safe.
      - CASHPILOT_ENCRYPTION_KEY=${CASHPILOT_ENCRYPTION_KEY:-}
      - CASHPILOT_ALLOW_EPHEMERAL_KEY=${CASHPILOT_ALLOW_EPHEMERAL_KEY:-false}
      - CASHPILOT_API_KEY=${CASHPILOT_API_KEY:-}
      - CASHPILOT_ADMIN_API_KEY=${CASHPILOT_ADMIN_API_KEY:-}
      # Optional bearer key for reporting only (Home Assistant, Grafana,
      # cashpilot-mcp with CASHPILOT_READ_ONLY=true). See docs/configuration.md.
      - CASHPILOT_READONLY_API_KEY=${CASHPILOT_READONLY_API_KEY:-}
      # Optional Prometheus /metrics. true serves it; set a token to require
      # Authorization: Bearer. See docs/guides/prometheus-metrics.md.
      - CASHPILOT_METRICS_ENABLED=${CASHPILOT_METRICS_ENABLED:-false}
      - CASHPILOT_METRICS_TOKEN=${CASHPILOT_METRICS_TOKEN:-}
      # Optional CAPTCHA on the sign-in page, for a UI the internet can reach:
      # turnstile, hcaptcha or recaptcha (v2 checkbox), plus both keys. Empty = off.
      # See docs/security-defaults.md, "Protect the sign-in page with a CAPTCHA".
      - CASHPILOT_CAPTCHA_PROVIDER=${CASHPILOT_CAPTCHA_PROVIDER:-}
      - CASHPILOT_CAPTCHA_SITE_KEY=${CASHPILOT_CAPTCHA_SITE_KEY:-}
      - CASHPILOT_CAPTCHA_SECRET_KEY=${CASHPILOT_CAPTCHA_SECRET_KEY:-}
      # Warn when a container misses a later catalog fix. false turns it off.
      - CASHPILOT_DRIFT_WARNINGS=${CASHPILOT_DRIFT_WARNINGS:-true}
    init: true
    # The image declares its own HEALTHCHECK, so `docker ps` will show
    # "(unhealthy)" when the app stops answering. NOTHING ACTS ON THAT BY
    # DEFAULT: `restart: unless-stopped` restarts a container that EXITS, and a
    # container failing its healthcheck is still running. It will sit there
    # unhealthy indefinitely. (Docker Swarm reschedules unhealthy tasks; plain
    # Compose does not.)
    #
    # To act on it, either alert on it -- see the CashPilotDown rule in
    # docs/guides/prometheus-metrics.md -- or add an autoheal sidecar, which is
    # documented in the same place along with the fact that it needs the Docker
    # socket, i.e. root on the host.
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    tmpfs:
      - /tmp:size=64M
    # cashpilot_fleet_owned is filled by cashpilot-migrate on an upgrade.
    depends_on:
      cashpilot-migrate:
        condition: service_completed_successfully
    # Where the UI reaches the worker. Labelled for the proxy, so the in-app
    # update may attach the worker to it.
    networks:
      - cashpilot_owned

  # Runs once at every `docker compose up`, before the proxy, and exits.
  # Releases before owner isolation made volumes and the LAN fence's network
  # without the proxy's owner label, and Docker cannot add a label later, so
  # this copies each one to a backup, recreates it with the label, copies the
  # data back and checks it, then recreates the service container as it was.
  # The backups (<volume>-pre-isolation) and the volumes this file renamed are
  # never deleted: UPGRADING.md says how to remove them. It holds the raw
  # socket only while it runs; a second run finds nothing to do.
  cashpilot-migrate:
    image: drumsergio/cashpilot-worker:3.3
    pull_policy: always
    container_name: cashpilot-migrate
    user: "0:0"
    entrypoint: ["python", "-m", "app.owner_migrate"]
    environment:
      # old=new compose volume keys: the data moves into the labelled volume.
      - CASHPILOT_MIGRATE_COMPOSE_VOLUMES=cashpilot_worker_data=cashpilot_worker_data_owned,cashpilot_fleet=cashpilot_fleet_owned
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      # Each step it finished, so a run killed halfway is completed by the next.
      # A folder, not a volume: the in-app update runs docker compose through
      # the proxy, and Compose checks every volume of the worker's dependencies,
      # this one included, which the proxy will not let the worker see.
      - ./cashpilot-migrate-state:/state
    network_mode: none
    restart: "no"
    healthcheck:
      disable: true
    cap_drop:
      - ALL
    security_opt:
      - no-new-privileges:true

  # Holds the host's Docker socket so the worker does not have to. It serves
  # a filtered copy in the cashpilot_docker_api volume and refuses every call
  # the worker does not make: a privileged container, a bind of / or of the
  # socket, a capability or device outside the catalog's, exec of anything but
  # the catalog's readers, swarm, plugins, builds. The policy is the configs
  # block at the end of this file. docs/security-defaults.md has the details.
  #
  # Pinned by digest and bumped on purpose; the in-app update never recreates
  # it (it runs `up --no-deps` on the UI and worker only).
  cashpilot-socket-proxy:
    image: codeswhat/sockguard:2.4.10@sha256:af66f6dcab2d6c04c4a45823ea9b72549985bf1957dea3bb4382c1515ab9461e
    container_name: cashpilot-socket-proxy
    # Root with no capabilities: uid 0 opens the root-owned host socket, and
    # group 1000 (the worker's) lets it give the worker its socket.
    user: "0:0"
    group_add:
      - "1000"
    cap_drop:
      - ALL
    # One capability it never uses, and that no container the worker creates
    # may ask for. A container that joins this one's process namespace then
    # holds less than the proxy does, so the kernel refuses it the proxy's
    # files (/proc/1/root), the host socket among them.
    cap_add:
      - WAKE_ALARM
    security_opt:
      - no-new-privileges:true
    # Unix sockets only; it needs no network at all.
    network_mode: none
    restart: unless-stopped
    # It peaks near 45 MB, streams included; the cap only stops a leak
    # from taking the host's memory with it.
    mem_limit: 256m
    # One log line per Docker call (refusals included), so the log is capped.
    logging:
      driver: json-file
      options:
        max-size: "5m"
        max-file: "2"
    # `sockguard verify` asks the host's Docker through the socket this proxy
    # holds, so a stale or missing host socket (a Docker update replaced it,
    # docs/faq.md) turns it unhealthy. Exec form: the image has no shell.
    healthcheck:
      test: ["CMD", "/sockguard", "verify"]
      interval: 60s
      timeout: 10s
      retries: 3
      start_period: 20s
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - cashpilot_docker_api:/run/cashpilot-docker
    environment:
      # Host paths containers may bind: your compose folder (the in-app
      # update needs it) and each folder a service keeps its data in (Storj's
      # identity and data folders, for example), comma-separated. Set both in
      # the .env next to this file. The proxy binds a listed path only as
      # itself, never a folder under it, so list every path a service binds.
      # Write each as an exact absolute path, with no trailing slash, `//`, `.`
      # or `..`: the proxy refuses to start on any other spelling.
      # The placeholders sit under /dev/null, where no directory can ever exist
      # (Docker cannot create one there), so an unset variable allows nothing.
      - SOCKGUARD_REQUEST_BODY_CONTAINER_CREATE_ALLOWED_BIND_MOUNTS=${CASHPILOT_COMPOSE_DIR:-/dev/null/cashpilot-compose-dir-unset},${CASHPILOT_PROXY_BIND_MOUNTS:-/dev/null/cashpilot-bind-mounts-unset}
      # The policy's fingerprint. Compose does not recreate a container when
      # only its config's content changes, so this line is what makes
      # `docker compose up -d` restart the proxy on a new policy.
      - CASHPILOT_PROXY_POLICY=bf36af85a1e0f393
    configs:
      - source: cashpilot_socket_policy
        target: /etc/sockguard/sockguard.yaml
    depends_on:
      cashpilot-migrate:
        condition: service_completed_successfully

  cashpilot-worker:
    image: drumsergio/cashpilot-worker:3.3
    pull_policy: always
    container_name: cashpilot-worker
    # The proxy's owner label: the worker may read its own container, and the
    # in-app update may recreate it through the proxy.
    labels:
      cashpilot.deployed-by: worker
    expose:
      - "8081"
      # The worker reads host GPU information from sysfs. Leave the GPU
      # devices on the host so it can grant them to catalog services
      # that declare docker.gpu. See docs/gpu.md.
    volumes:
      # No Docker socket here: the worker reaches Docker through the proxy's
      # filtered socket in this volume (DOCKER_HOST below).
      - cashpilot_docker_api:/run/cashpilot-docker
      # SEPARATE FROM THE UI'S /data, DELIBERATELY. This container drives
      # Docker, so a flaw in it reaches the host. The UI's /data holds
      # cashpilot.db and .fernet_key -- the credential store and the only key
      # that can decrypt it -- and the component that can start any container
      # on the machine has no business being able to read them.
      #
      # /fleet IS shared on purpose: it holds only the shared enrolment key,
      # which both sides need by definition.
      #
      # Consolidating these into one volume is the obvious "simplification" and
      # it silently removes that boundary. tests/test_beads_batch_69.py fails if
      # anyone does.
      - cashpilot_worker_data_owned:/data
      - cashpilot_fleet_owned:/fleet
    environment:
      - TZ=${TZ:-UTC}
      - CASHPILOT_UI_URL=http://cashpilot-ui:8080
      - CASHPILOT_API_KEY=${CASHPILOT_API_KEY:-}
      - CASHPILOT_WORKER_NAME=local
      - CASHPILOT_MINERS=${CASHPILOT_MINERS:-}
      - DOCKER_HOST=unix:///run/cashpilot-docker/docker.sock
      # The proxy policy's fingerprint (scripts/socket_proxy_policy.py), so the
      # worker can say when its image needs a newer policy than this file has.
      - CASHPILOT_PROXY_POLICY=bf36af85a1e0f393
      # The same two values the proxy gets, so the worker can say what to set
      # before the proxy refuses (the in-app update, a host-folder bind).
      - CASHPILOT_COMPOSE_DIR=${CASHPILOT_COMPOSE_DIR:-}
      - CASHPILOT_PROXY_BIND_MOUNTS=${CASHPILOT_PROXY_BIND_MOUNTS:-}
      # Earners are fenced off your LAN and this host by default (docs/isolation.md).
      # off keeps Docker's default bridge.
      - CASHPILOT_ISOLATION=${CASHPILOT_ISOLATION:-auto}
      - CASHPILOT_DRIFT_WARNINGS=${CASHPILOT_DRIFT_WARNINGS:-true}
    depends_on:
      - cashpilot-socket-proxy
    init: true
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    tmpfs:
      - /tmp:size=64M
    # Labelled for the proxy, so the in-app update may attach the worker to it.
    networks:
      - cashpilot_owned

volumes:
  cashpilot_data:
  # The worker's own data and the enrolment key it shares with the UI. They
  # carry the proxy's owner label, so the in-app update may mount them. Compose
  # never relabels a volume, so they are new ones: cashpilot-migrate copied
  # cashpilot_worker_data and cashpilot_fleet into them and left the old ones
  # as backups. The UI's cashpilot_data never carries the label.
  cashpilot_worker_data_owned:
    labels:
      cashpilot.deployed-by: worker
  cashpilot_fleet_owned:
    labels:
      cashpilot.deployed-by: worker
  # Fixed name: the in-app update mounts it by name to reach the proxy. It
  # replaced cashpilot-docker-api, which held nothing but the socket.
  cashpilot_docker_api:
    name: cashpilot-docker-api-owned
    labels:
      cashpilot.deployed-by: worker

networks:
  cashpilot_owned:
    labels:
      cashpilot.deployed-by: worker

# The Docker socket proxy's policy. scripts/socket_proxy_policy.py writes it
# from the catalog; `$$` is how compose spells a literal `$`. Needs Docker
# Compose 2.23.1 or newer (inline config content).
configs:
  cashpilot_socket_policy:
    content: |
      # BEGIN socket proxy policy: written by scripts/socket_proxy_policy.py, do not edit by hand
      listen:
        socket: /run/cashpilot-docker/docker.sock
        # The worker runs as uid/gid 1000 (Dockerfile.worker). The proxy runs as
        # root with no capabilities and joins group 1000, so it can hand the socket
        # to that group without asking for the host's docker group id.
        socket_mode: "0660"
        socket_gid: 1000
      upstream:
        socket: /var/run/docker.sock
        # Image pulls and container waits take minutes; the default cuts them at 60 s.
        request_timeout: "off"
      log:
        level: info
        format: json
        # One line per call, refusals included: docker logs cashpilot-socket-proxy
        # shows what was refused and why. The compose file caps the log's size.
        access_log: true
      health:
        enabled: false
      # The worker reads its own containers' logs and files (backups, the update check).
      insecure_allow_read_exfiltration: true
      response:
        # A refusal carries the rule's reason, which the worker shows to you.
        deny_verbosity: verbose
        # The worker reads Env, Mounts and IPAM back (recreates, the isolation check).
        redact_container_env: false
        redact_mount_paths: false
        redact_network_topology: false
      request_body:
        container_create:
          allow_privileged: false
          # The LAN fence helper and the isolation check's control probe run on the
          # host network; no earner does (the worker refuses it for every catalog
          # service, and the catalog refuses it to any service with NET_ADMIN).
          allow_host_network: true
          allow_host_pid: false
          allow_host_ipc: false
          allow_host_userns: false
          allow_host_cgroupns: false
          allowed_capabilities: [NET_ADMIN, NET_RAW, SETUID, SETGID]
          allowed_devices: [/dev/net/tun, /dev/dri/renderD128, /dev/dri/renderD129, /dev/dri/renderD130, /dev/dri/renderD131, /dev/dri/renderD132, /dev/dri/renderD133, /dev/dri/renderD134, /dev/dri/renderD135, /dev/kfd, /dev/ttyUSB0, /dev/ttyUSB1, /dev/ttyUSB2, /dev/ttyUSB3, /dev/ttyUSB4, /dev/ttyUSB5, /dev/ttyUSB6, /dev/ttyUSB7, /dev/ttyUSB8, /dev/ttyUSB9, /dev/ttyACM0, /dev/ttyACM1, /dev/ttyACM2, /dev/ttyACM3, /dev/ttyACM4, /dev/ttyACM5, /dev/ttyACM6, /dev/ttyACM7, /dev/ttyACM8, /dev/ttyACM9]
          allowed_device_requests: [{driver: nvidia, allowed_capabilities: [[gpu]]}]
          allowed_runtimes: [runc, runsc, runsc-hostnet, runsc-hostnet-raw]
          allow_sysctls: true               # the tunnel sidecar turns IPv6 off in its own namespace
          require_no_new_privileges: true
          deny_unconfined_seccomp: true
          deny_unconfined_apparmor: true
          deny_unconfined_system_paths: true
          # Host folders containers may bind come from CASHPILOT_COMPOSE_DIR and
          # CASHPILOT_PROXY_BIND_MOUNTS, through the proxy service's environment.
          allowed_bind_mounts: []
        container_remove:
          allow_force: true
          allow_remove_volumes: true
        container_archive:
          # The only folder the worker writes into a container: the tunnel
          # sidecar's proxy settings.
          allowed_paths: [/run/cashpilot-secret]
          allow_setid: false
          allow_device_nodes: false
          allow_escaping_links: false
        exec:
          allow_privileged: false
          allow_root_user: true
          # The worker's exec calls send no environment. This name is never sent,
          # so any Env entry (PATH, LD_PRELOAD) is refused.
          allowed_env_vars: [CASHPILOT_EXEC_SENDS_NO_ENV]
          allowed_commands:
            - ["cat", "/run/ready"]
            - ["sh", "-c", "id=$$(wget -qO- -T 5 http://127.0.0.1:4050/identities | grep -o '0x[0-9a-fA-F]\\{40\\}' | head -1) && wget -qO- -T 5 \"http://127.0.0.1:4050/identities/$$id\" && { echo; wget -qO- -T 5 \"http://127.0.0.1:4050/transactor/settle/history?page_size=1000\" || true; }"]
            - ["sh", "-c", "id=$$(wget -qO- -T 5 http://127.0.0.1:4050/identities | grep -o '0x[0-9a-fA-F]\\{40\\}' | head -1) && wget -qO- -T 5 \"http://127.0.0.1:4050/identities/$$id/beneficiary\""]
            - ["timeout", "12", "sh", "-c", "if m=$$(wget -qO- -Y off -T 5 http://127.0.0.1:4050/node/monitoring-status); then\n  echo \"monitoring read: $$m\"\nfi\nset -o pipefail\nif s=$$(wget -qO- -Y off -T 5 \"http://127.0.0.1:4050/sessions?direction=Provided&status=Completed&page_size=100\") &&\n  sorted=$$(echo \"$$s\" | sed 's/},{/}\\n{/g' | awk '\n    match($$0, /\"created_at\":\"[^\"]+\"/) {\n      t = substr($$0, RSTART + 14, 19); gsub(/[-T:]/, \" \", t)\n      d = 0; if (match($$0, /\"duration\":[0-9]+/)) d = substr($$0, RSTART + 11, RLENGTH - 11)\n      print mktime(t) + d, $$0\n    }' | sort -rn); then\n  [ -z \"$$sorted\" ] || echo \"$$sorted\" | head -5\n  echo \"sessions read: all\"\nfi"]
            - ["sh", "-c", "T=\"\"; command -v timeout >/dev/null 2>&1 && T=\"timeout 5\"; $$T iptables-nft -t nat -S MYST 2>/dev/null; if grep -qx nat /proc/net/ip_tables_names 2>/dev/null; then $$T iptables-legacy -t nat -S MYST 2>/dev/null; $$T iptables -t nat -S MYST 2>/dev/null; else case \"$$($$T iptables -V 2>/dev/null)\" in *nf_tables*) $$T iptables -t nat -S MYST 2>/dev/null;; esac; fi"]
            - ["cat", "/etc/anon/anonrc"]
        image_pull:
          allow_all_registries: true        # catalog and custom services come from many registries
        network:
          # The LAN fence (app/lan_fence.py) creates its bridge with three driver
          # options (interface name, no masquerade, no inter-container traffic) and
          # moves an earner across with a forced disconnect. Custom drivers, swarm
          # scope, custom IPAM and endpoint settings stay refused.
          allow_driver_options: true
          allow_disconnect_force: true
        volume:
          # Plain local volumes only: driver options could point one at a host folder.
          allow_custom_drivers: false
          allow_driver_opts: false
      # The worker sees and touches only what carries the owner label below: what
      # it created through this proxy, and what app/owner_migrate.py labelled. The
      # UI's container and its data volume never carry it.
      ownership:
        owner: worker
        label_key: cashpilot.deployed-by
        # Images carry no owner: one pulled for an earner is shared with the host.
        allow_unowned_images: true
        allow_cross_owner_namespace_sharing: false
      rules:
        - {match: {method: GET, path: "/_ping"}, action: allow}
        - {match: {method: HEAD, path: "/_ping"}, action: allow}
        - {match: {method: GET, path: "/version"}, action: allow}
        - {match: {method: GET, path: "/info"}, action: allow}
        - {match: {method: GET, path: "/containers/json"}, action: allow}
        - {match: {method: GET, path: "/containers/*/json"}, action: allow}
        - {match: {method: POST, path: "/containers/create"}, action: allow}
        - {match: {method: POST, path: "/containers/*/start"}, action: allow}
        - {match: {method: POST, path: "/containers/*/stop"}, action: allow}
        - {match: {method: POST, path: "/containers/*/restart"}, action: allow}
        - {match: {method: POST, path: "/containers/*/pause"}, action: allow}
        - {match: {method: POST, path: "/containers/*/unpause"}, action: allow}
        - {match: {method: POST, path: "/containers/*/wait"}, action: allow}
        - {match: {method: POST, path: "/containers/*/rename"}, action: allow}
        - {match: {method: DELETE, path: "/containers/*"}, action: allow}
        - {match: {method: GET, path: "/containers/*/logs"}, action: allow}
        - {match: {method: GET, path: "/containers/*/stats"}, action: allow}
        - {match: {method: GET, path: "/containers/*/archive"}, action: allow}
        - {match: {method: PUT, path: "/containers/*/archive"}, action: allow}
        - {match: {method: POST, path: "/containers/*/exec"}, action: allow}
        - {match: {method: POST, path: "/exec/*/start"}, action: allow}
        - {match: {method: GET, path: "/exec/*/json"}, action: allow}
        - {match: {method: GET, path: "/images/**/json"}, action: allow}
        - {match: {method: POST, path: "/images/create"}, action: allow}
        - {match: {method: GET, path: "/networks"}, action: allow}
        - {match: {method: GET, path: "/networks/*"}, action: allow}
        - {match: {method: POST, path: "/networks/create"}, action: allow}
        - {match: {method: POST, path: "/networks/*/connect"}, action: allow}
        - {match: {method: POST, path: "/networks/*/disconnect"}, action: allow}
        - {match: {method: DELETE, path: "/networks/*"}, action: allow}
        - {match: {method: POST, path: "/volumes/create"}, action: allow}
        - {match: {method: GET, path: "/volumes/*"}, action: allow}
        - {match: {method: DELETE, path: "/volumes/*"}, action: allow}
        - {match: {method: "*", path: "/**"}, action: deny, reason: "the CashPilot worker does not use this Docker API call"}
      # END socket proxy policy

이것이 실제 파일입니다

위 블록은 저장소의 docker-compose.yml을 그대로 포함한 것이므로, 실제로 배포되는 내용과 어긋날 수 없습니다. 예전에 손으로 복사한 버전은 워커의 Docker 소켓 API를 모든 인터페이스에 게시하고 :latest를 고정했는데, 둘 다 보안 기본값 페이지에서 하지 말라고 안내하는 일입니다.

Docker 소켓 접근

워커는 Docker를 통해 서비스 컨테이너를 관리하지만 /var/run/docker.sock을 마운트하지 않습니다. cashpilot-socket-proxy 컨테이너가 소켓을 보유하고 워커가 하는 호출만 전달하며, 특권 컨테이너와 목록에 없는 호스트 폴더의 바인드는 거부합니다(거부하는 항목). 앱 내 업데이트는 선택 사항입니다. compose 파일 옆의 .env에 CASHPILOT_COMPOSE_DIR=<this folder>가 있을 때만 실행되며, 이 설정은 컨테이너가 그 폴더를 바인드하도록 허용하므로 프록시가 약해집니다(그 대가). 설정하지 않은 채로 두고 docker compose pull && docker compose up -d로 업데이트하십시오. 워커는 여전히 호스트의 모든 컨테이너를 제어하므로, 최상의 보안을 위해 CashPilot을 전용 머신이나 VLAN에서 실행하십시오.

비밀 키 유지

자격 증명은 CASHPILOT_SECRET_KEY가 아니라 CASHPILOT_ENCRYPTION_KEY로 암호화됩니다. CASHPILOT_SECRET_KEY는 로그인 세션에 서명할 뿐입니다. 암호화 키는 첫 실행 때 자동 생성되어 /data/.fernet_key에 저장됩니다. 그 파일을 백업하십시오. 그 파일 없이 볼륨이 다시 만들어지면 새 키가 생성되고, 저장된 모든 자격 증명을 영구히 읽을 수 없게 됩니다. CASHPILOT_ENCRYPTION_KEY 설정은 그 백업을 복원하기 위한 것입니다. 키 파일이 항상 우선하므로, 정상 인스턴스에서 설정해도 아무것도 바뀌지 않습니다.

UI의 비밀번호와 비밀 값

아바타 메뉴 -> Change password (비밀번호 변경)에서 언제든 자신의 비밀번호를 바꿀 수 있습니다(모든 역할에서 사용 가능). 이렇게 하면 다른 세션은 로그아웃됩니다. Settings (설정)에서 저장된 비밀 값은 쓰기 전용입니다. 바꾸려면 값을 입력하고, 기존 값을 유지하려면 필드를 비워 두십시오. 저장된 자격 증명은 브라우저로 다시 전송되지 않습니다.

CashPilot 업데이트

compose 파일은 drumsergio/cashpilot:X.Y 같은 major.minor 시리즈를 고정하므로, pull은 그 시리즈의 최신 패치를 가져옵니다:

docker compose pull
docker compose up -d

docker compose pull은 게시된 최신 이미지를 가져오고, up -d는 이미지가 바뀐 컨테이너만 다시 만듭니다. 배포되는 compose 파일에는 pull_policy: always가 설정되어 있으므로, docker compose up -d만 실행해도 먼저 최신 이미지를 가져옵니다.

대시보드에서. Settings (설정)의 About and updates (정보 및 업데이트)는 수명이 짧은 도우미 컨테이너에서 같은 두 명령을 대신 실행합니다. 도우미는 compose 파일과 그 옆의 .env (또는 --env-file로 전달한 파일)를 읽으며, CashPilot을 시작한 셸은 절대 읽지 않습니다. 예를 들어 CASHPILOT_UI_PORT=8088 docker compose up -d로 시작했다고 합시다. 업데이트는 대시보드를 8080으로 되돌리게 되므로, 업데이트를 중지하고 그 이유를 알려 줍니다. 그 값을 .env에 넣으면 버튼이 작동합니다.

다시 빌드할 필요가 없습니다

CashPilot은 미리 빌드된 멀티 아키텍처 이미지를 Docker Hub에서 제공합니다 (drumsergio/cashpilot, drumsergio/cashpilot-worker). docker compose build / --build는 docker-compose.build.yml로 일부러 소스에서 빌드할 때만 관련이 있습니다. 일반 설치에서는 pull + up -d가 완전하고 올바른 업데이트 절차입니다.

특정 버전 고정하기

정확히 한 릴리스에 머물려면 docker-compose.yml에서 X.Y 시리즈 태그를 drumsergio/cashpilot과 drumsergio/cashpilot-worker 모두에서 전체 릴리스 태그 X.Y.Z로 바꾸고(두 곳 모두 항상 같은 태그), pull_policy: always를 제거하십시오. 태그는 Docker Hub에서 볼 수 있습니다.

더 새로운 시리즈로 옮기려면 두 태그를 모두 편집합니다. UI 호스트에서 먼저, 그다음 모든 워커 호스트에서 합니다. 3.0 같은 메이저 릴리스에는 자체 단계가 있으므로 먼저 UPGRADING.md를 읽으십시오.

업데이트 자동화(선택 사항)

손대지 않고 업데이트하려면 스케줄러가 같은 두 명령을 실행하게 하십시오. 예를 들어 매일 실행되는 cron 항목을 씁니다:

0 4 * * *  cd /path/to/cashpilot && docker compose pull && docker compose up -d

또는 Watchtower나 Diun 같은 자동 업데이트 도구를 CashPilot 컨테이너에 대해 실행하십시오. 이것들은 선택 사항입니다. CashPilot에는 업데이트 도구가 포함되어 있지 않습니다.

오래된 이미지 정리하기

CashPilot은 앱 이미지 업데이트로 교체된 이미지만 삭제하며, 그것도 원시 Docker 소켓이 있는 워커에서만 삭제합니다. 그 밖의 경우에는 업데이트와 재배포를 할 때마다 이전 이미지가 디스크에 남을 수 있습니다. 서버 세 대로 된 테스트 플릿에서는 오래된 CashPilot 이미지와 수익 앱 이미지가 합쳐서 약 3 GB였습니다. 이는 같은 호스트의 다른 프로그램이 보통 남기는 양에 비하면 작으므로, 호스트 전체를 살펴보십시오:

docker system df

Images 줄의 RECLAIMABLE 값이 Docker가 확보할 수 있는 용량입니다.

CashPilot이 이 작업을 대신하지 않는 이유. 워커는 소켓 프록시를 통해 Docker에 접근합니다. 이미지에 대해 프록시는 이름으로 이미지를 하나 가져오고 하나 읽는 것만 허용하고, 그 밖에는 아무것도 허용하지 않습니다. 워커는 호스트의 이미지를 나열하거나 삭제할 수 없습니다. 그렇게 할 수 있는 워커라면 호스트의 다른 모든 프로그램의 이미지도 보고 삭제할 수 있게 됩니다. 프록시가 거부하는 항목을 참고하십시오.

1단계: 댕글링 이미지 제거. 댕글링 이미지는 태그가 없고, 실행 중이든 중지되었든 어떤 컨테이너도 사용하지 않는 이미지입니다. X.Y(compose 파일이 고정하는 것 같은 시리즈), latest 또는 다이제스트처럼 움직이는 태그로 업데이트하면 정확히 이런 이미지가 남습니다:

docker image prune

이 명령은 움직이는 태그로 업데이트하기 전에 실행하던 이미지도 삭제합니다. 그 시리즈의 새 이미지가 도착하면 이전 이미지에는 태그가 없기 때문입니다. 되돌아갈 방법을 남기려면 업데이트 전에 정확한 버전을 적어 두십시오(사이드바 하단에 표시됩니다). 그러면 drumsergio/cashpilot:<X.Y.Z>를 다시 가져올 수 있습니다. 또는 compose 파일을 정확한 X.Y.Z 태그로 고정하십시오. 그러면 이전 이미지가 태그를 유지하므로 2단계가 적용됩니다.

Docker는 삭제하기 전에 확인을 요청합니다. cron 항목에서는 --force를 추가해 질문을 건너뜁니다. 그 밖에는 아무것도 바뀌지 않습니다:

30 4 * * 0  docker image prune --force

-a를 추가하지 마십시오

docker image prune -a는 댕글링이든 태그가 있든, 지금 어떤 컨테이너도 사용하지 않는 모든 이미지를 삭제합니다. 여기에는 일부러 중지한 스택의 이미지와, 로컬에서 빌드해서 다시 가져올 수 없는 이미지도 포함됩니다.

2단계: 오래된 고정 태그 제거. 버전에 고정된 이미지는 더 새로운 버전으로 옮긴 뒤에도 태그를 유지하므로 prune이 건너뜁니다. 다음 CashPilot 이미지는 고정되어 있습니다:

저장소 고정하는 주체
drumsergio/cashpilot compose 파일(이전 시리즈, 또는 직접 고정한 정확한 버전)
drumsergio/cashpilot-worker compose 파일, 위와 같음
drumsergio/cashpilot-tunnel 워커, 워커 버전마다 태그 하나
drumsergio/cashpilot-earnapp EarnApp 카탈로그 항목
drumsergio/cashpilot-anyone Anyone Protocol 카탈로그 항목

제거한 서비스의 이미지도 마찬가지입니다. 그 태그는 직접 제거할 때까지 남습니다. MystNodes나 ProxyBase처럼 다이제스트로 고정된 카탈로그 이미지는 더 새로운 이미지로 교체되면 태그를 잃으므로, 1단계에서 이미 처리됩니다.

먼저 어떤 컨테이너도 사용하지 않는 태그를 나열합니다. 이 예시는 워커 이미지용입니다. 표의 다른 저장소에는 repo를 바꾸십시오:

repo=drumsergio/cashpilot-worker
used=$(docker ps -a --format '{{.Image}}')
docker image ls "$repo" --format '{{.Repository}}:{{.Tag}}' | grep -vxF "$used"

그런 다음 오래된 태그를 이름으로 하나씩 제거합니다:

docker image rm drumsergio/cashpilot-worker:<old tag>

-f를 추가하지 마십시오. 이 옵션이 없으면 Docker는 실행 중이든 중지되었든 컨테이너가 아직 사용하는 이미지의 제거를 거부하고 conflict: unable to delete를 출력합니다. 이 메시지가 보이면 그 이미지를 유지하십시오. 실행 중인 태그와 그 직전에 실행하던 태그는 유지해야 한 버전 뒤로 되돌아갈 수 있습니다. 그 두 태그보다 오래된 태그만 제거하십시오.

대시보드의 Host disk (호스트 디스크) 열은 워커의 /data가 있는 파일 시스템의 여유 공간을 보여 줍니다. 이미지는 보통 같은 파일 시스템의 Docker 데이터 루트 아래에 있지만, 항상 그렇지는 않습니다. docker info --format '{{.DockerRootDir}}'는 Docker의 데이터 루트를 보여 줍니다. 새로 설치한 Docker Engine 29의 기본값인 containerd 이미지 저장소를 쓰면 이미지는 대신 containerd의 루트 아래, 보통 /var/lib/containerd에 있습니다. docker info --format '{{.Driver}}'는 containerd 이미지 저장소에서는 overlayfs를, 기존 저장소에서는 overlay2를 출력합니다. 해당하는 디렉터리가 있는 파일 시스템의 여유 공간을 확인하십시오.

지원 서비스

CashPilot은 다섯 카테고리에 걸쳐 활성 또는 베타 상태인 60개 서비스를 지원합니다:

  • 대역폭 공유 (19): 인터넷 대역폭을 공유해 패시브 인컴을 얻습니다
  • DePIN (16): 탈중앙화 물리 인프라 네트워크
  • GPU 컴퓨팅 (7): AI 및 컴퓨팅 작업에 GPU를 대여합니다
  • 스토리지 (3): 탈중앙화 스토리지 네트워크에 디스크 공간을 공유합니다
  • 채굴 (14): 채굴기를 배포하거나 지급 주소로 풀을 추적합니다(채굴)

이 중 30개는 Docker로 자동 배포하고 관리할 수 있습니다. 카탈로그는 나머지 30개(19개 브라우저 또는 데스크톱 앱, 7개 GPU 노드, 4개 채굴 풀)를 추적합니다. CashPilot은 수집기가 있는 경우 그 잔액을 읽습니다.

전체 카탈로그는 서비스 가이드 섹션에서 둘러보십시오.

다음 단계