• Stars
    star
    575
  • Rank 77,622 (Top 2 %)
  • Language
    Shell
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker resources for hosting BTCPayServer easily

CircleCI

Start accepting Bitcoin today with BTCPay Server! This guide will walk you through the installation.

Introduction

While our instructions cover how to install BTCPayServer in one click on Azure or Lunanode, BTCPay Server is not limited to those options.

You will find below information about how you can install BTCPay Server easily in any environment having docker available.

Architecture

Architecture

As you can see, BTCPay depends on several pieces of infrastructure, mainly:

  • A lightweight block explorer (NBXplorer),
  • A database (PostgreSQL or SQLite),
  • A full node (eg. Bitcoin Core)

There can be more dependencies if you support more than just standard Bitcoin transactions, including:

Note: The setup process can be time consuming, but is heavily automated to make it a fun and easy experience.

Take a look at how BTCPay works in a video below.

Here is a presentation of the global architecture at Advancing Bitcoin conference.

BTCPay - Architecture overview

Full installation (for technical users)

You can also install BTCPay Server on your own machine or VPS instance.

The officially supported setup is driven by Docker (and Docker-Compose).

First, make sure you have a domain name pointing to your host A record, with ports 443 and 80 externally accessible. For Lightning Network, port 9735 is required (9736 if you use Litecoin Lightning). Otherwise, you will have to set a domain manually by running changedomain.sh.

Let's assume your domain is btcpay.EXAMPLE.com.

The setup below assumes you want to support Bitcoin, c-lightning, HTTPS automatically configured by Nginx. It also enables node pruning, which you can modify or ignore if you have enough disk space for a full node. Finally, your domain is btcpay.EXAMPLE.com should reflect your actual domain name.

Environment variables can be tailored to your needs. Some variables require additional storage space.

# Login as root
sudo su -

# Create a folder for BTCPay
mkdir BTCPayServer
cd BTCPayServer

# Clone this repository
git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker

# Run btcpay-setup.sh with the right parameters
export BTCPAY_HOST="btcpay.EXAMPLE.com"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-s"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="clightning"
export BTCPAY_ENABLE_SSH=true
. ./btcpay-setup.sh -i

exit

btcpay-setup.sh will then:

  • Install Docker
  • Install Docker-Compose
  • Make sure BTCPay starts at reboot via upstart or systemd
  • Setup environment variables to use BTCPay utilities
  • Add BTCPay utilities in /usr/bin
  • Start BTCPay Server

Video below guides you step by step on how to set up BTCPay Server on a VPS with Docker.

Check out this video if you're interested in learning more about setting up BTCPay with Docker Compose.

Docker automated build

Environment variables

btcpay-setup.sh will use the following environment variables:

  • BTCPAY_HOST: The hostname of your website (eg. btcpay.example.com)
  • BTCPAY_ADDITIONAL_HOSTS: Optional, specify additional domains to your BTCPayServer with https support if enabled. (eg. example2.com,example3.com)
  • REVERSEPROXY_HTTP_PORT: The public port the reverse proxy binds to for HTTP traffic (default: 80)
  • REVERSEPROXY_HTTPS_PORT: The public port the reverse proxy binds to for HTTPS traffic (default: 443)
  • REVERSEPROXY_DEFAULT_HOST: Optional, if using a reverse proxy nginx, specify which website should be presented if the server is accessed by its IP or by an unrecognized domain name.
  • NOREVERSEPROXY_HTTP_PORT: Optional, if not using a reverse proxy, specify which port should be opened for HTTP traffic. (default: 80)
  • NBITCOIN_NETWORK: The type of network to use (eg. mainnet, testnet, or regtest. Default: mainnet)
  • LIGHTNING_ALIAS: An alias for your lightning network node, if used
  • BTCPAYGEN_CRYPTO1: First supported crypto currency (eg. btc, ltc. Default: btc)
  • BTCPAYGEN_CRYPTO2: Second supported crypto currency (eg. btc, ltc. Default: (empty))
  • BTCPAYGEN_CRYPTON: N'th supported crypto currency where N is 9 at maximum. (eg. btc, ltc. Default: (empty))
  • BTCPAYGEN_REVERSEPROXY: Specify reverse proxy to use; NGinx has HTTPS support. (eg. nginx, traefik, (empty). Default: nginx)
  • BTCPAYGEN_LIGHTNING: Lightning network implementation to use (eg. clightning, lnd, Default: (empty))
  • BTCPAYGEN_SUBNAME: The subname of the generated docker-compose file, where the full name is Generated/docker-compose.SUBNAME.yml (Default: generated)
  • BTCPAYGEN_ADDITIONAL_FRAGMENTS: Semicolon-separated list of additional fragments you want to use (eg. opt-save-storage)
  • LETSENCRYPT_EMAIL: An email will be sent to this address if certificate expires and fails to renew automatically (eg. [email protected])
  • ACME_CA_URI: The API endpoint to ask for HTTPS certificate (Default: production)
  • BTCPAY_ENABLE_SSH: Optional, gives BTCPay Server SSH access to the host by allowing it to edit authorized_keys of the host, it can be used for managing the authorized_keys or updating BTCPay Server directly through the website. (Default: false)
  • BTCPAYGEN_DOCKER_IMAGE: Optional, Specify which generator image to use if you have customized the C# generator. Set to btcpayserver/docker-compose-generator:local to build the generator locally at runtime.
  • BTCPAY_IMAGE: Optional, Specify which btcpayserver image to use if you have a customized btcpayserver.
  • BTCPAYGEN_EXCLUDE_FRAGMENTS: Semicolon-separated list of fragments you want to forcefully exclude (eg. litecoin-clightning)
  • TOR_RELAY_NICKNAME: If tor relay is activated with opt-add-tor-relay, the relay nickname
  • TOR_RELAY_EMAIL: If tor relay is activated with opt-add-tor-relay, the email for Tor to contact you regarding your relay

Additionally, there are specific environment variables for some addons:

  • LIBREPATRON_HOST: If libre patron is activated with opt-add-librepatron, the hostname of your libre patron website (eg. librepatron.example.com)
  • ZAMMAD_HOST: If zammad is activated with opt-add-zammad, the hostname of your zammad website (eg. zammad.example.com)
  • WOOCOMMERCE_HOST: If woocommerce is activated with opt-add-woocommerce, the hostname of your woocommerce website (eg. store.example.com)
  • EPS_XPUB: If Electrum Personal Server (EPS) is activated with opt-add-electrum-ps, you must set the Extended Public Key (XPUB, YPUB or ZPUB) of the wallet you want to use, before first run of the EPS server. If you accidently start EPS without this, it will not work properly as the model of EPS is to monitor only specified wallets.
  • If Bitcoin Wallet Tracker is activated with opt-add-bwt, you can use BWT_XPUB/BWT_XPUB_* (to set your XPUB/YPUB/ZPUB), BWT_DESCRIPTOR/BWT_DESCRIPTOR_* (for script descriptors), BWT_RESCAN_SINCE (set to the wallet creation date in YYYY-MM-DD to speed up the rescan), BWT_BITCOIND_WALLET and BWT_GAP_LIMIT.
  • LND_WTCLIENT_SWEEP_FEE: If LND watchtower is activated with opt-lnd-wtclient, you can use LND_WTCLIENT_SWEEP_FEE to change the sweep fee used in constructing the justice transaction (default is 10 sat/byte)
  • FIREFLY_HOST: If fireflyiii is activated with opt-add-fireflyiii, the hostname of your fireflyiii website (eg. firefly.example.com)
  • CLOUDFLARE_TUNNEL_TOKEN: Used to expose your instance to clearnet with a Cloudflare Argo Tunnel (if cloudflare tunnel is activated with opt-add-cloudflared, for setup instructions see documentation)

Tooling

A wide variety of useful scripts are available once BTCPay is installed:

  • bitcoin-cli.sh: Access your Bitcoin node instance (for RPC)
  • bitcoin-lightning-cli.sh: Access your C-Lightning node instance (for RPC)
  • changedomain.sh: Change the domain of your BTCPayServer (remember to disable 2FA/U2F first, as you risk being unable to log in to your account)
  • btcpay-update.sh: Update BTCPayServer to the latest version
  • btcpay-up.sh: Run docker-compose up
  • btcpay-down.sh: Run docker-compose down
  • btcpay-setup.sh: Change the settings of your server
  • btcpay-clean.sh: Purge any unused docker images
  • . ./btcpay-setup.sh: Information about additional parameters
  • . ./btcpay-setup.sh -i: Set up your BTCPayServer
  • btcpay-restart.sh: Restart your BTCPayServer

Under the hood

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:

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:

Again, what does btcpay-setup.sh do?

btcpay-setup.sh is a utility which does the following:

  1. Makes sure docker and docker-compose are installed on your system
  2. Generates a docker-compose via ./build.sh
  3. Sets up an Environment File to configure your docker-compose
  4. Sets up environment variables so the tools described in Tooling can work
  5. Adds symlinks of those tools into /usr/bin
  6. Makes sure BTCPay restarts on reboot via upstart or systemd
  7. 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[email protected]
BTCPAY_SSHTRUSTEDFINGERPRINTS=SHA256:eSCD7NtQ/Q6IBl2iRB9caAQ3lDZd8s8iUL6SdeNnhpA
BTCPAY_SSHKEYFILE=/datadir/id_rsa

How can I add an altcoin to BTCPayServer?

  1. Add support for your crypto to NBitcoin, NBxplorer, and BTCPayServer. (Use examples from other coins)
  2. Create your own docker image (Example for BTC)
  3. Create a docker-compose fragment (Example for BTC)
  4. Add your CryptoDefinition (Example for BTC)

build.sh is using a pre-built image of the docker-compose generator on docker hub. If you modify the code source of docker-compose generator (for example, the CryptoDefinition Example for BTC), you need to configure build.sh to use your own image by setting the environment variable BTCPAYGEN_DOCKER_IMAGE to btcpayserver/docker-compose-generator:local.

cd docker-compose-generator
BTCPAYGEN_DOCKER_IMAGE="btcpayserver/docker-compose-generator:local"

Or on powershell:

cd docker-compose-generator
$BTCPAYGEN_DOCKER_IMAGE="btcpayserver/docker-compose-generator:local"

Then run ./build.sh or . .\build.ps1. This will generate your docker-compose in the Generated folder, which you can then run and test.

Note that BTCPayServer developers will not spend excessive time testing your image, so make sure it works.

Support

Image Version x64 arm32v7 arm64v8 links
btcpayserver/docker-compose-generator latest βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/docker-compose 1.28.6 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/lightning v23.05 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
saubyk/c-lightning-rest 0.10.5 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
shahanafarooqui/rtl 0.14.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/lnd v0.16.4-beta βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/bitcoin 25.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/btcpayserver 1.10.3$<BTCPAY_BUILD_CONFIGURATION>? βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/monero 0.18.2.2 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
nicolasdorier/nbxplorer 2.3.64 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/letsencrypt-nginx-proxy-companion 1.12.2 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
nginx 1.23.3 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/docker-gen 0.7.8 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/btctransmuter 0.0.59 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/cloudflared 2022.6.3 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/btcpayserver-configurator 0.0.21 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/eps 0.2.2 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/joinmarket 0.9.5 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
nicolasdorier/ndlc-cli 1.0.1 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
pihole/pihole v5.7 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/tor 0.4.7.10 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/woocommerce 3.1.0 βœ”οΈ ️❌ βœ”οΈ Github - DockerHub
btcpayserver/postgres 13.10 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
kamigawabul/btglnd latest βœ”οΈ ️❌ ️❌ Github - DockerHub
kamigawabul/docker-bitcoingold 0.15.2 βœ”οΈ ️❌ ️❌ Github - DockerHub
acinq/eclair release-0.7.0 βœ”οΈ ️❌ ️❌ Github - DockerHub
chekaz/docker-bitcoinplus 2.7.0 βœ”οΈ ️❌ ️❌ Github - DockerHub
dalijolijo/docker-bitcore 0.90.9.10 βœ”οΈ ️❌ ️❌ Github - DockerHub
btcpayserver/dash 19.2.0 βœ”οΈ ️❌ βœ”οΈ Github - DockerHub
btcpayserver/dogecoin 1.14.6 βœ”οΈ ️❌ ️❌ Github - DockerHub
chekaz/docker-feathercoin 0.16.3 βœ”οΈ ️❌ ️❌ Github - DockerHub
groestlcoin/lightning v23.05 βœ”οΈ ️❌ ️❌ Github - DockerHub
groestlcoin/groestlcoin-lightning-charge version-0.4.22 βœ”οΈ ️❌ ️❌ Github - DockerHub
groestlcoin/groestlcoin-spark version-0.2.16 βœ”οΈ ️❌ ️❌ Github - DockerHub
groestlcoin/eclair v0.6.0 βœ”οΈ ️❌ ️❌ Github - DockerHub
groestlcoin/lnd v0.10.0-grs βœ”οΈ ️❌ ️❌ Github - DockerHub
btcpayserver/groestlcoin 25.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/elements 22.1.1 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
btcpayserver/litecoin 0.21.2.1-2 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
wakiyamap/docker-monacoin 0.20.2 βœ”οΈ ️❌ ️❌ Github - DockerHub
redis 6.2.2-buster βœ”οΈ ️❌ ️❌ Github - DockerHub
bluewalletorganization/lndhub v1.4.1 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
jvandrew/btcqbo 0.3.36 βœ”οΈ ️❌ ️❌ Github - DockerHub
shesek/bwt 0.2.2-electrum βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
chatwoot/chatwoot v1.7.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
lukechilds/electrumx latest βœ”οΈ ️❌ ️❌ Github - DockerHub
fireflyiii/core latest βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
podcastindexorg/podcasting20-helipad v0.1.10 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
jvandrew/librepatron 0.7.39 βœ”οΈ ️❌ ️❌ Github - DockerHub
jvandrew/isso atron.22 βœ”οΈ ️❌ ️❌ Github - DockerHub
lightninglabs/lightning-terminal v0.9.2-alpha-path-prefix βœ”οΈ ️❌ βœ”οΈ Github - DockerHub
mempool/frontend v2.5.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
mempool/backend v2.5.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
mariadb 10.11 βœ”οΈ ️❌ ️❌ Github - DockerHub
kukks/nnostr-relay v0.0.16 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
sphinxlightning/sphinx-relay v2.2.9 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
djbooth007/tallycoin_connect v1.8.0 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
talaia/python-teos latest βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
apotdevin/thunderhub base-v0.13.18 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
lncapital/torq 0.20.3 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
timescale/timescaledb latest-pg14 βœ”οΈ βœ”οΈ βœ”οΈ Github - DockerHub
zammad/zammad-docker-compose zammad-postgresql-3.4.0-4 βœ”οΈ ️❌ ️❌ Github - DockerHub
memcached 1.5.22-alpine βœ”οΈ ️❌ ️❌ Github - DockerHub
traefik v2.6 βœ”οΈ ️❌ ️❌ Github - DockerHub
chekaz/docker-trezarcoin 0.13.0 βœ”οΈ ️❌ ️❌ Github - DockerHub
romanornr/docker-viacoin 0.15.2 βœ”οΈ ️❌ ️❌ Github - DockerHub

FAQ

How can I modify my environment?

As root, run . btcpay-setup.sh; this will show you the environment variable it is expecting. For example, if you support btc and ltc already, and want to add btg:

export BTCPAYGEN_CRYPTO3='btg'
. btcpay-setup.sh -i

I deployed before btcpay-setup.sh existed (before May 17, 2018), can I migrate to this new system?

Yes, run the following commands to update:

sudo su -

cd $DOWNLOAD_ROOT/btcpayserver-docker
git checkout master
git pull
git checkout 9acb5d8067cb5c46f59858137feb699b41ac9f19
btcpay-update.sh
. ./btcpay-setup.sh -i
git checkout master
btcpay-update.sh

exit

I'm getting an error on Windows: Cannot create container for service docker: Mount denied?

If you see this error:

Cannot create container for service docker: b'Mount denied:\nThe source path "\\\\var\\\\run\\\\docker.sock:/var/run/docker.sock"\nis not a valid Windows path'.

Run this in powershell:

$Env:COMPOSE_CONVERT_WINDOWS_PATHS=1

Then, run docker-compose -f EXAMPLE.yml up.

This bug comes from Docker for Windows and is tracked on Github.

How I can prune my node(s)?

This will prune your Bitcoin full node to a maximum of 100GB (of blocks):

export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage"
. ./btcpay-setup.sh -i

Other options are documented here.

How can I customize the generated docker-compose file?

In some instances, you might want to customize your environment in more detail. While you could modify Generated/docker-compose.generated.yml manually, your changes would be overwritten the next time you run btcpay-update.sh.

Luckily, you can leverage BTCPAYGEN_ADDITIONAL_FRAGMENTS for this!

Let's enable pruning to 60 GB, for example:

First, copy opt-save-storage into the the docker fragment folder as opt-save-storage.custom.yml. Important: the file must end with .custom.yml, or there will be git conflicts whenever you run btcpay-update.sh.

Modify the new opt-save-storage.custom.yml file to your taste:

@@ -14,8 +14,7 @@ version: "3"
 services:
   bitcoind:
     environment:
-       BITCOIN_EXTRA_ARGS: prune=100000
+       BITCOIN_EXTRA_ARGS: prune=60000

Then set it up:

export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-save-storage.custom"
. ./btcpay-setup.sh -i

Can I run BTCPay Server on ports other than 80 and 443?

You can change the ports for HTTP and HTTPS by setting the environment variables REVERSEPROXY_HTTP_PORT and REVERSEPROXY_HTTPS_PORT. This is handy when ports 80 and 443 are already in use on your host, or you want to offload SSL termination with an existing web proxy.

When you set REVERSEPROXY_HTTP_PORT to another value than 80, the built-in Let's Encrypt certificate will not work, as Let's Encrypt will try to validate your SSL certificate request by connecting from the internet to your domain on port 80. This validation request should be able to reach BTCPay Server in order to receive the certificate.

If you need to run on a different port, it's best to terminate SSL using another web proxy and forward your traffic.

Can I offload HTTPS termination?

Yes. Please see the documentation.

How can I back up my BTCPay Server?

See the Backup & Restore guide in our documentation.

For backwards compatibility: Click here for the description of the old backup.sh process

:::warning Please consider switching to the new Backup & Restore process, because the backup.sh will not be maintained anymore. ::: We provide a backup script that dumps the database and saves the important files:

cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
./backup.sh

This will save the backup locally as /var/lib/docker/volumes/backup_datadir/_data/backup.tar.gz. These are the options to customize the backup name and location:

  • BACKUP_TIMESTAMP=true saves the backup with datetime as part of the file name, so that backups do not get overwritten.
  • BACKUP_PROVIDER=SCP saves the backup remotely, requires additional SCP_TARGET environment variable (see below).
  • BACKUP_PROVIDER=Dropbox saves the backup to Dropbox, requires additional DROPBOX_TOKEN environment variable (see below).
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"

# Backup with custom file name and timestamp:
BACKUP_TIMESTAMP=true ./backup.sh

# Backup via SCP:
BACKUP_PROVIDER=SCP SCP_TARGET=myhost:backups/btcpay ./backup.sh

# Backup to Dropbox:
BACKUP_PROVIDER=Dropbox DROPBOX_TOKEN=myDropboxToken ./backup.sh

You can also choose to only dump the database. This option does not need to stop and restart the docker-containers:

cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
./backup.sh --only-db

How can I connect to the database?

On the server you can open a database session by connecting via psql as the postgres user:

docker exec -ti $(docker ps -a -q -f "name=postgres_1") psql -U postgres

Then, inside psql you can select a database and interact with the tables:

# list databases
\l

# connect to database
\c btcpayservermainnet

# list tables
\dt

# list users
SELECT "Id", "Email" FROM "AspNetUsers";

# end session
\q

The main BTCPay Server database tables are part of the public schema. Plugins have their own schema, named after the plugin.

By default, only the tables of the public schema are shown. If you want to also see and select the plugin tables, you need to extend the search path:

# list plugin schemas
SELECT * FROM pg_catalog.pg_namespace WHERE nspname LIKE 'BTCPayServer.%';

# extend search path
SET search_path TO "BTCPayServer.Plugins.MyPlugin", public;

# table list now also shows the MyPlugin tables
\dt

How do I upgrade my BTCPay Server docker?

Run the script ./btcpay-update.sh and patiently wait for your server to be upgraded.

More Repositories

1

btcpayserver

Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
C#
6,371
star
2

btcpayserver-doc

BTCPay Server Official Documentation
Shell
378
star
3

BTCPayServer.Vault

Sign with software or hardware wallets
C#
161
star
4

BTCPayServer.Lightning

Client library for lightning network implementations to build Lightning Network Apps in C#.
C#
96
star
5

node-btcpay

BTCPay NodeJS client
TypeScript
84
star
6

btcpay-python

Python client for the BTCPay API.
Python
81
star
7

btcTransmuter

A self-hosted ,modular IFTTT-inspired system for bitcoin services written in C#
C#
80
star
8

woocommerce-plugin

Plugin for connecting Woocommerce with BTCPayServer
PHP
51
star
9

btcpayserver.org

BTCPay Server Official Website Repository
CSS
41
star
10

directory.btcpayserver.org

BTCPay Server Directory - Merchants, Projects & Charities accepting Bitcoin
JavaScript
32
star
11

btcpayserver-php-client

PHP implementation for the BTCPayServer cryptographically secure RESTful API
PHP
30
star
12

dockerfile-deps

Repository hosting some Dockerfile used for external dependencies
Dockerfile
28
star
13

btcpayserver-greenfield-php

PHP
28
star
14

btcpayserver-design

BTCPay Server Design System
CSS
23
star
15

whmcs-plugin

WHMCS plugin for BTCPay
PHP
22
star
16

btcpayserver-plugins

A repository storing verified BTCPay Server Plugins.
AGS Script
19
star
17

organization

Open-organization, meetings, calendars, project management
17
star
18

woocommerce-greenfield-plugin

BTCPay Server for WooCommerce V2 plugin.
PHP
16
star
19

prestashop-plugin

Prestashop module for BTCPay Server payment integration
PHP
15
star
20

btcpayserver-googlecloud

Instructions to deploy BTCPay Server with a Google Cloud account
PowerShell
15
star
21

btcpayserver-infra

The docker compose running several services for the BTCPay Server community
Shell
14
star
22

btcpayserver-plugin-template

A template for your own BTCPay Server plugin.
C#
14
star
23

blog

BTCPay Server Official Blog
Stylus
13
star
24

php-bitpay-client

PHP implementation for the BitPay cryptographically secure RESTful API
PHP
13
star
25

zapier

BTCPay Server Zapier Integration
JavaScript
13
star
26

btcpayserver-configurator

An easy UI to configure new and existing BTCPay deployments.
CSS
12
star
27

btcpayserver-azure

Instructions to deploy BTCPay Server with an Microsoft Azure account
Shell
11
star
28

commerce_btcpay

BTCPay server plugin for Drupal Commerce 2.x
PHP
9
star
29

prestashop-plugin-legacy

Prestashop plugin for BTCPay Server
PHP
9
star
30

BTCPayServer.BIP78

a BIP78 Payjoin implemention in C# for both sender and receiver.
C#
7
star
31

btcpayserver-media

Media asset for BTCPayServer
7
star
32

btcpayserver-plugin-builder

A server building plugins for BTCPay Server
C#
6
star
33

app

C#
6
star
34

BTCPayServer.BoltCardTools

C#
6
star
35

xenforo

PHP
5
star
36

magento2-plugin

PHP
5
star
37

odoo

BTCPay Server addon for Odoo
Python
5
star
38

docker-compose-builder

Repository building docker-compose images
Dockerfile
4
star
39

foundation.btcpayserver.org

The official website of the BTCPay Server Foundation
CSS
4
star
40

docker-woocommerce

Archived and moved to the https://github.com/btcpayserver/dockerfile-deps repo. A wordpress image with woocommerce and BTCPayServer plugin pre-installed.
Shell
4
star
41

grandnode

BTCPay plugin for GrandNode
C#
3
star
42

opencart

OpenCart payment extension for BTCPay Server.
PHP
3
star
43

ledgerwebsocket

A websocket bridge to connect transport U2F of ledger to a wallet
TypeScript
3
star
44

nopcommerce

C#
2
star
45

btcpayserverslackbot

C#
1
star
46

db-doc-generator

Shell
1
star
47

joomla-virtuemart

Joomla Virtuemart 3 Integration
PHP
1
star
48

btcpayserver-installer

Because I felt like I had enough time to create another side project
Vue
1
star