Generated docker-compose
When you run btcpay-setup.sh
, your environment variables are used by build.sh
(or build.ps1) to generate a docker-compose adapted for your needs. For the full list of options, see: Environment variables
By default, the generated file is Generated/docker-compose.generated.yml
, constructed from the relevant Docker fragments
for your setup.
Available BTCPAYGEN_ADDITIONAL_FRAGMENTS
currently are:
- opt-save-storage will keep around 1 year of blocks (prune BTC for 100 GB)
- opt-save-storage-s will keep around 6 months of blocks (prune BTC for 50 GB)
- opt-save-storage-xs will keep around 3 months of blocks (prune BTC for 25 GB)
- opt-save-storage-xxs will keep around 2 weeks of blocks (prune BTC for 5 GB) (lightning not supported)
- opt-lnd-autopilot will activate auto pilot on LND. (5 channels, 60% of allocation)
- opt-lnd-keysend will activate keysend on LND.
- opt-lnd-wtclient will activate the watchtower client on LND.
LND_WTCLIENT_SWEEP_FEE
can be used to override the default 10 sat/byte justice transaction fee - opt-save-memory will decrease the default dbcache at the expense of longer synchronization time. (Useful if your machine is less than 2GB)
- opt-more-memory will increase the default dbcache to make synchronization faster (Useful if your machine is has around 4GB)
- opt-add-btcqbo will allow you to create an invoice on Quickbooks which include a way for your customer to pay on BTCPay Server (More information on this github repository , this add-on is maintained by JeffVandrewJr , see more on this video)
- opt-add-librepatron, for a self-hosted Patreon alternative backed by BTCPay (More information on this github repository , this add-on is maintained by JeffVandrewJr.
- opt-add-woocommerce, for a self-hosted woocommerce with BTCPay Server plugin pre installed.
- opt-add-tor, for exposing BTCPayServer, Woocommerce, your lightning nodes as hidden services and accept onion peers for your full node. Warning: This options is for working around NAT and firewall problems as well as to help protect your customer's privacy. This will not protect your privacy against a targeted attack against you.
- opt-add-btctransmuter, for a self-hosted IFTTT style service for crypto services such as fiat settlement. (More information on this github repository
- opt-txindex, to enable txindex=1 in bitcoin.conf if you require txindexing for Bisq, DOJO, etc.
- opt-expose-unsafe, to unsafely expose bitcoind P2P port 8333 if you require P2P for Bisq, DOJO, Esplora, etc. WARNING: ONLY USE ON TRUSTED LAN OR WITH FIREWALL RULES WHITELISTING SPECIFIC HOSTS
- opt-add-tor-relay, for a non-exit tor relay. Make sure to have ports 9001 and 9030 accessible externally. Please read the legal implications of running a tor relay and what resources are used to operate the relay.
- opt-add-electrumx, to integrate a full ElectrumX server (from official source) with BTCPay, using the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet. You can also open port 50002 up to the internet on your router etc, to be part of the ElectrumX network, helping other Electrum wallet users to get connected. The bitcoin option
-txindex
is mandatory for ElectrumX, and this fragment will enable it on your BTCPay server automatically - NO need to use the fragment opt-txindex.yml. - opt-add-electrum-ps, to integrate Electrum Personal Server (EPS) with BTCPay (EPS is a single-user alternative to the ElectrumX Server option above). EPS will also use the BTCPay server's full bitcoin node for complete privacy when using your own Electrum wallet, for your own personal use (i.e. other users cannot use your server to verify transactions). Also, the bitcoin option
-txindex
is NOT mandatory for EPS, and it will run on a pruned node (unlike ElectrumX). You will need to add your XPUB/YPUB/ZPUB as environment variableEPS_XPUB
before enabling EPS for the first time (see above section on environment variables, and see full documentation for details). - opt-add-electrum-bwt, to integrate the Bitcoin Wallet Tracker Electrum server, which uses a personal wallet index model similar to that of EPS. You will need to set
BWT_XPUB
with your XPUB/YPUB/ZPUB (see environment variables section). The server will only be available locally and through an onion service. - opt-add-configurator, to integrate the BTCPay Server Configurator to manage your BTCPay deployment through a UI, and to allow new deployments elsewhere easily. opt-add-pihole (See the documentation)
- opt-add-bluewallet-lndhub for Bluewallet LNDHub - Use non-custodial LND Lightning directly from your Bluewallet, and freely let others open accounts on your node. Fragment maintained by maltokyo.
- opt-add-ndlc (See the documentation)
- opt-add-lightning-terminal for Lightning Terminal/LiT . Maintained by dennisreimann.
- opt-add-sphinxrelay for Sphinx Relay . Maintained by dennisreimann.
- opt-add-tallycoin-connect for Tallycoin Connect . Maintained by dennisreimann.
- opt-add-thunderhub for a LND Lightning Node Manager in your Browser. Maintained by apotdevin.
- opt-add-teos for The Eye Of Satoshi, a BOLT13 Lightning Watchtower. Use port 9814 on your server or Tor to connect.
- opt-add-chatwoot for open source chat support system. (See the documentation)
- opt-add-zammad for Zammad, a web based open source helpdesk/customer support system with many features to manage customer communication via several channels like telephone, facebook, twitter, chat and e-mails
- opt-monero-expose to expose monero node's RPC port at 127.0.0.1:18081 to connect your own wallet. Use f.e. ssh port forwarding to forward to your own computer.
- opt-add-fireflyiii (See the documentation)
- opt-add-joinmarket (See the documentation)
- opt-add-helipad for Podcastindex.org Helipad. Requires LND.
- opt-add-nostr-relay for Nostr Relay .
You can also create your own custom fragments.
If you want to add an option to BTCPAYGEN_ADDITIONAL_FRAGMENTS
and re-configure your install:
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-lnd-autopilot"
. btcpay-setup.sh -i
For example, if you want btc
and ltc
support with nginx
and clightning
inside Generated/docker-compose.custom.yml
:
Note: The first run might take a while, but following runs are instantaneous.
On Windows (run in powershell:
Invoke-Command {
$BTCPAYGEN_CRYPTO1="btc"
$BTCPAYGEN_CRYPTO2="ltc"
$BTCPAYGEN_REVERSEPROXY="nginx"
$BTCPAYGEN_LIGHTNING="clightning"
$BTCPAYGEN_SUBNAME="custom"
. .\build.ps1
}
On Linux:
BTCPAYGEN_CRYPTO1="btc" \
BTCPAYGEN_CRYPTO2="ltc" \
BTCPAYGEN_REVERSEPROXY="nginx" \
BTCPAYGEN_LIGHTNING="clightning" \
BTCPAYGEN_SUBNAME="custom" \
./build.sh
Next, you will need to configure the runtime environment variables for Generated/docker-compose.custom.yml
:
- If you are using NGinx, read this
- If you are not using NGinx, read this instead
Again, what does btcpay-setup.sh do?
btcpay-setup.sh
is a utility which does the following:
- Makes sure docker and docker-compose are installed on your system
- Generates a docker-compose via
./build.sh
- Sets up an Environment File to configure your docker-compose
- Sets up environment variables so the tools described in Tooling can work
- Adds symlinks of those tools into
/usr/bin
- Makes sure BTCPay restarts on reboot via upstart or systemd
- Starts BTCPay via docker-compose
Overview of files generated by btcpay-setup.sh
/etc/profile.d/btcpay-env.sh
ensures that your environment variables are correctly setup when you login, so you can use the tools:
export BTCPAYGEN_OLD_PREGEN="false"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_CRYPTO2=""
export BTCPAYGEN_CRYPTO3=""
export BTCPAYGEN_CRYPTO4=""
export BTCPAYGEN_CRYPTO5=""
export BTCPAYGEN_CRYPTO6=""
export BTCPAYGEN_CRYPTO7=""
export BTCPAYGEN_CRYPTO8=""
export BTCPAYGEN_CRYPTO9=""
export BTCPAYGEN_LIGHTNING="clightning"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS=""
export BTCPAY_DOCKER_COMPOSE="/var/lib/waagent/custom-script/download/0/btcpayserver-docker/Production/docker-compose.generated.yml"
export BTCPAY_BASE_DIRECTORY="/var/lib/waagent/custom-script/download/0"
export BTCPAY_ENV_FILE="/var/lib/waagent/custom-script/download/0/.env"
export BTCPAY_HOST_SSHKEYFILE="/root/.ssh/id_rsa_btcpay"
if cat $BTCPAY_ENV_FILE &> /dev/null; then
export $(grep -v '^#' "$BTCPAY_ENV_FILE" | xargs)
fi
/etc/systemd/system/btcpayserver.service
ensures that you can control btcpay via systemctl
, and that BTCPayServer starts on reboot:
[Unit]
Description=BTCPayServer service
After=docker.service network-online.target
Requires=docker.service network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" && . helpers.sh && btcpay_up'
ExecStop=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" && . helpers.sh && btcpay_down'
ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker" && . helpers.sh && btcpay_restart'
[Install]
WantedBy=multi-user.target
.env
($BTCPAY_ENV_FILE
) contains environment variables passed to the containers managed by your docker-compose:
BTCPAY_HOST=btcpay.EXAMPLE.com
ACME_CA_URI=production
NBITCOIN_NETWORK=mainnet
LETSENCRYPT_EMAIL=me@EXAMPLE.com
BTCPAY_SSHTRUSTEDFINGERPRINTS=SHA256:eSCD7NtQ/Q6IBl2iRB9caAQ3lDZd8s8iUL6SdeNnhpA
BTCPAY_SSHKEYFILE=/datadir/id_rsa