Production-ready Docker deployment for BTCPay Server, optimized for Coolify and self-hosted environments.
- BTCPay Server - Self-hosted Bitcoin payment processor
- Bitcoin Core - Full node with configurable pruning
- NBXplorer - Lightweight blockchain indexer
- PostgreSQL - Database backend with performance tuning
- Lightning Network - Optional CLN or LND integration
- Coolify Ready - Magic environment variables support
- All-in-One Image - Single container deployment option
- Multi-Network - Mainnet, testnet, signet, and regtest support
# Clone the repository
git clone https://github.com/host-uk/docker-server-blockchain.git
cd docker-server-blockchain
# Copy environment file
cp .env.example .env
# Edit .env with your configuration
# For development, you can use defaults
# Start with regtest network
make dev
# Or manually
docker compose -f docker-compose.yaml -f docker-compose.dev.yml up -dAccess BTCPay Server at http://localhost:49392
For simpler deployments or NAS-backed storage, use the AIO image:
docker run -d \
--name btcpay \
-p 80:49392 \
-v /mnt/nas/btcpay:/data \
-e BTCPAY_HOST=btcpay.example.com \
-e BTCPAY_PROTOCOL=https \
ghcr.io/host-uk/docker-server-blockchain-aio:latestSee docs/AIO.md for detailed AIO deployment guide.
- Create a new Docker Compose resource in Coolify
- Paste the contents of
docker-compose.coolify.yaml - Set your domain in the Coolify UI for the
btcpayserverservice - Configure optional environment variables:
BTCPAY_NETWORK- Network (mainnet/testnet/signet)BITCOIN_PRUNE- Pruning size (0 for full node)
- Deploy
Coolify automatically generates:
SERVICE_FQDN_BTCPAYSERVER- Your BTCPay domainSERVICE_PASSWORD_POSTGRES- Secure PostgreSQL passwordSERVICE_USER_BITCOIN/SERVICE_PASSWORD_BITCOIN- Bitcoin RPC credentials
┌─────────────────────────────────────────────────────────────┐
│ Coolify/Proxy │
│ (Traefik/Nginx/Caddy) │
└─────────────────────────────────────────────────────────────┘
│
▼ :49392
┌─────────────────────────────────────────────────────────────┐
│ BTCPay Server │
│ (Payment Processing UI) │
└─────────────────────────────────────────────────────────────┘
│
┌───────────────┴───────────────┐
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ NBXplorer │ │ PostgreSQL │
│ (Blockchain Index) │ │ (Database) │
└──────────────────────┘ └──────────────────────┘
│
▼
┌──────────────────────┐
│ Bitcoin Core │
│ (Full Node) │
└──────────────────────┘
| Variable | Description | Example |
|---|---|---|
BTCPAY_HOST |
Domain for BTCPay Server | btcpay.example.com |
POSTGRES_PASSWORD |
PostgreSQL password | your_secure_password |
| Variable | Default | Description |
|---|---|---|
BTCPAY_NETWORK |
mainnet |
Bitcoin network |
BTCPAY_VERSION |
2.0.6 |
BTCPay Server version |
NBXPLORER_VERSION |
2.5.16 |
NBXplorer version |
BITCOIN_VERSION |
28.0 |
Bitcoin Core version |
POSTGRES_VERSION |
16-alpine |
PostgreSQL version |
BITCOIN_RPC_USER |
rpc |
Bitcoin RPC username |
BITCOIN_RPC_PASSWORD |
rpcpassword |
Bitcoin RPC password |
| Variable | Default | Description |
|---|---|---|
BTCPAY_BTCLIGHTNING |
(empty) | Lightning connection string |
BITCOIN_PRUNE |
0 |
Prune size (0 = disabled) |
BITCOIN_DBCACHE |
512 |
Database cache in MB |
BITCOIN_MAXMEMPOOL |
500 |
Max mempool size in MB |
See .env.example for the complete list of configuration options.
| Network | Description | Use Case |
|---|---|---|
mainnet |
Bitcoin mainnet | Production |
testnet |
Bitcoin testnet | Testing with test coins |
signet |
Bitcoin signet | Stable testing |
regtest |
Regression test | Local development |
| Configuration | Estimated Size |
|---|---|
| Full node (mainnet) | ~700 GB+ |
| Pruned node (550 MB) | ~5 GB |
| Testnet | ~50 GB |
| Regtest | ~100 MB |
| File | Purpose |
|---|---|
docker-compose.yaml |
Base production configuration |
docker-compose.dev.yml |
Development overrides (regtest) |
docker-compose.coolify.yaml |
Coolify-optimized with magic variables |
docker-compose.lightning.yml |
Core Lightning (CLN) addon |
docker-compose.lnd.yml |
LND addon |
Dockerfile |
All-in-One (AIO) image |
make dev # Start development environment
make up # Start production environment
make down # Stop all services
make logs # View logs
make ps # Show running services
make bitcoin-cli # Access bitcoin-cli
make shell # Shell into BTCPay container
make clean # Remove all data volumesEnable Lightning with compose overlay files:
docker compose -f docker-compose.yaml -f docker-compose.lightning.yml up -ddocker compose -f docker-compose.yaml -f docker-compose.lnd.yml up -dBoth options include web UIs (RTL for CLN, ThunderHub for LND).
See docs/LIGHTNING.md for detailed Lightning setup guide.
All services include health checks:
- BTCPay Server: HTTP check on
:49392 - NBXplorer: HTTP check on
:32838/health - Bitcoin Core:
bitcoin-cli getblockchaininfo - PostgreSQL:
pg_isready
- Change default RPC credentials in production
- Use strong
POSTGRES_PASSWORD - Consider network segmentation for Bitcoin node
- Enable pruning if disk space is limited
- Regular backups of
postgres_datadirandbtcpay_datadir
Bitcoin Core initial sync can take days. Monitor progress:
make bitcoin-cli getblockchaininfoReset PostgreSQL if needed:
docker compose down
docker volume rm postgres_datadir
docker compose up -d# All services
make logs
# Specific service
docker compose logs -f btcpayserver
docker compose logs -f bitcoindSee CONTRIBUTING.md for contribution guidelines.
See SECURITY.md for security policy and reporting vulnerabilities.
This project is licensed under the EUPL-1.2 License. See LICENCE for details.