The production image is now a single Go binary that serves both the JSON/WebSocket API under /api and the Svelte dashboard at /. - New internal/webui package embeds a dist/ subdir via //go:embed. A placeholder index.html is committed so `go build` works on a fresh checkout; anything else in dist/ is regenerated per build and gitignored. - httpapi.Server.Handler mounts the embed.FS at / with SPA-style fallback: unknown non-/api paths serve index.html so client-side routes survive a reload. /api/* is carved out explicitly so POSTs or typos never accidentally shadow API semantics with HTML. - api/Dockerfile grows a node:22 builder stage that runs `npm ci && npm run build`, and the Go stage copies ui/dist/ into internal/webui/dist/ before `go build`. Build context moves to the repo root (docker-compose + `make api` both updated) so the Dockerfile can see both api/ and ui/. With this in place, `make up` brings the whole stack online at http://localhost:8080 — API under /api, dashboard at /. The Vite dev server on :5173 with the /api proxy is still available via `make ui-dev` for hot-reload development.
84 lines
2.6 KiB
YAML
84 lines
2.6 KiB
YAML
# ----------------------------------------------------------------------------
|
|
# Kamado Pool — development compose
|
|
#
|
|
# Spins up ckpool-solo and kamado-api pointing at a bitcoind. Expects
|
|
# bitcoind to be reachable at the host/port set in the env blocks below.
|
|
# For local testing, run bitcoind on regtest/testnet4 and set these via .env.
|
|
#
|
|
# ckpool and kamado-api share the `ckpool-sock` named volume so the API
|
|
# can dial /run/ckpool/stratifier directly.
|
|
# ----------------------------------------------------------------------------
|
|
services:
|
|
ckpool:
|
|
build:
|
|
context: ./ckpool
|
|
dockerfile: Dockerfile
|
|
container_name: kamado-ckpool
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3333:3333"
|
|
volumes:
|
|
- ckpool-sock:/run/ckpool
|
|
- ./data/logs:/var/log/ckpool
|
|
environment:
|
|
# --- Bitcoin Core connection ---
|
|
BITCOIN_RPC_HOST: "host.docker.internal"
|
|
BITCOIN_RPC_PORT: "48332" # testnet4 default
|
|
BITCOIN_RPC_USER: "${BITCOIN_RPC_USER:-kamado}"
|
|
BITCOIN_RPC_PASSWORD: "${BITCOIN_RPC_PASSWORD:-kamado}"
|
|
BITCOIN_NOTIFY: "true"
|
|
ZMQ_BLOCK: "${ZMQ_BLOCK:-}" # e.g. tcp://host.docker.internal:28332
|
|
|
|
# --- Pool settings ---
|
|
POOL_BTCADDRESS: "${POOL_BTCADDRESS:?set POOL_BTCADDRESS in .env}"
|
|
POOL_BTCSIG: "/Kamado Pool dev/"
|
|
STRATUM_PORT: "3333"
|
|
|
|
# --- Difficulty ---
|
|
MINDIFF: "1"
|
|
STARTDIFF: "1"
|
|
MAXDIFF: "0"
|
|
# Drop clients idle longer than N seconds (0 = never drop)
|
|
DROPIDLE: "0"
|
|
|
|
# --- Logging ---
|
|
SHARE_LOG: "1"
|
|
LOGDIR: "/var/log/ckpool"
|
|
SOCKET_DIR: "/run/ckpool"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
|
|
api:
|
|
build:
|
|
# Repo root so the Dockerfile can pull in both api/ and ui/.
|
|
context: .
|
|
dockerfile: api/Dockerfile
|
|
container_name: kamado-api
|
|
restart: unless-stopped
|
|
depends_on:
|
|
- ckpool
|
|
ports:
|
|
- "8080:8080"
|
|
volumes:
|
|
- ckpool-sock:/run/ckpool
|
|
- ./data/logs:/var/log/ckpool:ro
|
|
- kamado-db:/var/lib/kamado
|
|
environment:
|
|
LISTEN_ADDR: ":8080"
|
|
CKPOOL_SOCKDIR: "/run/ckpool"
|
|
CKPOOL_LOGFILE: "/var/log/ckpool/ckpool.log"
|
|
POLL_INTERVAL: "5s"
|
|
|
|
# --- Bitcoin Core RPC (same creds as ckpool) ---
|
|
BITCOIN_RPC_URL: "http://host.docker.internal:48332"
|
|
BITCOIN_RPC_USER: "${BITCOIN_RPC_USER:-kamado}"
|
|
BITCOIN_RPC_PASSWORD: "${BITCOIN_RPC_PASSWORD:-kamado}"
|
|
BITCOIN_RPC_TIMEOUT: "10s"
|
|
BITCOIN_ZMQ_BLOCK: "${ZMQ_BLOCK:-}"
|
|
extra_hosts:
|
|
- "host.docker.internal:host-gateway"
|
|
|
|
volumes:
|
|
ckpool-sock:
|
|
kamado-db:
|