You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
5.3 KiB

7 years ago
# How to use
7 years ago
This repository is hosting different docker-compose which can be used to facilitate deployment of BTCPay Server.
7 years ago
![Architecture](https://github.com/btcpayserver/btcpayserver-doc/raw/master/img/Architecture.png)
7 years ago
7 years ago
As you can see, it depends on several piece of infrastructure, mainly:
7 years ago
7 years ago
* 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.
7 years ago
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.
7 years ago
The production `docker-compose` is used under the hood to deploy an instance of BTCPay on Microsoft Azure in one click:
7 years ago
[![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.
7 years ago
# About accessing services inside those docker compose
Several scripts are provided to access the internal of your docker-service:
7 years ago
* `litecoin-cli.sh`
* `bitcoin-cli.sh`
* `litecoin-lightning-cli.sh`
* `bitcoin-lightning-cli.sh`
7 years ago
We also provide powershell `.ps1` scripts if you are on windows.
7 years ago
You can use it easily:
```
7 years ago
./bitcoin-cli.sh getblockcount
```
7 years ago
# 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
```
7 years ago
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/`.
# About generate-docker-compose
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.
# No docker-compose suit my need, what should I do?
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).
The pre-generated `docker-compose` files cover `btc`, `ltc`, `clightning` for configuration with or without `nginx `reverse proxy.
If you want any other configuration, you need to run [build.sh](build.sh) (or [build.ps1](build.ps1)) with environment variables correctly set.
To configure your custom docker-compose, the following environment variables are supported:
* `BTCPAYGEN_CRYPTO1` to `BTCPAYGEN_CRYPTO9`: Specify support for a crypto currency. (Valid value: `btc`, `ltc`)
* `BTCPAYGEN_REVERSEPROXY`: Specify the reverse proxy to use (Valid value: `nginx`, `none`)
* `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`:
On Windows:
```
Invoke-Command {
$BTCPAYGEN_CRYPTO1="btc"
$BTCPAYGEN_CRYPTO2="ltc"
$BTCPAYGEN_REVERSEPROXY="nginx"
$BTCPAYGEN_LIGHTNING="clightning"
$BTCPAYGEN_SUBNAME="custom"
. .\build.ps1
}
```
On Linux:
```
7 years ago
BTCPAYGEN_CRYPTO1="btc" \
BTCPAYGEN_CRYPTO2="ltc" \
BTCPAYGEN_REVERSEPROXY="nginx" \
7 years ago
BTCPAYGEN_LIGHTNING="clightning" \
7 years ago
BTCPAYGEN_SUBNAME="custom" \
./build.sh
```
# How to extend with my 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/CryptoDefinition.cs))
Congratulation!