jam/docker/regtest/docker-compose-common.yml
Thebora Kompanioni 454daa2839
chore(regtest): initial joinmarket-ng backend for regtest environment (#1240)
* chore(regtest): initial joinmarket-ng backend for regtest environment

Adds jmwalletd, directory servers, makers, and bitcoind to the regtest
docker-compose environment so jam can be developed against the jm-ng
backend end-to-end.

chore(regtest): wire docker compose env and vite dev proxy for jm-ng

Connects the local regtest containers into a single compose network,
adds tor and fund-wallet helpers, and points Vite's dev proxy at the
local jmwalletd instance.

fix(tags): recognize cj-change, used-empty, and flagged UTXO statuses

joinmarket-ng's WalletService emits four statuses jam's JmPlainTagValue
didn't cover: 'cj-change' (deanonymising change from our CJ),
'used-empty' (previously-used address with zero balance), and 'flagged'
(address shared in a CJ that later failed). They fell through to the
generic 'default' badge with no distinguishing styling.

Add them to JmPlainTagValue and the status->variant map. 'used-empty'
maps to the existing 'used' variant, 'flagged' to 'reused' (both signal
a used address the user should avoid reusing). Add a dedicated
'cj-change' badge variant (emerald) next to 'cj-out' so the
deanonymising change output is visually distinct from an equal-amount
CJ output.

fix(send): keep direct send available with maker

Only block collaborative sends while the maker service is running. Direct sends stay enabled and the form explains why the collaborative toggle is unavailable.

Changelog: Allow direct sends while the maker service is running

docs(dev): explain jm-ng backend workflow

fix(auth): only clear auth on invalid_token 401s

Previously every 401 response cleared the session and logged the user out. jm-ng returns 401 for service-state errors (e.g. POST /tumbler/stop when nothing is running), which should never drop the session. Inspect the WWW-Authenticate header and only clear auth when the server signals ``error="invalid_token"``.

Changelog: Non-auth 401 responses no longer log the user out.

fix(dev): proxy /jmws to the jm-ng HTTPS port

jm-ng serves WebSocket on the same port as the HTTPS API. The `jm-ng:dev` script used to override JMWALLETD_WEBSOCKET_PORT to 32283, but the regtest stack exposes that port without a matching listener, so vite proxied WebSocket upgrades into a dead port and the handshake returned empty. Default the env var to JMWALLETD_API_PORT and drop the override.

Changelog: Fix WebSocket proxying in the local jm-ng dev setup.

fix(dev): correct jm-ng websocket port and proxy targets

Update the README and developer docs to reflect that both ports must be
set when overriding for a custom jm-ng setup.

fix(dev): correct jm-ng websocket port (#1237)

chore(dev): distinct server configs for various backends

* chore(regtest): address jm-ng review comments

---------

Co-authored-by: m0wer <m0wer@sgn.space>
Co-authored-by: Parth Bandwal <143504541+parrth20@users.noreply.github.com>
2026-05-05 13:52:41 +02:00

144 lines
5.7 KiB
YAML

services:
joinmarket_native:
build:
context: ./dockerfile-deps/joinmarket/latest
dockerfile: Dockerfile
restart: unless-stopped
environment:
ENSURE_WALLET: 'true'
REMOVE_LOCK_FILES: 'true'
jm_blockchain_source: regtest
jm_network: testnet
jm_rpc_host: bitcoind
jm_rpc_port: 43782
jm_directory_nodes: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
jm_socks5_host: tor
jm_socks5_port: 9050
jm_tor_control_host: tor
jm_tor_control_port: 9051
jm_minimum_makers: 1 # necessary to do coinjoins with this regtest setup; default is 4
jm_taker_utxo_age: 1 # faster testing of scheduler runs; default is 5
jm_maker_timeout_sec: 30 # easier testing of maker timeouts on regtest (and "Stall Monitor" retries); default is 60
expose:
- 62601 # obwatch
- 27183 # joinmarketd daemon
- 28183 # jmwalletd api
- 28283 # jmwalletd websocket
healthcheck:
test: ['CMD', 'supervisorctl', 'status']
interval: 10s
timeout: 10s
retries: 20
start_period: 60s
start_interval: 3s
joinmarket_jam_standalone:
build:
context: ./dockerfile-deps/joinmarket/webui-standalone
dockerfile: Dockerfile
restart: unless-stopped
environment:
ENSURE_WALLET: 'true'
REMOVE_LOCK_FILES: 'true'
jm_blockchain_source: regtest
jm_network: testnet
jm_rpc_host: bitcoind
jm_rpc_port: 43782
jm_directory_nodes: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
jm_socks5_host: tor
jm_socks5_port: 9050
jm_tor_control_host: tor
jm_tor_control_port: 9051
jm_minimum_makers: 1 # necessary to do coinjoins with this regtest setup; default is 4
jm_taker_utxo_age: 1 # faster testing of scheduler runs; default is 5
expose:
- 80 # nginx
- 28183 # jmwalletd api
healthcheck:
test: ['CMD', 'dinitctl', 'status', 'jmwalletd']
interval: 10s
timeout: 10s
retries: 20
start_period: 60s
start_interval: 3s
joinmarket_ng_native:
image: ghcr.io/joinmarket-ng/joinmarket-ng/jmwalletd:main
restart: unless-stopped
environment:
JOINMARKET_DATA_DIR: /root/.joinmarket-ng
JMWALLETD_HOST: 0.0.0.0
JMWALLETD_NO_TLS: ${JMWALLETD_NO_TLS:-false}
BITCOIN__BACKEND_TYPE: descriptor_wallet
BITCOIN__RPC_URL: http://bitcoind:43782
BITCOIN__RPC_USER: regtest
BITCOIN__RPC_PASSWORD: regtest
NETWORK_CONFIG__NETWORK: testnet
NETWORK_CONFIG__BITCOIN_NETWORK: regtest
NETWORK_CONFIG__DIRECTORY_SERVERS: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
DIRECTORY_NODES: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
OBWATCH_URL: http://joinmarket_ng_orderbook_watcher:8000
TOR__SOCKS_HOST: tor
TOR__SOCKS_PORT: 9050
TOR__CONTROL_HOST: tor
TOR__CONTROL_PORT: 9051
TOR__COOKIE_PATH: /var/lib/tor/control_auth_cookie
TAKER__MINIMUM_MAKERS: 1 # necessary to do coinjoins with this regtest setup
TAKER__MAKER_TIMEOUT_SEC: 30 # easier testing of maker timeouts on regtest
expose:
- 8000 # obwatch
- 28183 # jmwalletd api
- 28283 # jmwalletd websocket
healthcheck:
test:
[
'CMD',
'python',
'-c',
"import socket,ssl,sys; s=socket.socket(); s.settimeout(5);\ntry:\n c=ssl.create_default_context(); c.check_hostname=False; c.verify_mode=ssl.CERT_NONE; c.wrap_socket(s, server_hostname='localhost').connect(('127.0.0.1',28183)); sys.exit(0)\nexcept Exception:\n pass\ntry:\n s=socket.socket(); s.settimeout(5); s.connect(('127.0.0.1',28183)); s.close(); sys.exit(0)\nexcept Exception:\n sys.exit(1)",
]
interval: 10s
timeout: 10s
retries: 20
start_period: 60s
start_interval: 3s
joinmarket_ng_peer:
image: ghcr.io/joinmarket-ng/joinmarket-ng/jmwalletd:main
restart: unless-stopped
environment:
JOINMARKET_DATA_DIR: /root/.joinmarket-ng
JMWALLETD_HOST: 0.0.0.0
JMWALLETD_NO_TLS: ${JMWALLETD_NO_TLS:-false}
BITCOIN__BACKEND_TYPE: descriptor_wallet
BITCOIN__RPC_URL: http://bitcoind:43782
BITCOIN__RPC_USER: regtest
BITCOIN__RPC_PASSWORD: regtest
NETWORK_CONFIG__NETWORK: testnet
NETWORK_CONFIG__BITCOIN_NETWORK: regtest
NETWORK_CONFIG__DIRECTORY_SERVERS: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
DIRECTORY_NODES: ${JM_ALL_DIRECTORY_NODES:?You must set the directory node addresses in generated env file}
OBWATCH_URL: http://joinmarket_ng_orderbook_watcher:8000
TOR__SOCKS_HOST: tor
TOR__SOCKS_PORT: 9050
TOR__CONTROL_HOST: tor
TOR__CONTROL_PORT: 9051
TOR__COOKIE_PATH: /var/lib/tor/control_auth_cookie
TAKER__MINIMUM_MAKERS: 1 # necessary to do coinjoins with this regtest setup
expose:
- 8000 # obwatch
- 28183 # jmwalletd api
- 28283 # jmwalletd websocket
healthcheck:
test:
[
'CMD',
'python',
'-c',
"import socket,ssl,sys; s=socket.socket(); s.settimeout(5);\ntry:\n c=ssl.create_default_context(); c.check_hostname=False; c.verify_mode=ssl.CERT_NONE; c.wrap_socket(s, server_hostname='localhost').connect(('127.0.0.1',28183)); sys.exit(0)\nexcept Exception:\n pass\ntry:\n s=socket.socket(); s.settimeout(5); s.connect(('127.0.0.1',28183)); s.close(); sys.exit(0)\nexcept Exception:\n sys.exit(1)",
]
interval: 10s
timeout: 10s
retries: 20
start_period: 60s
start_interval: 3s