Browse Source

Merge branch 'master' of https://github.com/btcpayserver/btcpayserver-docker

# Conflicts:
#	docker-compose-generator/src/Program.cs
migrate-pregen
vutov 7 years ago
parent
commit
a8a252915f
  1. 1
      .gitignore
  2. 1
      Generated/.gitignore
  3. 4
      Production-NoReverseProxy/docker-compose.btc-clightning.yml
  4. 6
      Production-NoReverseProxy/docker-compose.btc-ltc-clightning.yml
  5. 2
      Production-NoReverseProxy/docker-compose.btc-ltc.yml
  6. 2
      Production-NoReverseProxy/docker-compose.btc.yml
  7. 4
      Production-NoReverseProxy/docker-compose.ltc-clightning.yml
  8. 2
      Production-NoReverseProxy/docker-compose.ltc.yml
  9. 4
      Production/docker-compose.btc-clightning.yml
  10. 6
      Production/docker-compose.btc-ltc-clightning.yml
  11. 2
      Production/docker-compose.btc-ltc.yml
  12. 2
      Production/docker-compose.btc.yml
  13. 4
      Production/docker-compose.ltc-clightning.yml
  14. 2
      Production/docker-compose.ltc.yml
  15. 53
      README.md
  16. 2
      build-pregen.ps1
  17. 2
      build-pregen.sh
  18. 17
      build.ps1
  19. 18
      build.sh
  20. 6
      docker-compose-generator/Dockerfile
  21. 2
      docker-compose-generator/docker-fragments/bitcoin-clightning.yml
  22. 2
      docker-compose-generator/docker-fragments/btcpayserver.yml
  23. 2
      docker-compose-generator/docker-fragments/litecoin-clightning.yml
  24. 44
      docker-compose-generator/src/CryptoDefinition.cs
  25. 41
      docker-compose-generator/src/DockerComposition.cs
  26. 153
      docker-compose-generator/src/Program.cs
  27. 14
      docker-compose-generator/src/Properties/launchSettings.json

1
.gitignore

@ -295,3 +295,4 @@ BTCPayServer/wwwroot/bundles/*
Production/.env
.env
.vscode/

1
Generated/.gitignore

@ -0,0 +1 @@
*.yml

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -67,7 +67,7 @@ services:
volumes:
- "bitcoin_datadir:/data"
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -75,7 +75,7 @@ services:
volumes:
- "litecoin_datadir:/data"
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
environment:
@ -110,7 +110,7 @@ services:
volumes:
- "bitcoin_datadir:/data"
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -67,7 +67,7 @@ services:
volumes:
- "litecoin_datadir:/data"
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

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

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -109,7 +109,7 @@ services:
volumes:
- "bitcoin_datadir:/data"
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
environment:

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

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -117,7 +117,7 @@ services:
volumes:
- "litecoin_datadir:/data"
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
environment:
@ -152,7 +152,7 @@ services:
volumes:
- "bitcoin_datadir:/data"
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
environment:

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

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

2
Production/docker-compose.btc.yml

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

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

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:
@ -109,7 +109,7 @@ services:
volumes:
- "litecoin_datadir:/data"
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
environment:

2
Production/docker-compose.ltc.yml

@ -46,7 +46,7 @@ services:
- nginx-gen
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

53
README.md

@ -71,3 +71,56 @@ 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`:
Note: The first run might take a while, but next run are instantaneous.
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="clightning" \
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!

2
generate-docker-compose.ps1 → 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 run -v "$(Get-Location)\Production:/app/Production" -v "$(Get-Location)\Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm 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
generate-docker-compose.sh → build-pregen.sh

@ -2,4 +2,4 @@
# 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)/Production:/app/Production" -v "$(pwd)/Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator
docker run -v "$(pwd)/Production:/app/Production" -v "$(pwd)/Production-NoReverseProxy:/app/Production-NoReverseProxy" --rm btcpayserver/docker-compose-generator pregen

17
build.ps1

@ -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

@ -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

6
docker-compose-generator/Dockerfile

@ -1,4 +1,4 @@
FROM microsoft/aspnetcore-build:2.0.6-2.1.101-stretch AS builder
FROM microsoft/dotnet:2.1.300-rc1-sdk-alpine3.7 AS builder
WORKDIR /source
COPY src/docker-compose-generator.csproj docker-compose-generator.csproj
# Cache some dependencies
@ -6,13 +6,15 @@ RUN dotnet restore
COPY src/. .
RUN dotnet publish --output /app/ --configuration Release
FROM microsoft/aspnetcore:2.0.6-stretch
FROM microsoft/dotnet:2.1.0-rc1-runtime-alpine3.7
WORKDIR /app
RUN mkdir /datadir
ENV APP_DATADIR=/datadir
VOLUME /datadir
ENV INSIDE_CONTAINER=1
COPY --from=builder "/app" .
COPY docker-fragments docker-fragments

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

@ -2,7 +2,7 @@ version: "3"
services:
clightning_bitcoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_bitcoin
restart: always
environment:

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

@ -4,7 +4,7 @@ services:
btcpayserver:
restart: always
image: nicolasdorier/btcpayserver:1.0.2.18
image: nicolasdorier/btcpayserver:1.0.2.21
expose:
- "49392"
environment:

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

@ -2,7 +2,7 @@ version: "3"
services:
clightning_litecoin:
image: nicolasdorier/clightning:0.0.0.14
image: nicolasdorier/clightning:0.0.0.16
container_name: btcpayserver_clightning_litecoin
restart: always
environment:

44
docker-compose-generator/src/CryptoDefinition.cs

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DockerGenerator
{
public class CryptoDefinition
{
public string Crypto
{
get;
private set;
}
public string CryptoFragment
{
get;
private set;
}
public string CLightningFragment
{
get;
private set;
}
public static CryptoDefinition[] GetDefinitions()
{
return new[]
{
new CryptoDefinition()
{
Crypto = "ltc",
CryptoFragment = "litecoin",
CLightningFragment = "litecoin-clightning",
},
new CryptoDefinition()
{
Crypto = "btc",
CryptoFragment = "bitcoin",
CLightningFragment = "bitcoin-clightning",
},
};
}
}
}

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

@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DockerGenerator
{
public class DockerComposition
{
public HashSet<string> SelectedCryptos
{
get;
set;
}
public string SelectedProxy
{
get;
set;
}
public string SelectedLN
{
get;
set;
}
public static DockerComposition FromEnvironmentVariables()
{
DockerComposition composition = new DockerComposition();
composition.SelectedCryptos = new HashSet<string>();
for(int i = 1; i < 10; i++)
{
var selectedCrypto = Environment.GetEnvironmentVariable("BTCPAYGEN_CRYPTO" + i);
if(string.IsNullOrEmpty(selectedCrypto))
continue;
composition.SelectedCryptos.Add(selectedCrypto.ToLowerInvariant());
}
composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant();
composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant();
return composition;
}
}
}

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

@ -8,112 +8,103 @@ namespace DockerGenerator
{
class Program
{
static void Main(string[] args)
{
new Program().Run();
}
private void Run()
static void Main(string[] args)
{
var fragmentLocation = FindLocation("docker-fragments");
var productionLocation = FindLocation("Production");
var testLocation = FindLocation("Production-NoReverseProxy");
var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? FindRoot("app")
: Path.GetFullPath(Path.Combine(FindRoot("docker-compose-generator"), ".."));
HashSet<string> processed = new HashSet<string>();
foreach(var permutation in ItemCombinations(new[] { "btc", "ltc", "clightning", "btg" }.ToList()))
if(args.Any(a => a == "pregen"))
{
if(permutation.Count == 1 && permutation.First() == "clightning")
continue;
permutation.Sort();
if(permutation.Remove("clightning"))
permutation.Add("clightning"); // ensure clightning at the end
string id = string.Join('-', permutation);
if(!processed.Add(id))
continue;
var productionLocation = Path.GetFullPath(Path.Combine(root, "Production"));
var testLocation = Path.GetFullPath(Path.Combine(root, "Production-NoReverseProxy"));
var fragments = new List<string>();
fragments.Add("nginx");
fragments.Add("btcpayserver");
if(permutation.Contains("ltc"))
{
fragments.Add("litecoin");
if(permutation.Contains("clightning"))
fragments.Add("litecoin-clightning");
}
if(permutation.Contains("btc"))
foreach(var proxy in new[] { "nginx", "no-reverseproxy" })
{
fragments.Add("bitcoin");
if(permutation.Contains("clightning"))
fragments.Add("bitcoin-clightning");
foreach(var lightning in new[] { "clightning", "" })
{
foreach(var btc in new[] { "btc", "" })
{
foreach(var ltc in new[] { "ltc", "" })
{
if(btc == "" && ltc == "")
continue;
string name = $"{btc}-{ltc}-{lightning}".Replace("--", "-");
if(name.EndsWith("-"))
name = name.Substring(0, name.Length - 1);
if(name.StartsWith("-"))
name = name.Substring(1, name.Length - 1);
var composition = new DockerComposition();
composition.SelectedCryptos = new HashSet<string>();
composition.SelectedCryptos.Add(btc);
composition.SelectedCryptos.Add(ltc);
composition.SelectedLN = lightning;
composition.SelectedProxy = proxy;
new Program().Run(composition, name, proxy == "nginx" ? productionLocation : testLocation);
}
}
}
}
if (permutation.Contains("btg"))
{
fragments.Add("bitcoingold");
}
var def = new DockerComposeDefinition(id, fragments);
def.FragmentLocation = fragmentLocation;
def.BuildOutputDirectory = productionLocation;
def.Build();
}
else
{
var composition = DockerComposition.FromEnvironmentVariables();
Console.WriteLine("Crypto: " + string.Join(", ", composition.SelectedCryptos.ToArray()));
Console.WriteLine("Lightning: " + composition.SelectedLN);
Console.WriteLine("ReverseProxy: " + composition.SelectedProxy);
var generatedLocation = Path.GetFullPath(Path.Combine(root, "Generated"));
def.Fragments.Remove("nginx");
def.Fragments.Add("btcpayserver-noreverseproxy");
def.BuildOutputDirectory = testLocation;
def.Build();
var name = Environment.GetEnvironmentVariable("BTCPAYGEN_SUBNAME");
name = string.IsNullOrEmpty(name) ? "generated" : name;
new Program().Run(composition, name, generatedLocation);
}
}
/// <summary>
/// Method to create lists containing possible combinations of an input list of items. This is
/// basically copied from code by user "jaolho" on this thread:
/// http://stackoverflow.com/questions/7802822/all-possible-combinations-of-a-list-of-values
/// </summary>
/// <typeparam name="T">type of the items on the input list</typeparam>
/// <param name="inputList">list of items</param>
/// <param name="minimumItems">minimum number of items wanted in the generated combinations,
/// if zero the empty combination is included,
/// default is one</param>
/// <param name="maximumItems">maximum number of items wanted in the generated combinations,
/// default is no maximum limit</param>
/// <returns>list of lists for possible combinations of the input items</returns>
public static List<List<T>> ItemCombinations<T>(List<T> inputList, int minimumItems = 1,
int maximumItems = int.MaxValue)
private void Run(DockerComposition composition, string name, string output)
{
int nonEmptyCombinations = (int)Math.Pow(2, inputList.Count) - 1;
List<List<T>> listOfLists = new List<List<T>>(nonEmptyCombinations + 1);
if(minimumItems == 0) // Optimize default case
listOfLists.Add(new List<T>());
var fragmentLocation = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? "app" : "docker-compose-generator";
fragmentLocation = FindRoot(fragmentLocation);
fragmentLocation = Path.GetFullPath(Path.Combine(fragmentLocation, "docker-fragments"));
for(int i = 1; i <= nonEmptyCombinations; i++)
var fragments = new List<string>();
if(composition.SelectedProxy == "nginx")
{
fragments.Add("nginx");
}
else
{
List<T> thisCombination = new List<T>(inputList.Count);
for(int j = 0; j < inputList.Count; j++)
fragments.Add("btcpayserver-noreverseproxy");
}
fragments.Add("btcpayserver");
foreach(var crypto in CryptoDefinition.GetDefinitions())
{
if(!composition.SelectedCryptos.Contains(crypto.Crypto))
continue;
fragments.Add(crypto.CryptoFragment);
if(composition.SelectedLN == "clightning" && crypto.CLightningFragment != null)
{
if((i >> j & 1) == 1)
thisCombination.Add(inputList[j]);
fragments.Add(crypto.CLightningFragment);
}
if(thisCombination.Count >= minimumItems && thisCombination.Count <= maximumItems)
listOfLists.Add(thisCombination);
}
return listOfLists;
var def = new DockerComposeDefinition(name, fragments);
def.FragmentLocation = fragmentLocation;
def.BuildOutputDirectory = output;
def.Build();
}
private string FindLocation(string path)
private static string FindRoot(string rootDirectory)
{
string directory = path;
string directory = Directory.GetCurrentDirectory();
int i = 0;
while(true)
{
if(i > 10)
throw new DirectoryNotFoundException(directory);
if(Directory.Exists(path))
return path;
path = Path.Combine("..", path);
throw new DirectoryNotFoundException(rootDirectory);
if(directory.EndsWith(rootDirectory))
return directory;
directory = Path.GetFullPath(Path.Combine(directory, ".."));
i++;
}
}

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

@ -0,0 +1,14 @@
{
"profiles": {
"docker-compose-generator": {
"commandName": "Project",
"commandLineArgs": "pregen",
"environmentVariables": {
"BTCPAYGEN_LIGHTNING": "clightning",
"BTCPAYGEN_CRYPTO2": "ltc",
"BTCPAYGEN_CRYPTO1": "btc",
"BTCPAYGEN_REVERSEPROXY": "nginx"
}
}
}
}
Loading…
Cancel
Save