feat(docker): add dev.sh with auto-funding and ATM app setup
- Add dev.sh script for managing regtest development environment - Implement cmd_fund to fund ATM app owner via Lightning.Pub API - Add --fund flag to cmd_up for automatic funding on startup - Update setup_atm_app to write VITE_APP_ID to machine .env - Fix Electron IPC to pass appId and extensionApiUrl to renderer - Restructure repo from nested lamassu-next/ to root The dev.sh script now supports: - ./dev.sh up --fund # Start regtest and auto-fund ATM - ./dev.sh fund # Fund existing ATM app - ./dev.sh status # Show environment status - ./dev.sh reset # Clean restart Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
30a2eb2199
commit
c98f126ba7
180 changed files with 2695 additions and 9587 deletions
226
docker/docker-compose.dev.yml
Normal file
226
docker/docker-compose.dev.yml
Normal file
|
|
@ -0,0 +1,226 @@
|
|||
# Lamassu Next Development Infrastructure
|
||||
# Usage: docker compose -f docker-compose.dev.yml up -d
|
||||
|
||||
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:
|
||||
test: ['CMD', 'nc', '-z', 'localhost', '7777']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
|
||||
# Bitcoin Core in regtest mode
|
||||
bitcoind:
|
||||
image: lncm/bitcoind:v27.0
|
||||
container_name: lamassu-bitcoind
|
||||
volumes:
|
||||
- bitcoind-data:/data/.bitcoin
|
||||
environment:
|
||||
BITCOIN_NETWORK: regtest
|
||||
command:
|
||||
- -regtest
|
||||
- -server
|
||||
- -rpcuser=lamassu
|
||||
- -rpcpassword=lamassu
|
||||
- -rpcallowip=0.0.0.0/0
|
||||
- -rpcbind=0.0.0.0
|
||||
- -zmqpubrawblock=tcp://0.0.0.0:28332
|
||||
- -zmqpubrawtx=tcp://0.0.0.0:28333
|
||||
- -fallbackfee=0.00001
|
||||
- -txindex=1
|
||||
ports:
|
||||
- '18443:18443' # RPC
|
||||
- '28332:28332' # ZMQ blocks
|
||||
- '28333:28333' # ZMQ tx
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD',
|
||||
'bitcoin-cli',
|
||||
'-regtest',
|
||||
'-rpcuser=lamassu',
|
||||
'-rpcpassword=lamassu',
|
||||
'getblockchaininfo',
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
restart: unless-stopped
|
||||
|
||||
# LND Lightning node
|
||||
lnd:
|
||||
image: lightninglabs/lnd:v0.18.0-beta
|
||||
container_name: lamassu-lnd
|
||||
depends_on:
|
||||
bitcoind:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- lnd-data:/root/.lnd
|
||||
environment:
|
||||
- NETWORK=regtest
|
||||
command:
|
||||
- --bitcoin.active
|
||||
- --bitcoin.regtest
|
||||
- --bitcoin.node=bitcoind
|
||||
- --bitcoind.rpchost=bitcoind:18443
|
||||
- --bitcoind.rpcuser=lamassu
|
||||
- --bitcoind.rpcpass=lamassu
|
||||
- --bitcoind.zmqpubrawblock=tcp://bitcoind:28332
|
||||
- --bitcoind.zmqpubrawtx=tcp://bitcoind:28333
|
||||
- --rpclisten=0.0.0.0:10009
|
||||
- --restlisten=0.0.0.0:8080
|
||||
- --tlsextradomain=lnd
|
||||
- --tlsextraip=0.0.0.0
|
||||
- --noseedbackup
|
||||
- --accept-keysend
|
||||
- --accept-amp
|
||||
ports:
|
||||
- '10009:10009' # gRPC
|
||||
- '8080:8080' # REST
|
||||
- '9735:9735' # P2P
|
||||
healthcheck:
|
||||
test: ['CMD', 'lncli', '--network=regtest', 'getinfo']
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
# Lightning.Pub - Nostr-native Lightning account system
|
||||
# Note: Lightning.Pub connects to LND for actual Lightning operations
|
||||
# Using patched image with Kind 0 profile publishing support
|
||||
lightning-pub:
|
||||
image: lightning-pub-patched:latest
|
||||
container_name: lamassu-lightning-pub
|
||||
depends_on:
|
||||
lnd:
|
||||
condition: service_healthy
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway' # Enable host.docker.internal on Linux
|
||||
ports:
|
||||
- '1776:1776'
|
||||
volumes:
|
||||
- lightning-pub-data:/root/lightning_pub
|
||||
- lnd-data:/root/.lnd:ro # Read-only access to LND data for macaroons/certs
|
||||
environment:
|
||||
- NETWORK=regtest
|
||||
- LND_ADDRESS=lnd:10009
|
||||
- LND_CERT_PATH=/root/.lnd/tls.cert
|
||||
- LND_MACAROON_PATH=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon
|
||||
# Relay URLs (space-separated). Docker-internal relay FIRST for publishing,
|
||||
# then backup. Mock ATM rewrites ndebit relay for browser access.
|
||||
- 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
|
||||
restart: unless-stopped
|
||||
|
||||
# Second LND node (Alice) for payment testing
|
||||
# This node can pay invoices to Lightning.Pub's LND
|
||||
lnd-alice:
|
||||
image: lightninglabs/lnd:v0.18.0-beta
|
||||
container_name: lamassu-lnd-alice
|
||||
depends_on:
|
||||
bitcoind:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- lnd-alice-data:/root/.lnd
|
||||
environment:
|
||||
- NETWORK=regtest
|
||||
command:
|
||||
- --bitcoin.active
|
||||
- --bitcoin.regtest
|
||||
- --bitcoin.node=bitcoind
|
||||
- --bitcoind.rpchost=bitcoind:18443
|
||||
- --bitcoind.rpcuser=lamassu
|
||||
- --bitcoind.rpcpass=lamassu
|
||||
- --bitcoind.zmqpubrawblock=tcp://bitcoind:28332
|
||||
- --bitcoind.zmqpubrawtx=tcp://bitcoind:28333
|
||||
- --rpclisten=0.0.0.0:10009
|
||||
- --restlisten=0.0.0.0:8080
|
||||
- --tlsextradomain=lnd-alice
|
||||
- --tlsextraip=0.0.0.0
|
||||
- --noseedbackup
|
||||
- --accept-keysend
|
||||
- --accept-amp
|
||||
- --alias=alice
|
||||
ports:
|
||||
- '10010:10009' # gRPC (different host port)
|
||||
- '8081:8080' # REST (different host port)
|
||||
- '9736:9735' # P2P (different host port)
|
||||
healthcheck:
|
||||
test: ['CMD', 'lncli', '--network=regtest', 'getinfo']
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 30
|
||||
start_period: 30s
|
||||
restart: unless-stopped
|
||||
|
||||
# Automatic block miner for regtest (keeps LND synced)
|
||||
# Mines 1 block every 30 seconds
|
||||
miner:
|
||||
image: alpine:latest
|
||||
container_name: lamassu-miner
|
||||
depends_on:
|
||||
bitcoind:
|
||||
condition: service_healthy
|
||||
entrypoint: /bin/sh
|
||||
command:
|
||||
- -c
|
||||
- |
|
||||
apk add --no-cache curl jq
|
||||
echo "Starting auto-miner (1 block every 30 seconds)..."
|
||||
while true; do
|
||||
# Create wallet if not exists
|
||||
curl -s --user lamassu:lamassu --data-binary '{"jsonrpc":"1.0","method":"createwallet","params":["miner"]}' http://bitcoind:18443/ > /dev/null 2>&1
|
||||
# Mine a block
|
||||
ADDR=$$(curl -s --user lamassu:lamassu --data-binary '{"jsonrpc":"1.0","method":"getnewaddress","params":[]}' http://bitcoind:18443/ | jq -r '.result // empty')
|
||||
if [ -n "$$ADDR" ]; then
|
||||
curl -s --user lamassu:lamassu --data-binary "{\"jsonrpc\":\"1.0\",\"method\":\"generatetoaddress\",\"params\":[1,\"$$ADDR\"]}" http://bitcoind:18443/ > /dev/null
|
||||
fi
|
||||
sleep 30
|
||||
done
|
||||
restart: unless-stopped
|
||||
profiles:
|
||||
- mining # Only starts with: docker compose --profile mining up -d
|
||||
|
||||
# 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
|
||||
|
||||
volumes:
|
||||
strfry-data:
|
||||
bitcoind-data:
|
||||
lnd-data:
|
||||
lnd-alice-data:
|
||||
lightning-pub-data:
|
||||
postgres-data:
|
||||
Loading…
Add table
Add a link
Reference in a new issue