Saltar a contenido
Editar esta página

Primeros pasos

La versión en inglés de esta página es más reciente. Lee la versión en inglés.

Requisitos previos

  • Docker con el plugin Compose v2, versión 2.23.1 o posterior. Compruébalo con docker compose version. Las versiones anteriores no pueden leer la configuración en línea del archivo compose. Docker Desktop incluye el plugin. En un Docker Engine sin más en Linux, instálalo desde el repositorio de paquetes de Docker (https://docs.docker.com/compose/install/linux/). En macOS con Colima, instálalo con Homebrew y enlázalo como plugin de 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
    
  • Un host Linux, macOS o Windows (amd64 o arm64)

  • Al menos 1 GB de RAM libre para CashPilot y los servicios que gestiona
  • Un CashPilot por host de Docker. Consulta la advertencia de abajo.

Un CashPilot por host de Docker

No ejecutes dos instalaciones de CashPilot en un mismo host de Docker. Los archivos compose usan nombres de contenedor fijos (cashpilot-ui, cashpilot-worker, cashpilot-socket-proxy), así que una segunda copia del archivo falla por un conflicto de nombres. Si los renombras para evitarlo, las dos instalaciones siguen compartiendo el host. Cada worker gestiona todos los contenedores que llevan las etiquetas de CashPilot, sea cual sea la instalación que los creó. Así, cada panel lista, detiene y sustituye las apps de ingresos de la otra. Las dos comparten además la red cashpilot-isolated, los nombres de las apps de ingresos (cashpilot-<service>), sus puertos del host y volúmenes como mysterium-data. Para una segunda instalación, usa otro host u otra VM. Para ejecutar apps de ingresos en más servidores, añade workers a un solo panel (Flota).

Inicio rápido

1. Descarga el archivo compose y arráncalo

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

Esto arranca tres contenedores de larga duración. Antes que ellos, un contenedor de un solo uso, cashpilot-migrate, se ejecuta y termina con código 0 en cada up, así que docker compose ps -a lo muestra como Exited (0). Es normal.

Contenedor Puerto Función
cashpilot-migrate ninguno Se ejecuta una vez y termina. Mueve los datos que dejó una versión anterior a volúmenes que el proxy del socket acepta, y en una instalación nueva no encuentra nada que hacer
cashpilot-ui 8080 Panel web, recolección de ganancias, catálogo de servicios
cashpilot-worker 8081 Agente de Docker que despliega y supervisa los contenedores de los servicios
cashpilot-socket-proxy ninguno Tiene el socket de Docker y da al worker una copia filtrada (Valores de seguridad por defecto)

2. Abre el panel

Abre http://localhost:8080 en tu navegador. Como aún no existe ninguna cuenta, llegas a la página de bienvenida, que crea la cuenta de propietario.

¿El puerto 8080 ya está en uso?

Elige otro puerto del host en un archivo .env junto a docker-compose.yml, en lugar de editar el archivo compose:

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

Después abre http://localhost:8088. Mantén el valor en .env, porque la actualización desde la app lee ese archivo y no tu shell. (printf empieza con un salto de línea para que la línea nunca se una a la última de un .env existente).

La variable necesita un docker-compose.yml cuya línea ports: diga ${CASHPILOT_UI_PORT:-8080}:8080. El archivo de la v1.61 y anteriores fija 8080:8080 y la ignora. Descarga el archivo actual, o conserva tu propio mapeo de puertos editado: la actualización desde la app también lo acepta.

Se necesita un token de configuración inicial

En el primer arranque, CashPilot genera un token de configuración de un solo uso y lo escribe en los registros del contenedor cashpilot-ui:

docker compose logs cashpilot-ui

Busca una línea como esta:

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

Copia ese token en el campo Setup token (token de configuración) del paso Owner account (cuenta de propietario) de la página de bienvenida, junto con un nombre de usuario y una contraseña, para crear la primera cuenta (la de propietario). Solo aparece en los registros, nunca en una URL, y se descarta para siempre en cuanto existe la cuenta de propietario.

3. Explora el catálogo de servicios

La página Catalog (Catálogo) lista cada servicio con sus plataformas, una estimación mensual y lo que necesita (IP residencial, GPU). Filtra por categoría (Bandwidth, DePIN, Storage, Compute, Mining) o busca por nombre. Add (Añadir) abre el asistente de configuración en ese servicio, Details (Detalles) muestra su descripción, sus pagos y el riesgo del despliegue, y los servicios que no funcionan en Docker tienen en su lugar un enlace Visit (Visitar).

Hay dos tipos de servicio que conviene mirar antes con más atención: los que solo pagan después de que bloquees un stake de tokens, como Anyone Protocol, Sia y Flux, y los relays que publican tu IP, lo que puede reducir lo que te pagan las apps de ancho de banda residencial. Consulta Comprueba dos cosas antes de desplegar.

4. Añade servicios con el asistente

En cuanto existe la cuenta de propietario, Add services (Añadir servicios) abre el asistente de configuración; más adelante, el botón + Add service (Añadir servicio) de la barra superior lo vuelve a abrir. Elige categorías y después servicios. Para cada servicio, el asistente muestra un enlace Sign Up (Registrarse), pide solo las credenciales que ese servicio necesita (correo y contraseña, token de API, etc.) y te deja elegir los workers donde ejecutarlo. Haz clic en Deploy (Desplegar) y CashPilot descarga la imagen, crea el contenedor y empieza a vigilarlo.

5. Síguelo en el panel

El panel muestra cada servicio desplegado con su estado y su saldo, y la página Fleet (Flota) muestra todos los workers.

Cómo funciona

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. Tú configuras los servicios desde la interfaz web: eliges un servicio, introduces las credenciales y haces clic en desplegar.
  2. La UI envía la especificación del contenedor (imagen, variables de entorno, volúmenes) al worker mediante una API REST.
  3. El worker crea el contenedor de Docker y empieza a supervisar su salud.
  4. El worker informa del estado del contenedor a la UI cada 60 segundos mediante señales de vida.
  5. La UI recoge las ganancias de las API de los servicios según un horario configurable (por defecto, cada hora).
  6. El panel muestra las ganancias agregadas, el desglose por servicio y la salud de los contenedores.

Configuración

Variables de entorno de la UI

Variable Valor por defecto Descripción
TZ UTC Zona horaria para la programación y la visualización
CASHPILOT_SECRET_KEY (generada automáticamente) Clave de firma de las sesiones de inicio de sesión. Se guarda en /data/.secret_key. No cifra las credenciales
CASHPILOT_ENCRYPTION_KEY (generada automáticamente) Clave Fernet que cifra en reposo las credenciales guardadas. Se guarda en /data/.fernet_key. Solo se usa cuando ese archivo no existe, y nunca se escribe en /data. CASHPILOT_ENCRYPTION_KEY_FILE (una ruta) tiene prioridad sobre ambos: consulta Clave de cifrado fuera de la carpeta de datos
CASHPILOT_API_KEY (desde /fleet) Clave compartida para dar de alta los workers. Cada worker recibe su propia clave al darse de alta; consulta Flota
CASHPILOT_COLLECT_INTERVAL 60 Minutos entre ciclos de recolección de ganancias
CASHPILOT_UI_PORT 8080 Puerto del host en el que se publica la UI. Configúralo en .env cuando el 8080 esté ocupado
CASHPILOT_BIND_ADDR 127.0.0.1 Interfaz del host en la que se publica el puerto de la UI. Loopback por defecto: el panel puede dar órdenes al worker que tiene el socket de Docker, así que de serie no queda expuesto a tu red. Pon una IP concreta (p. ej. una dirección de Tailscale o de VPN) o 0.0.0.0 para exponerlo o, mejor aún, pon delante un proxy inverso con autenticación

El puerto web de la UI dentro del contenedor es fijo, 8080 (lo fija el CMD del contenedor). CASHPILOT_UI_PORT y CASHPILOT_BIND_ADDR eligen solo el puerto y la interfaz del host en los que se publica.

Variables de entorno del worker

Variable Valor por defecto Descripción
TZ UTC Zona horaria
CASHPILOT_UI_URL -- URL del contenedor de la UI, p. ej. http://cashpilot-ui:8080
CASHPILOT_API_KEY -- Debe coincidir con la clave de alta de la UI. Solo hace falta para dar de alta el worker; después el worker usa su propia clave
CASHPILOT_WORKER_NAME (nombre del host) Nombre que muestra este worker en el panel de la flota
CASHPILOT_WORKER_URL (detectada automáticamente) URL que usa la UI para llegar a este worker, p. ej. http://192.168.1.50:8081. Configúrala a mano en flotas con varios hosts: la detección automática puede dar una IP interna del contenedor que no es accesible
CASHPILOT_WORKER_BIND_ADDR 127.0.0.1 Solo en el compose de flota y de worker remoto (docker-compose.fleet.yml): interfaz del host en la que se publica el puerto de la API del worker con socket de Docker, loopback por defecto. El docker-compose.yml por defecto no publica el puerto 8081 en absoluto. La API del worker puede desplegar y detener cualquier contenedor (= root en el host), así que para un worker remoto enlázala a una interfaz privada o de VPN (p. ej. una IP de Tailscale), nunca a una IP pública
CASHPILOT_PORT 8081 Puerto que el worker anuncia a la UI. No cambia el puerto de escucha, que fija el CMD de la imagen; consulta la referencia de configuración

Ejemplo de 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

Este es el archivo real

El bloque de arriba se incluye tal cual desde docker-compose.yml en el repositorio, así que no puede desviarse de lo que de verdad se publica. Antes, una versión copiada a mano publicaba la API del worker con socket de Docker en todas las interfaces y fijaba :latest, dos cosas que la página de valores de seguridad por defecto te dice que no hagas.

Acceso al socket de Docker

El worker gestiona los contenedores de los servicios a través de Docker, pero no monta /var/run/docker.sock. El contenedor cashpilot-socket-proxy tiene el socket y solo deja pasar al worker las llamadas que este hace, y rechaza contenedores privilegiados y montajes de carpetas del host que no hayas incluido en la lista (qué rechaza). La actualización desde la app es opcional: solo funciona con CASHPILOT_COMPOSE_DIR=<this folder> en el .env junto al archivo compose, y ese ajuste deja que los contenedores monten la carpeta, lo que debilita el proxy (lo que cuesta). Déjalo sin configurar y actualiza con docker compose pull && docker compose up -d. El worker sigue controlando todos los contenedores del host, así que, para mayor seguridad, ejecuta CashPilot en una máquina o VLAN dedicada.

Persistencia de la clave secreta

Las credenciales se cifran con CASHPILOT_ENCRYPTION_KEY, no con CASHPILOT_SECRET_KEY, que solo firma las sesiones de inicio de sesión. La clave de cifrado se genera automáticamente en el primer arranque y se guarda en /data/.fernet_key. Haz una copia de seguridad de ese archivo. Si el volumen se vuelve a crear sin él, se genera una clave nueva y todas las credenciales guardadas quedan ilegibles para siempre. CASHPILOT_ENCRYPTION_KEY sirve para restaurar esa copia; el archivo de clave siempre tiene prioridad, así que configurarla en una instancia sana no cambia nada.

Contraseñas y secretos en la UI

Cambia tu contraseña cuando quieras desde el menú del avatar -> Change password (Cambiar contraseña), disponible para todos los roles; esto cierra tus otras sesiones. En Settings (Ajustes), los secretos guardados son de solo escritura: introduce un valor para cambiarlo o deja el campo vacío para conservar el actual. Las credenciales guardadas nunca se devuelven al navegador.

Actualizar CashPilot

El archivo compose fija una serie major.minor, como drumsergio/cashpilot:X.Y, así que pull descarga el parche más reciente de esa serie:

docker compose pull
docker compose up -d

docker compose pull descarga la imagen publicada más reciente y up -d vuelve a crear solo los contenedores cuya imagen ha cambiado. Los archivos compose que se distribuyen fijan pull_policy: always, así que incluso un simple docker compose up -d descarga antes la imagen más reciente.

Desde el panel. Settings, About and updates (Acerca de y actualizaciones) ejecuta por ti los mismos dos comandos desde un contenedor auxiliar de corta duración. El auxiliar lee tus archivos compose y el .env que está junto a ellos (o los archivos que pasaste con --env-file), nunca la shell desde la que arrancaste CashPilot. Supón que lo arrancaste con CASHPILOT_UI_PORT=8088 docker compose up -d. La actualización volvería a poner el panel en el 8080, así que se detiene y te explica el motivo. Pon ese valor en .env y el botón funciona.

No necesitas recompilar

CashPilot distribuye imágenes multiarquitectura ya compiladas en Docker Hub (drumsergio/cashpilot, drumsergio/cashpilot-worker). docker compose build / --build solo importa si compilas a propósito desde el código fuente con docker-compose.build.yml. En una instalación normal, pull + up -d es el procedimiento de actualización completo y correcto.

Fijar una versión concreta

Para quedarte en una versión exacta, sustituye la etiqueta de serie X.Y en docker-compose.yml por una etiqueta de versión completa X.Y.Z tanto en drumsergio/cashpilot como en drumsergio/cashpilot-worker (siempre la misma etiqueta en las dos), y quita pull_policy: always. Consulta las etiquetas en Docker Hub.

Para pasar a una serie más reciente, edita las dos etiquetas: primero en el host de la UI y después en cada host de worker. Lee antes UPGRADING.md, porque una versión mayor como la 3.0 tiene sus propios pasos.

Automatizar las actualizaciones (opcional)

Si quieres actualizaciones sin intervenir, programa los mismos dos comandos, por ejemplo con una entrada diaria de cron:

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

O usa un actualizador automático como Watchtower o Diun sobre los contenedores de CashPilot. Son opcionales. CashPilot no incluye ningún actualizador.

Limpiar imágenes antiguas

CashPilot borra una imagen solo después de que una actualización de imagen de una app la haya sustituido, y solo en un worker con el socket de Docker directo, sin proxy. En los demás casos, cada actualización y cada nuevo despliegue pueden dejar la imagen anterior en el disco. En una flota de prueba de tres servidores, las imágenes antiguas de CashPilot y de las apps de ingresos sumaban unos 3 GB en total. Es poco comparado con lo que suelen dejar otros programas en el mismo host, así que mira el host entero:

docker system df

El valor RECLAIMABLE de la línea Images es lo que Docker podría liberar.

Por qué CashPilot no lo hace por ti. El worker llega a Docker a través del proxy del socket. Con las imágenes, el proxy le deja descargar una y leer una por su nombre, y nada más. No puede listar las imágenes del host ni borrar ninguna. Un worker que pudiera hacerlo también vería y borraría las imágenes de cualquier otro programa del host. Consulta qué rechaza el proxy.

Paso 1: elimina las imágenes huérfanas. Una imagen huérfana (dangling) no tiene etiqueta y ningún contenedor la usa, ni en marcha ni detenido. Una actualización sobre una etiqueta móvil como X.Y (una serie como la que fijan los archivos compose), latest o un digest deja exactamente estas:

docker image prune

Esto también borra la imagen que usabas antes de una actualización sobre una etiqueta móvil: en cuanto llega la imagen nueva de esa serie, la antigua se queda sin etiqueta. Para conservar una vuelta atrás, apunta la versión exacta antes de actualizar (aparece al pie de la barra lateral), para poder volver a descargar drumsergio/cashpilot:<X.Y.Z>. O fija el archivo compose a una etiqueta exacta X.Y.Z; así la imagen antigua conserva su etiqueta y se aplica el paso 2.

Docker pregunta antes de borrar. En una entrada de cron, añade --force para saltarte la pregunta. No cambia nada más:

30 4 * * 0  docker image prune --force

No añadas -a

docker image prune -a borra todas las imágenes que ningún contenedor usa en este momento, huérfanas o con etiqueta. Eso incluye imágenes de stacks que detuviste a propósito e imágenes que compilaste en local y que no puedes volver a descargar.

Paso 2: elimina las etiquetas fijadas antiguas. Una imagen fijada a una versión conserva su etiqueta después de que pases a una más reciente, así que prune se la salta. Estas imágenes de CashPilot están fijadas:

Repositorio Qué la fija
drumsergio/cashpilot El archivo compose (una serie antigua o una versión exacta que fijaste)
drumsergio/cashpilot-worker El archivo compose, igual que arriba
drumsergio/cashpilot-tunnel El worker, una etiqueta por cada versión del worker
drumsergio/cashpilot-earnapp La entrada de EarnApp en el catálogo
drumsergio/cashpilot-anyone La entrada de Anyone Protocol en el catálogo

Lo mismo pasa con la imagen de un servicio que eliminaste: su etiqueta se queda hasta que la eliminas. Una imagen del catálogo fijada por digest, como MystNodes o ProxyBase, pierde su etiqueta cuando la sustituye una más reciente, así que el paso 1 ya la cubre.

Primero lista las etiquetas que no usa ningún contenedor. Este ejemplo es para la imagen del worker. Para otro repositorio de la tabla, cambia repo:

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

Después elimina cada etiqueta antigua por su nombre, de una en una:

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

No añadas -f. Sin esa opción, Docker se niega a eliminar una imagen que un contenedor todavía usa, en marcha o detenido, y muestra conflict: unable to delete. Cuando lo veas, conserva la imagen. Conserva la etiqueta que usas y la que usabas antes, para poder volver atrás una versión. Elimina solo las etiquetas más antiguas que esas dos.

La columna Host disk (disco del host) del panel muestra el espacio libre del sistema de archivos que contiene el /data del worker. Las imágenes suelen estar en el mismo sistema de archivos, dentro del directorio de datos de Docker, pero no siempre. docker info --format '{{.DockerRootDir}}' muestra el directorio de datos de Docker. Con el almacén de imágenes de containerd, el predeterminado en una instalación nueva de Docker Engine 29, las imágenes están en el directorio raíz de containerd, normalmente /var/lib/containerd. docker info --format '{{.Driver}}' muestra overlayfs con el almacén de imágenes de containerd y overlay2 con el clásico. Comprueba el espacio libre del sistema de archivos que contiene el directorio que corresponda.

Servicios compatibles

CashPilot es compatible con 60 servicios activos o en beta, en cinco categorías:

  • Compartir ancho de banda (19): comparte tu ancho de banda de internet para obtener ingresos pasivos
  • DePIN (16): redes descentralizadas de infraestructura física
  • Cómputo con GPU (7): alquila tu GPU para cargas de trabajo de IA y de cómputo
  • Almacenamiento (3): comparte espacio en disco en redes de almacenamiento descentralizadas
  • Minería (14): despliega un minero o sigue un pool por su dirección de pago (Minería)

De ellos, 30 se pueden desplegar y gestionar automáticamente con Docker. El catálogo sigue los otros 30 (19 apps de navegador o de escritorio, 7 nodos de GPU, 4 pools de minería). CashPilot lee sus saldos cuando existe un recolector.

Consulta el catálogo completo en la sección Guías de servicios.

Siguientes pasos