- Fix EXTENSION_SERVICE_URL default to localhost (was hardcoded LAN IP) - Fix strfry healthcheck (BusyBox nc lacks -z, use /proc/net/tcp) - Add LP healthcheck + depends_on strfry - Add regtest-bootstrap.sh: funds LND, opens channels, creates LP app - Add regtest.sh: single management script (up/down/reset/status/logs/lncli/bitcoin) - Minimal start uses only 3 containers (bitcoind, lnd-1, lnd-4) instead of 17 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
166 lines
5.4 KiB
YAML
166 lines
5.4 KiB
YAML
# Lamassu Next - Regtest Integration
|
|
#
|
|
# This overlay connects lamassu-next services to the comprehensive regtest
|
|
# environment at ~/dev/local/docker/regtest
|
|
#
|
|
# Usage:
|
|
# 1. Start regtest (minimal — only what LP needs):
|
|
# cd ~/dev/local/docker/regtest && docker compose up -d bitcoind lnd-1 lnd-4
|
|
#
|
|
# 2. Start lamassu services:
|
|
# cd docker && docker compose -f docker-compose.regtest.yml up -d
|
|
#
|
|
# 3. Bootstrap (funds LND, opens channels, creates LP app):
|
|
# cd docker && ./regtest-bootstrap.sh
|
|
#
|
|
# 4. Configure apps/machine/.env:
|
|
# VITE_RELAY_URL=ws://localhost:7777
|
|
# VITE_EXTENSION_API_URL=http://localhost:1777
|
|
#
|
|
# Phone wallet testing (LNURL callbacks need LAN IP):
|
|
# HOST_IP=192.168.1.100 docker compose -f docker-compose.regtest.yml up -d
|
|
#
|
|
# Services:
|
|
# - strfry: Private Nostr relay (port 7777)
|
|
# - lightning-pub: Nostr-native Lightning account system (port 1776)
|
|
# - Uses lnd-4 from regtest as backend
|
|
# - Withdraw extension on port 1777
|
|
# - miner: Auto-mines blocks to keep Lightning channels active
|
|
#
|
|
|
|
services:
|
|
# Private Nostr relay for ATM communication
|
|
strfry:
|
|
image: ghcr.io/hoytech/strfry:latest
|
|
container_name: lamassu-relay
|
|
ports:
|
|
- '7777:7777'
|
|
volumes:
|
|
- ./strfry.conf:/etc/strfry.conf:ro
|
|
- strfry-data:/app/strfry-db
|
|
ulimits:
|
|
nofile:
|
|
soft: 524288
|
|
hard: 524288
|
|
healthcheck:
|
|
# Check port 7777 (0x1E61) is listening via procfs — BusyBox nc lacks -z flag
|
|
test: ['CMD-SHELL', 'grep -q ":1E61 " /proc/net/tcp']
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
restart: unless-stopped
|
|
networks:
|
|
- regtest
|
|
|
|
# Lightning.Pub - Nostr-native Lightning account system
|
|
# Connects to lnd-4 from the regtest environment
|
|
# Use LIGHTNING_PUB_IMAGE env var to specify image (default: lightning-pub-withdraw)
|
|
lightning-pub:
|
|
image: ${LIGHTNING_PUB_IMAGE:-lightning-pub-withdraw:latest}
|
|
container_name: lamassu-lightning-pub
|
|
extra_hosts:
|
|
- 'host.docker.internal:host-gateway'
|
|
ports:
|
|
- '1776:1776'
|
|
- '1777:1777' # Withdraw extension HTTP API
|
|
volumes:
|
|
- lightning-pub-data:/root/lightning_pub
|
|
# Override Dockerfile's anonymous /app/data volume with named volume
|
|
- lightning-pub-appdata:/app/data
|
|
# Mount lnd-4 data from regtest for macaroons/certs
|
|
- ${REGTEST_DATA_DIR:-/home/padreug/dev/local/docker/regtest/data}/lnd-4:/root/.lnd:ro
|
|
environment:
|
|
- NETWORK=regtest
|
|
# lnd-4 is accessible via Docker network
|
|
- LND_ADDRESS=lnd-4:10009
|
|
- LND_CERT_PATH=/root/.lnd/tls.cert
|
|
- LND_MACAROON_PATH=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon
|
|
# Use strfry from this compose
|
|
- NOSTR_RELAYS=ws://strfry:7777
|
|
# Disable external liquidity provider for regtest
|
|
- DISABLE_LIQUIDITY_PROVIDER=true
|
|
# Admin token for HTTP API access (development only)
|
|
- ADMIN_TOKEN=lamassu-dev-admin-token
|
|
# Extension HTTP API URL (for LNURL callbacks from external wallets)
|
|
# Use HOST_IP env var for your machine's LAN IP (required for phone wallets)
|
|
- EXTENSION_SERVICE_URL=http://${HOST_IP:-localhost}:1777
|
|
depends_on:
|
|
strfry:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'curl -so /dev/null -w "%{http_code}" http://localhost:1776 | grep -q .']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 30
|
|
start_period: 30s
|
|
restart: unless-stopped
|
|
networks:
|
|
- regtest
|
|
|
|
# Auto-miner for regtest (mines 1 block every MINE_INTERVAL seconds)
|
|
# Keeps Lightning channels active during development
|
|
miner:
|
|
image: boltz/bitcoin-core:25.0
|
|
container_name: lamassu-miner
|
|
entrypoint: /bin/sh
|
|
command:
|
|
- -c
|
|
- |
|
|
echo "Auto-miner started (interval: $${MINE_INTERVAL}s)"
|
|
# Wait for bitcoind to be ready
|
|
while ! bitcoin-cli -regtest -rpcconnect=bitcoind getblockchaininfo > /dev/null 2>&1; do
|
|
echo "Waiting for bitcoind..."
|
|
sleep 5
|
|
done
|
|
# Ensure a wallet is loaded (-generate requires one)
|
|
bitcoin-cli -regtest -rpcconnect=bitcoind createwallet default 2>/dev/null \
|
|
|| bitcoin-cli -regtest -rpcconnect=bitcoind loadwallet default 2>/dev/null \
|
|
|| true
|
|
echo "bitcoind ready, starting mining loop"
|
|
while true; do
|
|
bitcoin-cli -regtest -rpcconnect=bitcoind -generate 1 > /dev/null 2>&1 && echo "Mined block $(bitcoin-cli -regtest -rpcconnect=bitcoind getblockcount)"
|
|
sleep $${MINE_INTERVAL}
|
|
done
|
|
environment:
|
|
- MINE_INTERVAL=${MINE_INTERVAL:-30}
|
|
volumes:
|
|
- bitcoin-data:/root/.bitcoin
|
|
restart: unless-stopped
|
|
networks:
|
|
- regtest
|
|
|
|
# PostgreSQL for optional server-side state
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: lamassu-postgres
|
|
ports:
|
|
- '5432:5432'
|
|
environment:
|
|
POSTGRES_DB: lamassu_dev
|
|
POSTGRES_USER: lamassu
|
|
POSTGRES_PASSWORD: lamassu_dev_password
|
|
volumes:
|
|
- postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ['CMD-SHELL', 'pg_isready -U lamassu -d lamassu_dev']
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
networks:
|
|
- regtest
|
|
|
|
volumes:
|
|
strfry-data:
|
|
lightning-pub-data:
|
|
lightning-pub-appdata:
|
|
postgres-data:
|
|
# Mount the bitcoin-data volume from the regtest environment
|
|
bitcoin-data:
|
|
external: true
|
|
name: regtest_bitcoin-data
|
|
|
|
networks:
|
|
regtest:
|
|
name: regtest_default
|
|
external: true
|