Browse Source

Merge branch 'master' into dcg-latest

feature/auto_ssh
nicolas.dorier 6 years ago
parent
commit
640e70c661
  1. 27
      Production/nginx.tmpl
  2. 9
      README.md
  3. 27
      btcpay-setup.sh
  4. 8
      btcpay-update.sh
  5. 1
      build.ps1
  6. 1
      build.sh
  7. 15
      contrib/DockerFileBuildHelper/Program.cs
  8. 70
      contrib/build-all-images.sh
  9. 2
      docker-compose-generator/docker-fragments/bitcoin-lnd.yml
  10. 4
      docker-compose-generator/docker-fragments/btcpayserver.yml
  11. 2
      docker-compose-generator/docker-fragments/litecoin-lnd.yml
  12. 19
      docker-compose-generator/docker-fragments/mysql.yml
  13. 32
      docker-compose-generator/docker-fragments/opt-add-btcqbo.yml
  14. 5
      docker-compose-generator/docker-fragments/postgres.yml
  15. 7
      docker-compose-generator/src/DockerComposition.cs
  16. 18
      docker-compose-generator/src/Program.cs
  17. 3
      docker-compose-generator/src/Properties/launchSettings.json

27
Production/nginx.tmpl

@ -301,13 +301,26 @@ server {
{{ range $container := $ }}
{{ $serviceName := (index $container.Labels "com.docker.compose.service") }}
{{ if (eq $serviceName "lnd_bitcoin") }}
location /lnrpc.Lightning {
grpc_pass grpcs://lnd_bitcoin:10009;
}
location /lnd-rest/btc/ {
rewrite ^/lnd-rest/btc/(.*) /$1 break;
proxy_pass http://lnd_bitcoin:8080/;
}
location /lnrpc.Lightning {
grpc_pass grpcs://lnd_bitcoin:10009;
}
location /lnd-rest/btc/ {
rewrite ^/lnd-rest/btc/(.*) /$1 break;
proxy_pass http://lnd_bitcoin:8080/;
}
{{ end }}
{{ end }}
{{ range $container := $ }}
{{ $serviceName := (index $container.Labels "com.docker.compose.service") }}
{{ if (eq $serviceName "btcqbo") }}
location /btcqbo/ {
proxy_pass http://btcqbo:8001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
{{ end }}
{{ end }}
}

9
README.md

@ -117,6 +117,7 @@ You can read [the article](https://medium.com/@BtcpayServer/hosting-btcpay-serve
* `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`, `(empty)`)
* `BTCPAYGEN_DATABASE`: Database Engine to use(eg. `postgres`, `mysql`, `sqlite`. Default: `postgres`)
* `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. `me@example.com`)
@ -227,13 +228,7 @@ 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 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')"
export BTCPAY_SSHKEYFILE="$(cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_SSHKEYFILE=\(.*\)$/\1/p')"
export BTCPAY_SSHTRUSTEDFINGERPRINTS="$(cat $BTCPAY_ENV_FILE | sed -n 's/^BTCPAY_SSHTRUSTEDFINGERPRINTS=\(.*\)$/\1/p')"
export $(grep -v '^#' "$BTCPAY_ENV_FILE" | xargs)
fi
```

27
btcpay-setup.sh

@ -57,6 +57,7 @@ Environment variables:
BTCPAYGEN_CRYPTON: N th supported crypto currency where N is maximum at maximum 9. (Default: none)
BTCPAYGEN_REVERSEPROXY: Whether to use or not a reverse proxy. NGinx setup HTTPS for you. (eg. nginx, traefik, none. Default: nginx)
BTCPAYGEN_LIGHTNING: Lightning network implementation to use (eg. clightning, lnd, none)
BTCPAYGEN_DATABASE: Database Engine to use(eg. postgres, mysql, sqlite. Default: postgres)
BTCPAYGEN_ADDITIONAL_FRAGMENTS: Semi colon separated list of additional fragments you want to use (eg. opt-save-storage)
ACME_CA_URI: The API endpoint to ask for HTTPS certificate (default: https://acme-v01.api.letsencrypt.org/directory)
BTCPAY_HOST_SSHKEYFILE: Optional, SSH private key that BTCPay can use to connect to this VM's SSH server. This key will be copied on BTCPay's data directory
@ -70,6 +71,15 @@ if [ "$1" != "-i" ]; then
return
fi
if [ -z "$BTCPAY_HOST" ]; then
if [ -f "/etc/profile.d/btcpay-env.sh" ]; then
echo "This script must be run as root after running \"sudo su -\""
else
echo "BTCPAY_HOST should not be empty"
fi
return
fi
######### Migration: old pregen environment to new environment ############
if [ ! -z $BTCPAY_DOCKER_COMPOSE ] && [ ! -z $DOWNLOAD_ROOT ] && [ -z $BTCPAYGEN_OLD_PREGEN ]; then
echo "Your deployment is too old, you need to migrate by following instructions on this link https://github.com/btcpayserver/btcpayserver-docker/tree/master#i-deployed-before-btcpay-setupsh-existed-before-may-17-can-i-migrate-to-this-new-system"
@ -85,6 +95,7 @@ fi
: "${BTCPAYGEN_CRYPTO1:=btc}"
: "${BTCPAYGEN_REVERSEPROXY:=nginx}"
: "${BTCPAYGEN_LIGHTNING:=none}"
: "${BTCPAYGEN_DATABASE:=postgres}"
: "${ACME_CA_URI:=https://acme-v01.api.letsencrypt.org/directory}"
OLD_BTCPAY_DOCKER_COMPOSE=$BTCPAY_DOCKER_COMPOSE
@ -143,6 +154,7 @@ BTCPAYGEN_CRYPTO8:$BTCPAYGEN_CRYPTO8
BTCPAYGEN_CRYPTO9:$BTCPAYGEN_CRYPTO9
BTCPAYGEN_REVERSEPROXY:$BTCPAYGEN_REVERSEPROXY
BTCPAYGEN_LIGHTNING:$BTCPAYGEN_LIGHTNING
BTCPAYGEN_DATABASE:$BTCPAYGEN_DATABASE
BTCPAYGEN_ADDITIONAL_FRAGMENTS:$BTCPAYGEN_ADDITIONAL_FRAGMENTS
BTCPAY_IMAGE:$BTCPAY_IMAGE
ACME_CA_URI:$ACME_CA_URI
@ -157,11 +169,6 @@ BTCPAY_SSHTRUSTEDFINGERPRINTS:$BTCPAY_SSHTRUSTEDFINGERPRINTS
----------------------
"
if [ -z "$BTCPAY_HOST" ]; then
echo "BTCPAY_HOST should not be empty"
return
fi
if [ -z "$BTCPAYGEN_CRYPTO1" ]; then
echo "BTCPAYGEN_CRYPTO1 should not be empty"
return
@ -186,6 +193,7 @@ export BTCPAYGEN_CRYPTO7=\"$BTCPAYGEN_CRYPTO7\"
export BTCPAYGEN_CRYPTO8=\"$BTCPAYGEN_CRYPTO8\"
export BTCPAYGEN_CRYPTO9=\"$BTCPAYGEN_CRYPTO9\"
export BTCPAYGEN_LIGHTNING=\"$BTCPAYGEN_LIGHTNING\"
export BTCPAYGEN_DATABASE=\"$BTCPAYGEN_DATABASE\"
export BTCPAYGEN_REVERSEPROXY=\"$BTCPAYGEN_REVERSEPROXY\"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS=\"$BTCPAYGEN_ADDITIONAL_FRAGMENTS\"
export BTCPAY_DOCKER_COMPOSE=\"$BTCPAY_DOCKER_COMPOSE\"
@ -291,6 +299,15 @@ ExecReload=/bin/bash -c '. /etc/profile.d/btcpay-env.sh && cd \"\$(dirname \$BTC
[Install]
WantedBy=multi-user.target" > /etc/systemd/system/btcpayserver.service
if ! [ -f "/etc/docker/daemon.json" ]; then
echo "{
\"log-driver\": \"json-file\",
\"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"}
}" > /etc/docker/daemon.json
echo "Setting limited log files in /etc/docker/daemon.json"
systemctl restart docker
fi
echo -e "BTCPay Server systemd configured in /etc/systemd/system/btcpayserver.service\n"
echo "BTCPay Server starting... this can take 5 to 10 minutes..."
systemctl daemon-reload

8
btcpay-update.sh

@ -17,6 +17,14 @@ fi
cd "$BTCPAY_BASE_DIRECTORY/btcpayserver-docker"
git pull --force
if ! [ -f "/etc/docker/daemon.json" ]; then
echo "{
\"log-driver\": \"json-file\",
\"log-opts\": {\"max-size\": \"5m\", \"max-file\": \"3\"}
}" > /etc/docker/daemon.json
echo "Setting limited log files in /etc/docker/daemon.json"
fi
. ./build.sh
if [ "$BTCPAYGEN_OLD_PREGEN" == "true" ]; then
cp Generated/docker-compose.generated.yml $BTCPAY_DOCKER_COMPOSE

1
build.ps1

@ -22,6 +22,7 @@ docker run -v "$(Get-Location)\Generated:/app/Generated" `
-e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" `
-e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" `
-e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" `
-e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" `
-e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" `
--rm $BTCPAYGEN_DOCKER_IMAGE

1
build.sh

@ -23,6 +23,7 @@ docker run -v "$(pwd)/Generated:/app/Generated" \
-e "BTCPAYGEN_REVERSEPROXY=$BTCPAYGEN_REVERSEPROXY" \
-e "BTCPAYGEN_ADDITIONAL_FRAGMENTS=$BTCPAYGEN_ADDITIONAL_FRAGMENTS" \
-e "BTCPAYGEN_LIGHTNING=$BTCPAYGEN_LIGHTNING" \
-e "BTCPAYGEN_DATABASE=$BTCPAYGEN_DATABASE" \
-e "BTCPAYGEN_SUBNAME=$BTCPAYGEN_SUBNAME" \
--rm $BTCPAYGEN_DOCKER_IMAGE

15
contrib/DockerFileBuildHelper/Program.cs

@ -181,9 +181,10 @@ namespace DockerFileBuildHelper
dockerInfo.GitRef = $"basedon-{image.Tag}";
break;
case "lnd":
dockerInfo.DockerFilePath = "BTCPayServer.Dockerfile";
dockerInfo.DockerFilePath = "linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = "linuxarm32v7.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/lnd";
dockerInfo.GitRef = $"basedon-v{image.Tag}";
dockerInfo.GitRef = $"basedon-{image.Tag}";
break;
case "bitcoin":
dockerInfo.DockerFilePath = $"Bitcoin/{image.Tag}/linuxamd64.Dockerfile";
@ -263,6 +264,16 @@ namespace DockerFileBuildHelper
dockerInfo.GitLink = "https://github.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "btcqbo":
dockerInfo.DockerFilePath = $"Dockerfile";
dockerInfo.GitLink = "https://github.com/JeffVandrewJr/btcqbo";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "redis":
dockerInfo.DockerFilePath = $"5.0/Dockerfile";
dockerInfo.GitLink = "https://github.com/docker-library/redis";
dockerInfo.GitRef = $"f1a8498333ae3ab340b5b39fbac1d7e1dc0d628c";
break;
case "postgres":
dockerInfo.DockerFilePath = $"9.6/Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"9.6/Dockerfile";

70
contrib/build-all-images.sh

@ -71,14 +71,16 @@ cd - && cd ..
# Build lnd
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile
DOCKERFILE="BTCPayServer.Dockerfile"
echo "Building btcpayserver/lnd:0.5-beta-2"
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-3/linuxamd64.Dockerfile
DOCKERFILE="linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-3/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile"
echo "Building btcpayserver/lnd:v0.5-beta-3"
git clone https://github.com/btcpayserver/lnd lnd
cd lnd
git checkout basedon-v0.5-beta-2
git checkout basedon-v0.5-beta-3
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" .
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:v0.5-beta-3" .
cd - && cd ..
@ -111,16 +113,16 @@ cd - && cd ..
# Build btcpayserver
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.23/Dockerfile.linuxamd64
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.24/Dockerfile.linuxamd64
DOCKERFILE="Dockerfile.linuxamd64"
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.23/Dockerfile.linuxarm32v7
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.24/Dockerfile.linuxarm32v7
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile.linuxarm32v7"
echo "Building btcpayserver/btcpayserver:1.0.3.23"
echo "Building btcpayserver/btcpayserver:1.0.3.24"
git clone https://github.com/btcpayserver/btcpayserver btcpayserver
cd btcpayserver
git checkout v1.0.3.23
git checkout v1.0.3.24
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/btcpayserver:1.0.3.23" .
docker build -f "$DOCKERFILE" -t "btcpayserver/btcpayserver:1.0.3.24" .
cd - && cd ..
@ -189,14 +191,16 @@ cd - && cd ..
# Build lnd
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile
DOCKERFILE="BTCPayServer.Dockerfile"
echo "Building btcpayserver/lnd:0.5-beta-2"
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-3/linuxamd64.Dockerfile
DOCKERFILE="linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-3/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile"
echo "Building btcpayserver/lnd:v0.5-beta-3"
git clone https://github.com/btcpayserver/lnd lnd
cd lnd
git checkout basedon-v0.5-beta-2
git checkout basedon-v0.5-beta-3
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" .
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:v0.5-beta-3" .
cd - && cd ..
@ -278,6 +282,42 @@ docker build -f "$DOCKERFILE" -t "btcpayserver/letsencrypt-nginx-proxy-companion
cd - && cd ..
# Build btcqbo
# https://raw.githubusercontent.com/JeffVandrewJr/btcqbo/v0.1.1/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building jvandrew/btcqbo:0.1.1"
git clone https://github.com/JeffVandrewJr/btcqbo btcqbo
cd btcqbo
git checkout v0.1.1
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "jvandrew/btcqbo:0.1.1" .
cd - && cd ..
# Build btcqbo
# https://raw.githubusercontent.com/JeffVandrewJr/btcqbo/v0.1.1/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building jvandrew/btcqbo:0.1.1"
git clone https://github.com/JeffVandrewJr/btcqbo btcqbo
cd btcqbo
git checkout v0.1.1
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "jvandrew/btcqbo:0.1.1" .
cd - && cd ..
# Build redis
# https://raw.githubusercontent.com/docker-library/redis/f1a8498333ae3ab340b5b39fbac1d7e1dc0d628c/5.0/Dockerfile
DOCKERFILE="5.0/Dockerfile"
echo "Building redis:5.0.2-alpine"
git clone https://github.com/docker-library/redis redis
cd redis
git checkout f1a8498333ae3ab340b5b39fbac1d7e1dc0d628c
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "redis:5.0.2-alpine" .
cd - && cd ..
# Build postgres
# https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile
DOCKERFILE="9.6/Dockerfile"

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

@ -2,7 +2,7 @@ version: "3"
services:
lnd_bitcoin:
image: btcpayserver/lnd:0.5-beta-2
image: btcpayserver/lnd:v0.5.1-beta
container_name: btcpayserver_lnd_bitcoin
restart: unless-stopped
environment:

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

@ -4,12 +4,11 @@ services:
btcpayserver:
restart: unless-stopped
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.0.3.23}
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.0.3.25}
expose:
- "49392"
environment:
# BTCPay settings
BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest}
BTCPAY_NETWORK: ${NBITCOIN_NETWORK:-regtest}
BTCPAY_BIND: 0.0.0.0:49392
BTCPAY_EXTERNALURL: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST}/
@ -19,7 +18,6 @@ services:
BTCPAY_DEBUGLOG: btcpay.log
links:
- nbxplorer
- postgres
volumes:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"

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

@ -2,7 +2,7 @@ version: "3"
services:
lnd_litecoin:
image: btcpayserver/lnd:0.5-beta-2
image: btcpayserver/lnd:v0.5.1-beta
container_name: btcpayserver_lnd_litecoin
restart: unless-stopped
environment:

19
docker-compose-generator/docker-fragments/mysql.yml

@ -0,0 +1,19 @@
version: "3"
services:
mysql:
restart: unless-stopped
image: mysql:8.0
volumes:
- "mysql_datadir:/var/lib/mysql"
environment:
- MYSQL_ALLOW_EMPTY_PASSWORD="true"
btcpayserver:
environment:
BTCPAY_MYSQL: Server=mysql;Database=btcpayserver${NBITCOIN_NETWORK:-regtest};Uid=root;Pwd=;Port=3306;
links:
- mysql
volumes:
mysql_datadir:

32
docker-compose-generator/docker-fragments/opt-add-btcqbo.yml

@ -0,0 +1,32 @@
version: "3"
services:
btcqbo:
image: jvandrew/btcqbo:0.1.2
environment:
REDIS_URL: "redis://redis:6379/0"
BTCPAY_HOST: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST}
CALLBACK_URL: ${BTCPAY_PROTOCOL:-https}://${BTCPAY_HOST}/btcqbo/qbologged
expose:
- "8001"
links:
- redis
rq-worker:
image: jvandrew/btcqbo:0.1.2
entrypoint: /usr/local/bin/rq
command: worker -u redis://redis:6379/0 btcqbo
environment:
REDIS_URL: "redis://redis:6379/0"
expose:
- "8001"
links:
- redis
redis:
image: redis:5.0.2-alpine
expose:
- "6379"
volumes:
- "redis_datadir:/data"
volumes:
redis_datadir:

5
docker-compose-generator/docker-fragments/postgres.yml

@ -6,6 +6,11 @@ services:
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
btcpayserver:
environment:
BTCPAY_POSTGRES: User ID=postgres;Host=postgres;Port=5432;Database=btcpayserver${NBITCOIN_NETWORK:-regtest}
links:
- postgres
volumes:
postgres_datadir:

7
docker-compose-generator/src/DockerComposition.cs

@ -17,6 +17,12 @@ namespace DockerGenerator
get;
set;
}
public string SelectedDatabase
{
get;
set;
}
public string SelectedLN
{
get;
@ -39,6 +45,7 @@ namespace DockerGenerator
continue;
composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant());
}
composition.SelectedDatabase = (Environment.GetEnvironmentVariable("BTCPAYGEN_DATABASE") ?? "postgtres").ToLowerInvariant();
composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant();
composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant();
composition.AdditionalFragments = (Environment.GetEnvironmentVariable("BTCPAYGEN_ADDITIONAL_FRAGMENTS") ?? "").ToLowerInvariant()

18
docker-compose-generator/src/Program.cs

@ -8,10 +8,10 @@ namespace DockerGenerator
{
class Program
{
static void Main(string[] args)
{
var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? FindRoot("app")
var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1"
? FindRoot("app")
: Path.GetFullPath(Path.Combine(FindRoot("docker-compose-generator"), ".."));
var composition = DockerComposition.FromEnvironmentVariables();
@ -27,7 +27,9 @@ namespace DockerGenerator
private void Run(DockerComposition composition, string name, string output)
{
var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator";
var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1"
? "app"
: "docker-compose-generator";
fragmentLocation = FindRoot(fragmentLocation);
fragmentLocation = Path.GetFullPath(Path.Combine(fragmentLocation, "docker-fragments"));
@ -49,9 +51,14 @@ namespace DockerGenerator
fragments.Add("btcpayserver-noreverseproxy");
break;
}
fragments.Add("btcpayserver");
fragments.Add("nbxplorer");
fragments.Add("postgres");
if (composition.SelectedDatabase != "sqlite")
{
fragments.Add(composition.SelectedDatabase);
}
foreach (var crypto in CryptoDefinition.GetDefinitions())
{
if (!composition.SelectedCryptos.Contains(crypto.Crypto))
@ -62,6 +69,7 @@ namespace DockerGenerator
{
fragments.Add(crypto.CLightningFragment);
}
if (composition.SelectedLN == "lnd" && crypto.LNDFragment != null)
{
fragments.Add(crypto.LNDFragment);
@ -94,4 +102,4 @@ namespace DockerGenerator
}
}
}
}
}

3
docker-compose-generator/src/Properties/launchSettings.json

@ -9,7 +9,8 @@
"BTCPAYGEN_CRYPTO3": "btg",
"BTCPAYGEN_CRYPTO2": "ltc",
"BTCPAYGEN_CRYPTO1": "btc",
"BTCPAYGEN_REVERSEPROXY": "nginx"
"BTCPAYGEN_REVERSEPROXY": "nginx",
"BTCPAYGEN_DATABASE": "postgres"
}
}
}

Loading…
Cancel
Save