Browse Source

Migration to new deployment system

migrate-pregen
nicolas.dorier 7 years ago
parent
commit
7b3faa71c2
  1. 1
      .gitignore
  2. 1
      Generated/.gitignore
  3. 10
      Production-NoReverseProxy/docker-compose.btc-clightning.yml
  4. 14
      Production-NoReverseProxy/docker-compose.btc-ltc-clightning.yml
  5. 10
      Production-NoReverseProxy/docker-compose.btc-ltc.yml
  6. 8
      Production-NoReverseProxy/docker-compose.btc.yml
  7. 10
      Production-NoReverseProxy/docker-compose.ltc-clightning.yml
  8. 8
      Production-NoReverseProxy/docker-compose.ltc.yml
  9. 16
      Production/docker-compose.btc-clightning.yml
  10. 20
      Production/docker-compose.btc-ltc-clightning.yml
  11. 16
      Production/docker-compose.btc-ltc.yml
  12. 14
      Production/docker-compose.btc.yml
  13. 16
      Production/docker-compose.ltc-clightning.yml
  14. 14
      Production/docker-compose.ltc.yml
  15. 247
      README.md
  16. 7
      btcpay-restart.sh
  17. 141
      btcpay-setup.sh
  18. 29
      btcpay-update.sh
  19. 2
      build-pregen.ps1
  20. 2
      build-pregen.sh
  21. 7
      build.ps1
  22. 7
      build.sh
  23. 19
      changedomain.sh
  24. 1
      docker-compose-generator/.dockerignore
  25. 1
      docker-compose-generator/Dockerfile
  26. 2
      docker-compose-generator/docker-fragments/bgold.yml
  27. 2
      docker-compose-generator/docker-fragments/bitcoin-clightning.yml
  28. 2
      docker-compose-generator/docker-fragments/bitcoin.yml
  29. 6
      docker-compose-generator/docker-fragments/btcpayserver.yml
  30. 2
      docker-compose-generator/docker-fragments/litecoin-clightning.yml
  31. 2
      docker-compose-generator/docker-fragments/litecoin.yml
  32. 6
      docker-compose-generator/docker-fragments/nginx.yml
  33. 5
      docker-compose-generator/src/docker-compose-generator.csproj

1
.gitignore

@ -295,4 +295,5 @@ BTCPayServer/wwwroot/bundles/*
Production/.env
.env
.vscode/
*docker-compose.generated.yml

1
Generated/.gitignore

@ -1 +1,2 @@
*.yml
*.tmpl

10
Production-NoReverseProxy/docker-compose.btc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -31,7 +31,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -47,12 +47,12 @@ services:
links:
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:
@ -69,7 +69,7 @@ services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/bitcoin

14
Production-NoReverseProxy/docker-compose.btc-ltc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -35,7 +35,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -55,12 +55,12 @@ services:
- litecoind
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -77,7 +77,7 @@ services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/litecoin
@ -95,7 +95,7 @@ services:
links:
- litecoind
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:
@ -112,7 +112,7 @@ services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/bitcoin

10
Production-NoReverseProxy/docker-compose.btc-ltc.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -29,7 +29,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -49,12 +49,12 @@ services:
- litecoind
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -69,7 +69,7 @@ services:
volumes:
- "litecoin_datadir:/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:

8
Production-NoReverseProxy/docker-compose.btc.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -28,7 +28,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -44,12 +44,12 @@ services:
links:
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:

10
Production-NoReverseProxy/docker-compose.ltc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -31,7 +31,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -47,12 +47,12 @@ services:
links:
- litecoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -69,7 +69,7 @@ services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/litecoin

8
Production-NoReverseProxy/docker-compose.ltc.yml

@ -1,7 +1,7 @@
version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -28,7 +28,7 @@ services:
ports:
- "80:49392"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -44,12 +44,12 @@ services:
links:
- litecoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:

16
Production/docker-compose.btc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -73,7 +73,7 @@ services:
- "nbxplorer_datadir:/root/.nbxplorer"
- "clightning_bitcoin_datadir:/etc/clightning_bitcoin"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -89,12 +89,12 @@ services:
links:
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:
@ -111,7 +111,7 @@ services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/bitcoin

20
Production/docker-compose.btc-ltc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -77,7 +77,7 @@ services:
- "clightning_litecoin_datadir:/etc/clightning_litecoin"
- "clightning_bitcoin_datadir:/etc/clightning_bitcoin"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -97,12 +97,12 @@ services:
- litecoind
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -119,7 +119,7 @@ services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/litecoin
@ -137,7 +137,7 @@ services:
links:
- litecoind
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:
@ -154,7 +154,7 @@ services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/bitcoin

16
Production/docker-compose.btc-ltc.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -71,7 +71,7 @@ services:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -91,12 +91,12 @@ services:
- litecoind
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -111,7 +111,7 @@ services:
volumes:
- "litecoin_datadir:/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:

14
Production/docker-compose.btc.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -70,7 +70,7 @@ services:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -86,12 +86,12 @@ services:
links:
- bitcoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:

16
Production/docker-compose.ltc-clightning.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -73,7 +73,7 @@ services:
- "nbxplorer_datadir:/root/.nbxplorer"
- "clightning_litecoin_datadir:/etc/clightning_litecoin"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -89,12 +89,12 @@ services:
links:
- litecoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:
@ -111,7 +111,7 @@ services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/litecoin

14
Production/docker-compose.ltc.yml

@ -1,7 +1,7 @@
version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -15,7 +15,7 @@ services:
links:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -29,7 +29,7 @@ services:
links:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:
@ -45,7 +45,7 @@ services:
links:
- nginx-gen
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -70,7 +70,7 @@ services:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -86,12 +86,12 @@ services:
links:
- litecoind
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:

247
README.md

@ -1,78 +1,101 @@
# How to use
# Introduction
This repository is hosting different docker-compose which can be used to facilitate deployment of BTCPay Server.
This repository will help you to setup BTCPay and all its dependencies in a simple way:
![Architecture](https://github.com/btcpayserver/btcpayserver-doc/raw/master/img/Architecture.png)
As you can see, it depends on several piece of infrastructure, mainly:
As you can see, BTCPay depends on several piece of infrastructure, mainly:
* A lightweight block explorer (NBXplorer),
* A database (Postgres, or SQLite),
* A full node (Bitcoin Core)
Setting up the dependencies might be time consuming, this repository is meant to give working example of `docker-compose` file which will setup everything for you.
There is more dependencies, if you support more than just Bitcoin. (C-Lightning, LitecoinD etc...)
Setting up the dependencies correctly in a production environment might be time consuming.
The [Production](Production) `docker-compose` files are used for production environment. It adds NGinx as a reverse proxy and [Let's Encrypt and DockerGen](https://github.com/gilyes/docker-nginx-letsencrypt-sample) to automatically configure HTTPS.
The production `docker-compose` is used under the hood to deploy an instance of BTCPay on Microsoft Azure in one click:
This repository is meant to setup your environment easily.
[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
The [Production-NoReverseProxy](Production-NoReverseProxy) `docker-compose` files are used for environment which are already behind a reverse proxy. It exposes BTCPayServer directly on port 80.
# How to use this?
# About accessing services inside those docker compose
## For complete noobs
Several scripts are provided to access the internal of your docker-service:
If you have no knowledge of Linux administration or Docker, we advise you to host BTCPay on Microsoft Azure by opening an account then clicking here
* `litecoin-cli.sh`
* `bitcoin-cli.sh`
* `litecoin-lightning-cli.sh`
* `bitcoin-lightning-cli.sh`
[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
We also provide powershell `.ps1` scripts if you are on windows.
Follow this video
You can use it easily:
[![BTCPay - One Click Setup](http://img.youtube.com/vi/Bxs95BdEMHY/mqdefault.jpg)](http://www.youtube.com/watch?v=Bxs95BdEMHY "BTCPay - One Click Setup")
```
./bitcoin-cli.sh getblockcount
```
This installation is convenient but will cost you around 60 USD per month.
After all your nodes are synched and you confirm things work fine, you can fine tune save additional money by following [this guide](https://github.com/btcpayserver/btcpayserver-doc/blob/master/PennyPinching.md), and drop to 30 or 40 USD per month.
# For docker noobs <a name="fornoobs" />
## For technical user
If you are a docker noob here is how you would create a HTTPS ready server.
If, for some reason, you don't want or can't use the Azure deployment explained above then you can install BTCPayServer on your own instance.
First step is to make sure you have a domain name pointing to your host, and that port `443` and `80` and externally accessible.
Let's assume it is `btcpay.example.com`.
Clone the repository:
```
You also want to support litecoin, bitcoin and clightning and having HTTPS automatically configured by nginx.
```bash
# Log 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
```
Create an `.env` file with the parameters documented in [Production](Production):
# Run btcpay-setup.sh with the right parameters
export BTCPAY_HOST="btcpay.example.com"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_CRYPTO2="ltc"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="clightning"
. ./btcpay-setup.sh -i
```
NBITCOIN_NETWORK=mainnet
BTCPAY_HOST=btcpay.example.com
LETSENCRYPT_EMAIL=me@example.com
ACME_CA_URI=https://acme-v01.api.letsencrypt.org/directory
```
Save, then run it:
`btcpay-setup.sh` will :
```
docker-compose -f "$(pwd)/Production/docker-compose.btc-ltc.yml" up -d
```
* 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
Wait a little bit, then you can now browse `https://btcpay.example.com/`.
# Tooling <a name="tooling" />
A wide range of tooling get available on your system when btcpay is installed:
* `bitcoin-cli.sh` access your bitcoin node instance
* `bitcoin-lightning-cli.sh` access your clighning node instance
* `changedomain.sh` change the domain of your BTCPayServer
* `btcpay-update.sh` update BTCPay to the latest version
* `btcpay-setup.sh` change the settings of your server (run `. ./btcpay-setup.sh` to get more information about additional parameters, run `. ./btcpay-setup.sh -i` to setup again your btcpay server)
# Under the hood
## Prebuilt docker-compose
For your custom need, you will find some working example of `docker-compose` file which will setup everything for you.
The [Production](Production) `docker-compose` files are used for production environment. It adds NGinx as a reverse proxy and [Let's Encrypt and DockerGen](https://github.com/gilyes/docker-nginx-letsencrypt-sample) to automatically configure HTTPS.
The production `docker-compose` is used under the hood to deploy an instance of BTCPay on Microsoft Azure in one click:
# About generate-docker-compose
[![Deploy to Azure](https://azuredeploy.net/deploybutton.svg)](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2Fbtcpayserver%2Fbtcpayserver-azure%2Fmaster%2Fazuredeploy.json)
The files in `Production` and `Production-NoReverseProxy` are generated by a dotnet program located in `docker-compose-generator`.
It is meant to generate a wide range a configuration from `docker-compose-generator/docker-fragments` without repeating myself.
The [Production-NoReverseProxy](Production-NoReverseProxy) `docker-compose` files are used for environment which are already behind a reverse proxy. It exposes BTCPayServer directly on port 80.
# No docker-compose suit my need, what should I do?
## Generated docker-compose
All `docker-compose` files in [Production](Production) and [Production-NoReverseProxy](Production-NoReverseProxy) are generated by running the [build-pregen.sh](build-pregen.sh) (or [build-pregen.ps1](build-pregen.ps1)) scripts from the fragments located in [docker-compose-generator/docker-fragments](docker-compose-generator/docker-fragments).
@ -87,9 +110,9 @@ To configure your custom docker-compose, the following environment variables are
* `BTCPAYGEN_LIGHTNING`: Specify the lightning network implementation (Valid value: `clightning`, `none`)
* `BTCPAYGEN_SUBNAME`: The sub name of the generated docker-compose file, where the full name will be `Generated/docker-compose.SUBNAME.yml` (Default: `generated`)
Then, running [build.sh](build.sh) (or [build.ps1](build.ps1)) will then generate a `docker-compose.generated.yml` in the root folder of this repository.
For example, if you want `btc` and `ltc` support with `nginx` and `clightning` inside `Generate/docker-compose.custom.yml`:
Then, running [build.sh](build.sh) (or [build.ps1](build.ps1)) will then generate a `docker-compose.generated.yml` in the [Generated](Generated) folder of this repository.
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 next run are instantaneous.
On Windows:
@ -116,11 +139,145 @@ BTCPAYGEN_SUBNAME="custom" \
./build.sh
```
# How to extend with my own crypto?
## What btcpay-setup do
`btcpay-setup.sh` utility is a tool which:
1. Make sure docker and docker-compose are installed on your system
2. Generate a docker-compose via `./build.sh`
3. Setup an [Environment File](https://docs.docker.com/compose/env-file/) to configure your docker-compose
4. Setup environment variables so the tools described in [tooling](#tooling) can work.
5. Add symbolic links of those tools in `/usr/bin`
6. Start docker-compose
7. Make sure it restart at reboot via upstart or systemd.
Here is an overview of the files generated by `btcpay-setup.sh`.
`/etc/profile.d/btcpay-env.sh` ensures that your environment variable are correctly setup when you log in, so you can use the tools.
```bash
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 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"
if cat $BTCPAY_ENV_FILE &> /dev/null; then
export BTCPAY_HOST="$(cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p')"
export LETSENCRYPT_EMAIL="$(cat $BTCPAY_ENV_FILE | sed -n 's/^LETSENCRYPT_EMAIL=\(.*\)$/\1/p')"
export NBITCOIN_NETWORK="$(cat $BTCPAY_ENV_FILE | sed -n 's/^NBITCOIN_NETWORK=\(.*\)$/\1/p')"
export LIGHTNING_ALIAS="$(cat $BTCPAY_ENV_FILE | sed -n 's/^LIGHTNING_ALIAS=\(.*\)$/\1/p')"
export ACME_CA_URI="$(cat $BTCPAY_ENV_FILE | sed -n 's/^ACME_CA_URI=\(.*\)$/\1/p')"
fi
```
`/etc/systemd/system/btcpayserver.service` file ensure that you can control btcpay via `systemctl`, and that btcpay server start on reboot:
```ini
[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 "$(dirname $BTCPAY_ENV_FILE)" && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d'
ExecStop=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd "$(dirname $BTCPAY_ENV_FILE)" && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" stop'
ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd "$(dirname $BTCPAY_ENV_FILE)" && docker-compose -f "$BTCPAY_DOCKER_COMPOSE" restart'
[Install]
WantedBy=multi-user.target
```
`.env` file (`$BTCPAY_ENV_FILE`) are the environment variable passed to the containers managed by your docker-compose:
```ini
BTCPAY_HOST=btcpay.example.com
ACME_CA_URI=https://acme-v01.api.letsencrypt.org/directory
NBITCOIN_NETWORK=mainnet
LETSENCRYPT_EMAIL=me@example.com
```
# How to extend with your own crypto?
1. Support for your crypto on [NBitcoin](https://github.com/MetacoSA/NBitcoin/tree/master/NBitcoin.Altcoins)/[NBxplorer](https://github.com/dgarage/NBXplorer)/[BTCPay Server](https://github.com/btcpayserver/btcpayserver). (Take example on other coins)
2. Create your own docker image ([Example for BTC](https://hub.docker.com/r/nicolasdorier/docker-bitcoin/))
3. Create a docker-compose fragment ([Example for BTC](docker-compose-generator/docker-fragments/bitcoin.yml))
4. Add your Crypto Definition ([Example for BTC](docker-compose-generator/src/CryptoDefinition.cs))
Congratulation!
Now if you want to test, DOT NOT USE `build.sh`, because this utility is a pre-built docker image.
Instead, install [.NET Core 2.1 SDK](https://www.microsoft.com/net/download/windows) then run:
```bash
BTCPAYGEN_CRYPTO1="xxx"
BTCPAYGEN_SUBNAME="test"
cd docker-compose-generator/src
dotnet run
```
This will generate your docker-compose in the `Generated` folder, which you can then try by yourself.
Note that BTCPayServer developers will not spend time testing your image, so make sure it works.
# For docker noobs <a name="fornoobs" />
If you are a docker noob here is how you would create a HTTPS ready server.
First step is to make sure you have a domain name pointing to your host, and that port `443` and `80` and externally accessible.
Let's assume it is `btcpay.example.com`.
Clone the repository:
```
git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker
```
Create an `.env` file with the parameters documented in [Production](Production):
```
NBITCOIN_NETWORK=mainnet
BTCPAY_HOST=btcpay.example.com
LETSENCRYPT_EMAIL=me@example.com
ACME_CA_URI=https://acme-v01.api.letsencrypt.org/directory
```
Save, then run it:
```
docker-compose -f "$(pwd)/Production/docker-compose.btc-ltc.yml" up -d
```
Wait a little bit, then you can now browse `https://btcpay.example.com/`.
# 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 wants to add `btg`.
```bash
export BTCPAYGEN_CRYPTO3='btg'
. btcpay-setup.sh -i
```
## I deployed before btcpay-setup.sh existed, can I migrate to this new system? <a name="migration" />
Yes, the following command will migrate you to this new system:
```bash
sudo su -
btcpay-update.sh
cd $DOWNLOAD_ROOT/btcpayserver-docker
. ./btcpay-setup.sh -i
```

7
btcpay-restart.sh

@ -0,0 +1,7 @@
#!/bin/bash
. /etc/profile.d/btcpay-env.sh
cd "`dirname $BTCPAY_ENV_FILE`"
docker-compose -f $BTCPAY_DOCKER_COMPOSE down
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d

141
btcpay-setup.sh

@ -10,15 +10,17 @@ if [[ $EUID -ne 0 ]]; then
return
fi
if [[ ! -d "Production-NoReverseProxy" ]]; then
echo "You must run this script from inside the btcpayserver-docker folder"
return
# Verify we are in right folder. If we are not, let's go in the parent folder of the current docker-compose.
if ! git -C . rev-parse &> /dev/null || [ ! -d "Generated" ]; then
if [ ! -z $BTCPAY_DOCKER_COMPOSE ]; then
cd $(dirname $BTCPAY_DOCKER_COMPOSE)
cd ..
fi
if ! git -C . rev-parse; then
if ! git -C . rev-parse || [ ! -d "Generated" ]; then
echo "You must run this script inside the git repository of btcpayserver-docker"
return
fi
fi
function display_help () {
cat <<-END
@ -65,16 +67,80 @@ if [ "$1" != "-i" ]; then
return
fi
######### Migration: old pregen environment to new environment ############
if [ ! -z $BTCPAY_DOCKER_COMPOSE ] && [ ! -z $DOWNLOAD_ROOT ] && [ -z $BTCPAYGEN_MIGRATED_PREGEN ]; then
echo "Old pregen docker deployment detected. Migrating..."
rm "$DOWNLOAD_ROOT/btcpay-restart.sh"
rm "$DOWNLOAD_ROOT/btcpay-update.sh"
rm "$DOWNLOAD_ROOT/changedomain.sh"
rm "$DOWNLOAD_ROOT/entrypoint.sh"
DOWNLOAD_ROOT=""
BTCPAYGEN_MIGRATED_PREGEN="true"
# Migration: old deployment store those in BTCPAY_ENV_FILE
BTCPAY_HOST=$(cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p')
ACME_CA_URI=$(cat $BTCPAY_ENV_FILE | sed -n 's/^ACME_CA_URI=\(.*\)$/\1/p')
NBITCOIN_NETWORK=$(cat $BTCPAY_ENV_FILE | sed -n 's/^NBITCOIN_NETWORK=\(.*\)$/\1/p')
LETSENCRYPT_EMAIL=$(cat $BTCPAY_ENV_FILE | sed -n 's/^LETSENCRYPT_EMAIL=\(.*\)$/\1/p')
LIGHTNING_ALIAS=$(cat $BTCPAY_ENV_FILE | sed -n 's/^LIGHTNING_ALIAS=\(.*\)$/\1/p')
if [[ $(dirname $BTCPAY_DOCKER_COMPOSE) == *Production ]]; then
BTCPAYGEN_REVERSEPROXY='nginx'
fi
if [[ $(dirname $BTCPAY_DOCKER_COMPOSE) == *Production-NoReverseProxy ]]; then
BTCPAYGEN_REVERSEPROXY='none'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.btc.yml ]]; then
BTCPAYGEN_CRYPTO1='btc'
BTCPAYGEN_LIGHTNING='none'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.btc-clightning.yml ]]; then
BTCPAYGEN_CRYPTO1='btc'
BTCPAYGEN_LIGHTNING='clightning'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.ltc.yml ]]; then
BTCPAYGEN_CRYPTO1='ltc'
BTCPAYGEN_LIGHTNING='none'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.ltc-clightning.yml ]]; then
BTCPAYGEN_CRYPTO1='ltc'
BTCPAYGEN_LIGHTNING='clightning'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.btc-ltc.yml ]]; then
BTCPAYGEN_CRYPTO1='btc'
BTCPAYGEN_CRYPTO2='ltc'
BTCPAYGEN_LIGHTNING='none'
fi
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.btc-ltc-clightning.yml ]]; then
BTCPAYGEN_CRYPTO1='btc'
BTCPAYGEN_CRYPTO2='ltc'
BTCPAYGEN_LIGHTNING='clightning'
fi
fi
#########################################################
: "${LETSENCRYPT_EMAIL:=me@example.com}"
: "${BTCPAYGEN_MIGRATED_PREGEN:=false}"
: "${NBITCOIN_NETWORK:=mainnet}"
: "${BTCPAYGEN_CRYPTO1:=btc}"
: "${BTCPAYGEN_REVERSEPROXY:=nginx}"
: "${BTCPAYGEN_LIGHTNING:=none}"
: "${ACME_CA_URI:=https://acme-v01.api.letsencrypt.org/directory}"
OLD_BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE
ORIGINAL_DIRECTORY=$(pwd)
BTCPAY_BASE_DIRECTORY="$(dirname $(pwd))"
if [ "$BTCPAYGEN_MIGRATED_PREGEN" == "true" ]; then
if [[ $(dirname $BTCPAY_DOCKER_COMPOSE) == *Production ]]; then
BTCPAY_DOCKER_COMPOSE="$(pwd)/Production/docker-compose.generated.yml"
elif [[ $(dirname $BTCPAY_DOCKER_COMPOSE) == *Production-NoReverseProxy ]]; then
BTCPAY_DOCKER_COMPOSE="$(pwd)/Production-NoReverseProxy/docker-compose.generated.yml"
fi
else # new deployments must be in Generated
BTCPAY_DOCKER_COMPOSE="$(pwd)/Generated/docker-compose.generated.yml"
fi
BTCPAY_ENV_FILE="$BTCPAY_BASE_DIRECTORY/.env"
echo "
@ -101,6 +167,7 @@ Additional exported variables:
BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE
BTCPAY_BASE_DIRECTORY=$BTCPAY_BASE_DIRECTORY
BTCPAY_ENV_FILE=$BTCPAY_ENV_FILE
BTCPAYGEN_MIGRATED_PREGEN=$BTCPAYGEN_MIGRATED_PREGEN
----------------------
"
@ -118,17 +185,10 @@ if [ "$NBITCOIN_NETWORK" != "mainnet" ] && [ "$NBITCOIN_NETWORK" != "testnet" ]
echo "NBITCOIN_NETWORK should be equal to mainnet, testnet or regtest"
fi
export BTCPAY_DOCKER_COMPOSE
export BTCPAY_BASE_DIRECTORY
export BTCPAY_ENV_FILE
# Put the variables in /etc/profile.d when a user log interactively
touch "/etc/profile.d/btcpay-env.sh"
echo "
export BTCPAY_HOST=\"$BTCPAY_HOST\"
export LETSENCRYPT_EMAIL=\"$LETSENCRYPT_EMAIL\"
export NBITCOIN_NETWORK=\"$NBITCOIN_NETWORK\"
export LIGHTNING_ALIAS=\"$LIGHTNING_ALIAS\"
export BTCPAYGEN_OLD_PREGEN=\"$BTCPAYGEN_MIGRATED_PREGEN\"
export BTCPAYGEN_CRYPTO1=\"$BTCPAYGEN_CRYPTO1\"
export BTCPAYGEN_CRYPTO2=\"$BTCPAYGEN_CRYPTO2\"
export BTCPAYGEN_CRYPTO3=\"$BTCPAYGEN_CRYPTO3\"
@ -139,14 +199,32 @@ export BTCPAYGEN_CRYPTO7=\"$BTCPAYGEN_CRYPTO7\"
export BTCPAYGEN_CRYPTO8=\"$BTCPAYGEN_CRYPTO8\"
export BTCPAYGEN_CRYPTO9=\"$BTCPAYGEN_CRYPTO9\"
export BTCPAYGEN_LIGHTNING=\"$BTCPAYGEN_LIGHTNING\"
export ACME_CA_URI=\"$ACME_CA_URI\"
export BTCPAYGEN_REVERSEPROXY=\"$BTCPAYGEN_REVERSEPROXY\"
export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"
export BTCPAY_BASE_DIRECTORY=\"$BTCPAY_BASE_DIRECTORY\"
export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"" > /etc/profile.d/btcpay-env.sh
export BTCPAY_ENV_FILE=\"$BTCPAY_ENV_FILE\"
if cat \$BTCPAY_ENV_FILE &> /dev/null; then
export BTCPAY_HOST=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p')\"
export LETSENCRYPT_EMAIL=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^LETSENCRYPT_EMAIL=\(.*\)$/\1/p')\"
export NBITCOIN_NETWORK=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^NBITCOIN_NETWORK=\(.*\)$/\1/p')\"
export LIGHTNING_ALIAS=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^LIGHTNING_ALIAS=\(.*\)$/\1/p')\"
export ACME_CA_URI=\"\$(cat \$BTCPAY_ENV_FILE | sed -n 's/^ACME_CA_URI=\(.*\)$/\1/p')\"
fi
" > /etc/profile.d/btcpay-env.sh
chmod +x /etc/profile.d/btcpay-env.sh
. /etc/profile.d/btcpay-env.sh
echo -e "BTCPay Server environment variables successfully saved in /etc/profile.d/btcpay-env.sh\n"
if ! [ -x "$(command -v docker)" ] || ! [ -x "$(command -v docker-compose)" ]; then
apt-get update 2>error
apt-get install -y \
curl \
apt-transport-https \
ca-certificates \
software-properties-common \
2>error
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
if [ $(lsb_release -cs) == "bionic" ]; then
# Bionic not in the repo yet, see https://linuxconfig.org/how-to-install-docker-on-ubuntu-18-04-bionic-beaver
@ -155,12 +233,6 @@ if ! [ -x "$(command -v docker)" ] || ! [ -x "$(command -v docker-compose)" ]; t
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
fi
apt-get update 2>error
apt-get install -y \
curl \
apt-transport-https \
ca-certificates \
software-properties-common \
2>error
fi
if ! [ -x "$(command -v docker)" ]; then
@ -195,8 +267,12 @@ echo -e "BTCPay Server docker-compose parameters saved in $BTCPAY_ENV_FILE\n"
# Generate the docker compose in BTCPAY_DOCKER_COMPOSE
. ./build.sh
if [ "$BTCPAYGEN_MIGRATED_PREGEN" == "true" ]; then
cp Generated/docker-compose.generated.yml $BTCPAY_DOCKER_COMPOSE
fi
# Schedule for reboot
if [ -d "/etc/systemd/system" ]; then # Use systemd
if [ -x "$(command -v systemctl)" ]; then # Use systemd
if [ -e "/etc/init/start_containers.conf" ]; then
echo -e "Uninstalling upstart script /etc/init/start_containers.conf"
rm "/etc/init/start_containers.conf"
@ -241,25 +317,32 @@ stop on runlevel [!2345]
script
. /etc/profile.d/btcpay-env.sh
cd \"`dirname \$BTCPAY_ENV_FILE`\"
cd \"\$(dirname \$BTCPAY_ENV_FILE)\"
docker-compose -f \"\$BTCPAY_DOCKER_COMPOSE\" up -d
end script" > /etc/init/start_containers.conf
echo -e "BTCPay Server upstart configured in /etc/init/start_containers.conf\n"
initctl reload-configuration
cd "$(dirname $BTCPAY_ENV_FILE)"
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d
echo "BTCPay Server started"
fi
cd "$(dirname $BTCPAY_ENV_FILE)"
if [ $OLD_BTCPAY_DOCKER_COMPOSE != $BTCPAY_DOCKER_COMPOSE ]; then
echo "Closing old docker-compose at $OLD_BTCPAY_DOCKER_COMPOSE..."
docker-compose -f "$OLD_BTCPAY_DOCKER_COMPOSE" down
fi
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d --remove-orphans
cd $ORIGINAL_DIRECTORY
for scriptname in *.sh; do
if [ "$scriptname" == "build.sh" -o "$scriptname" == "build-pregen.sh" ] ; then
continue;
fi
echo "Adding symlink of $scriptname to /usr/bin"
chmod +x $scriptname
if [ -e /usr/bin/$scriptname ]; then
rm /usr/bin/$scriptname
fi
ln -s $scriptname /usr/bin
rm /usr/bin/$scriptname &> /dev/null
ln -s "$(pwd)/$scriptname" /usr/bin
done

29
btcpay-update.sh

@ -0,0 +1,29 @@
#!/bin/bash
set -e
. /etc/profile.d/btcpay-env.sh
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
git pull --force
if [[ $BTCPAY_DOCKER_COMPOSE == *docker-compose.generated.yml ]]; then
# Generate the docker compose in BTCPAY_DOCKER_COMPOSE
. ./build.sh
if [ "$BTCPAYGEN_MIGRATED_PREGEN" == "true" ]; then
cp Generated/docker-compose.generated.yml $BTCPAY_DOCKER_COMPOSE
fi
fi
for scriptname in *.sh; do
if [ "$scriptname" == "build.sh" -o "$scriptname" == "build-pregen.sh" ] ; then
continue;
fi
echo "Adding symlink of $scriptname to /usr/bin"
chmod +x $scriptname
rm /usr/bin/$scriptname &> /dev/null
ln -s "$(pwd)/$scriptname" /usr/bin
done
cd "`dirname $BTCPAY_ENV_FILE`"
docker-compose -f $BTCPAY_DOCKER_COMPOSE up -d --remove-orphans

2
build-pregen.ps1

@ -1,4 +1,4 @@
# This script will run docker-compose-generator in a container to generate the yml files
docker build -t btcpayserver/docker-compose-generator "$(Get-Location)\docker-compose-generator"
docker pull btcpayserver/docker-compose-generator
docker run -v "$(Get-Location)\Production:/app/Production" -v "$(Get-Location)\Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator pregen

2
build-pregen.sh

@ -1,5 +1,5 @@
#!/bin/bash
# This script will run docker-compose-generator in a container to generate the yml files
docker build -t btcpayserver/docker-compose-generator "$(pwd)/docker-compose-generator"
docker pull btcpayserver/docker-compose-generator
docker run -v "$(pwd)/Production:/app/Production" -v "$(pwd)/Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator pregen

7
build.ps1

@ -1,7 +1,8 @@
# This script will run docker-compose-generator in a container to generate the yml files
docker build -t btcpayserver/docker-compose-generator "$(Get-Location)\docker-compose-generator"
docker pull btcpayserver/docker-compose-generator
docker run -v "$(Get-Location)\Generated:/app/Generated" `
-v "$(Get-Location)\docker-compose-generator\docker-fragments:/app/docker-fragments" `
-e "BTCPAYGEN_CRYPTO1=$BTCPAYGEN_CRYPTO1" `
-e "BTCPAYGEN_CRYPTO2=$BTCPAYGEN_CRYPTO2" `
-e "BTCPAYGEN_CRYPTO3=$BTCPAYGEN_CRYPTO3" `
@ -15,3 +16,7 @@ docker run -v "$(Get-Location)\Generated:/app/Generated" `
-e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" `
-e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" `
--rm btcpayserver/docker-compose-generator
If ($BTCPAYGEN_REVERSEPROXY -eq "nginx") {
Copy-Item ".\Production\nginx.tmpl" -Destination ".\Generated"
}

7
build.sh

@ -1,8 +1,9 @@
#!/bin/bash
# This script will run docker-compose-generator in a container to generate the yml files
docker build -t btcpayserver/docker-compose-generator "$(pwd)/docker-compose-generator"
docker pull btcpayserver/docker-compose-generator
docker run -v "$(pwd)/Generated:/app/Generated" \
-v "$(pwd)/docker-compose-generator/docker-fragments:/app/docker-fragments" \
-e "BTCPAYGEN_CRYPTO1=$BTCPAYGEN_CRYPTO1" \
-e "BTCPAYGEN_CRYPTO2=$BTCPAYGEN_CRYPTO2" \
-e "BTCPAYGEN_CRYPTO3=$BTCPAYGEN_CRYPTO3" \
@ -16,3 +17,7 @@ docker run -v "$(pwd)/Generated:/app/Generated" \
-e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" \
-e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" \
--rm btcpayserver/docker-compose-generator
if [ "$BTCPAYGEN_REVERSEPROXY" == "nginx" ]; then
cp Production/nginx.tmpl Generated/nginx.tmpl
fi

19
changedomain.sh

@ -0,0 +1,19 @@
#!/bin/bash
. /etc/profile.d/btcpay-env.sh
export NEW_HOST="$1"
export OLD_HOST=`cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_HOST=\(.*\)$/\1/p'`
echo "Changing domain from \"$OLD_HOST\" to \"$NEW_HOST\""
export BTCPAY_HOST="$NEW_HOST"
export ACME_CA_URI="https://acme-v01.api.letsencrypt.org/directory"
# Modify environment file
sed -i '/^BTCPAY_HOST/d' $BTCPAY_ENV_FILE
sed -i '/^ACME_CA_URI/d' $BTCPAY_ENV_FILE
echo "BTCPAY_HOST=$BTCPAY_HOST" >> $BTCPAY_ENV_FILE
echo "ACME_CA_URI=$ACME_CA_URI" >> $BTCPAY_ENV_FILE
cd "`dirname $BTCPAY_ENV_FILE`"
docker-compose -f "$BTCPAY_DOCKER_COMPOSE" up -d

1
docker-compose-generator/.dockerignore

@ -122,3 +122,4 @@ output
.vs
**/launchSettings.json
docker-fragments/

1
docker-compose-generator/Dockerfile

@ -16,6 +16,5 @@ VOLUME /datadir
ENV INSIDE_CONTAINER=1
COPY --from=builder "/app" .
COPY docker-fragments docker-fragments
ENTRYPOINT ["dotnet", "docker-compose-generator.dll"]

2
docker-compose-generator/docker-fragments/bgold.yml

@ -2,7 +2,7 @@ version: "3"
services:
bgoldd:
restart: always
restart: unless-stopped
container_name: btcpayserver_bgoldd
image: kamigawabul/docker-bitcoingold:0.15.0.2
environment:

2
docker-compose-generator/docker-fragments/bitcoin-clightning.yml

@ -4,7 +4,7 @@ services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/bitcoin

2
docker-compose-generator/docker-fragments/bitcoin.yml

@ -2,7 +2,7 @@ version: "3"
services:
bitcoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_bitcoind
image: nicolasdorier/docker-bitcoin:0.16.0
environment:

6
docker-compose-generator/docker-fragments/btcpayserver.yml

@ -3,7 +3,7 @@ version: "3"
services:
btcpayserver:
restart: always
restart: unless-stopped
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
@ -33,7 +33,7 @@ services:
- "nbxplorer_datadir:/root/.nbxplorer"
nbxplorer:
restart: always
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.7
expose:
- "32838"
@ -44,7 +44,7 @@ services:
- "nbxplorer_datadir:/datadir"
postgres:
restart: always
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"

2
docker-compose-generator/docker-fragments/litecoin-clightning.yml

@ -4,7 +4,7 @@ services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
restart: unless-stopped
environment:
LIGHTNINGD_OPT: |
bitcoin-datadir=/etc/litecoin

2
docker-compose-generator/docker-fragments/litecoin.yml

@ -2,7 +2,7 @@ version: "3"
services:
litecoind:
restart: always
restart: unless-stopped
container_name: btcpayserver_litecoind
image: nicolasdorier/docker-litecoin:0.15.1
environment:

6
docker-compose-generator/docker-fragments/nginx.yml

@ -2,7 +2,7 @@ version: "3"
services:
nginx:
restart: always
restart: unless-stopped
image: nginx
container_name: nginx
ports:
@ -17,7 +17,7 @@ services:
- btcpayserver
nginx-gen:
restart: always
restart: unless-stopped
image: jwilder/docker-gen
container_name: nginx-gen
volumes:
@ -32,7 +32,7 @@ services:
- nginx
letsencrypt-nginx-proxy-companion:
restart: always
restart: unless-stopped
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: letsencrypt-nginx-proxy-companion
volumes:

5
docker-compose-generator/src/docker-compose-generator.csproj

@ -2,14 +2,11 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
<RootNamespace>DockerGenerator</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NicolasDorier.CommandLine" Version="1.0.0.1" />
<PackageReference Include="NicolasDorier.CommandLine.Configuration" Version="1.0.0.2" />
<PackageReference Include="NicolasDorier.StandardConfiguration" Version="1.0.0.13" />
<PackageReference Include="YamlDotNet" Version="4.3.1" />
</ItemGroup>

Loading…
Cancel
Save