mirror of
https://github.com/Retropex/btcpayserver-docker.git
synced 2025-05-12 21:10:42 +02:00
add build scripts for custom docker-compose
This commit is contained in:
parent
446b3db93a
commit
e2b82697a0
2
.gitignore
vendored
2
.gitignore
vendored
@ -295,4 +295,4 @@ BTCPayServer/wwwroot/bundles/*
|
||||
Production/.env
|
||||
.env
|
||||
.vscode/
|
||||
/docker-compose.generated.yml
|
||||
|
||||
|
1
Generated/.gitignore
vendored
Normal file
1
Generated/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.yml
|
51
README.md
51
README.md
@ -71,3 +71,54 @@ Wait a little bit, then you can now browse `https://btcpay.example.com/`.
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
BTCPAYGEN_CRYPTO1=btc \
|
||||
BTCPAYGEN_CRYPTO2=ltc \
|
||||
BTCPAYGEN_REVERSEPROXY=nginx \
|
||||
BTCPAYGEN_LIGHTNING=cligthning \
|
||||
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!
|
0
generate-docker-compose.ps1 → build-pregen.ps1
Normal file → Executable file
0
generate-docker-compose.ps1 → build-pregen.ps1
Normal file → Executable file
17
build.ps1
Executable file
17
build.ps1
Executable file
@ -0,0 +1,17 @@
|
||||
# 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 run -v "$(Get-Location)\Generated:/app/Generated" `
|
||||
-e "BTCPAYGEN_CRYPTO1=$BTCPAYGEN_CRYPTO1" `
|
||||
-e "BTCPAYGEN_CRYPTO2=$BTCPAYGEN_CRYPTO2" `
|
||||
-e "BTCPAYGEN_CRYPTO3=$BTCPAYGEN_CRYPTO3" `
|
||||
-e "BTCPAYGEN_CRYPTO4=$BTCPAYGEN_CRYPTO4" `
|
||||
-e "BTCPAYGEN_CRYPTO5=$BTCPAYGEN_CRYPTO5" `
|
||||
-e "BTCPAYGEN_CRYPTO6=$BTCPAYGEN_CRYPTO6" `
|
||||
-e "BTCPAYGEN_CRYPTO7=$BTCPAYGEN_CRYPTO7" `
|
||||
-e "BTCPAYGEN_CRYPTO8=$BTCPAYGEN_CRYPTO8" `
|
||||
-e "BTCPAYGEN_CRYPTO9=$BTCPAYGEN_CRYPTO9" `
|
||||
-e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" `
|
||||
-e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" `
|
||||
-e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" `
|
||||
--rm btcpayserver/docker-compose-generator
|
18
build.sh
Executable file
18
build.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/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 run -v "$(pwd)/Generated:/app/Generated" \
|
||||
-e "BTCPAYGEN_CRYPTO1=$(BTCPAYGEN_CRYPTO1)" \
|
||||
-e "BTCPAYGEN_CRYPTO2=$(BTCPAYGEN_CRYPTO2)" \
|
||||
-e "BTCPAYGEN_CRYPTO3=$(BTCPAYGEN_CRYPTO3)" \
|
||||
-e "BTCPAYGEN_CRYPTO4=$(BTCPAYGEN_CRYPTO4)" \
|
||||
-e "BTCPAYGEN_CRYPTO5=$(BTCPAYGEN_CRYPTO5)" \
|
||||
-e "BTCPAYGEN_CRYPTO6=$(BTCPAYGEN_CRYPTO6)" \
|
||||
-e "BTCPAYGEN_CRYPTO7=$(BTCPAYGEN_CRYPTO7)" \
|
||||
-e "BTCPAYGEN_CRYPTO8=$(BTCPAYGEN_CRYPTO8)" \
|
||||
-e "BTCPAYGEN_CRYPTO9=$(BTCPAYGEN_CRYPTO9)" \
|
||||
-e "BTCPAYGEN_REVERSEPROXY=$(BTCPAYGEN_REVERSEPROXY)" \
|
||||
-e "BTCPAYGEN_LIGHTNING=$(BTCPAYGEN_LIGHTNING)" \
|
||||
-e "BTCPAYGEN_SUBNAME=$(BTCPAYGEN_SUBNAME)" \
|
||||
--rm btcpayserver/docker-compose-generator
|
@ -30,7 +30,7 @@ namespace DockerGenerator
|
||||
{
|
||||
var selectedCrypto = Environment.GetEnvironmentVariable("BTCPAYGEN_CRYPTO" + i);
|
||||
if(string.IsNullOrEmpty(selectedCrypto))
|
||||
break;
|
||||
continue;
|
||||
composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant());
|
||||
}
|
||||
composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant();
|
||||
|
@ -52,7 +52,11 @@ namespace DockerGenerator
|
||||
Console.WriteLine("Crypto: " + string.Join(", ", composition.SelectedCryptos.ToArray()));
|
||||
Console.WriteLine("Lightning: " + composition.SelectedLN);
|
||||
Console.WriteLine("ReverseProxy: " + composition.SelectedProxy);
|
||||
new Program().Run(composition, "generated", root);
|
||||
var generatedLocation = Path.GetFullPath(Path.Combine(root, "Generated"));
|
||||
|
||||
var name = Environment.GetEnvironmentVariable("BTCPAYGEN_SUBNAME");
|
||||
name = string.IsNullOrEmpty(name) ? "generated" : name;
|
||||
new Program().Run(composition, name, generatedLocation);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user