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
148
docker/docker-compose.regtest.yml
Normal file
148
docker/docker-compose.regtest.yml
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
# Lamassu Next - Regtest Integration
|
||||
#
|
||||
# This overlay connects lamassu-next services to the comprehensive regtest
|
||||
# environment at ~/dev/local/docker/regtest
|
||||
#
|
||||
# Usage:
|
||||
# 1. Start the regtest environment:
|
||||
# cd ~/dev/local/docker/regtest && ./start-regtest
|
||||
#
|
||||
# 2. Start lamassu services:
|
||||
# cd lamassu-next/docker && docker compose -f docker-compose.regtest.yml up -d
|
||||
#
|
||||
# 3. Configure apps/machine/.env:
|
||||
# VITE_RELAY_URL=ws://localhost:7777
|
||||
# VITE_EXTENSION_API_URL=http://localhost:1777
|
||||
#
|
||||
# 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:
|
||||
test: ['CMD', 'nc', '-z', 'localhost', '7777']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
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:-192.168.1.190}:1777
|
||||
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
|
||||
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:-120}
|
||||
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: lnbits_bitcoin-data
|
||||
|
||||
networks:
|
||||
regtest:
|
||||
# The regtest environment uses 'lnbits_default' as its Docker network
|
||||
# (named after the original LNbits regtest project)
|
||||
name: lnbits_default
|
||||
external: true
|
||||
Loading…
Add table
Add a link
Reference in a new issue