1
0

more work on traefik

This commit is contained in:
Andrew Camilleri
2018-09-16 11:18:44 +02:00
parent de0eacb35c
commit 72912fabe6
14 changed files with 170 additions and 52 deletions

View File

@@ -0,0 +1,15 @@
version: "3"
services:
btcpayserver:
environment:
# NGINX settings
VIRTUAL_NETWORK: nginx-proxy
VIRTUAL_PORT: 49392
VIRTUAL_HOST: ${BTCPAY_HOST}
SSL_POLICY: Mozilla-Modern
# Let's encrypt settings
LETSENCRYPT_HOST: ${BTCPAY_HOST}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}

View File

@@ -16,16 +16,6 @@ services:
BTCPAY_ROOTPATH: ${BTCPAY_ROOTPATH:-/}
BTCPAY_SSHTRUSTEDFINGERPRINTS: ${BTCPAY_SSHTRUSTEDFINGERPRINTS}
BTCPAY_SSHKEYFILE: ${BTCPAY_SSHKEYFILE}
# NGINX settings
VIRTUAL_NETWORK: nginx-proxy
VIRTUAL_PORT: 49392
VIRTUAL_HOST: ${BTCPAY_HOST}
SSL_POLICY: Mozilla-Modern
# Let's encrypt settings
LETSENCRYPT_HOST: ${BTCPAY_HOST}
LETSENCRYPT_EMAIL: ${LETSENCRYPT_EMAIL:-<no value>}
links:
- nbxplorer
@@ -34,24 +24,5 @@ services:
- "btcpay_datadir:/datadir"
- "nbxplorer_datadir:/root/.nbxplorer"
nbxplorer:
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.31
expose:
- "32838"
environment:
NBXPLORER_NETWORK: ${NBITCOIN_NETWORK:-regtest}
NBXPLORER_BIND: 0.0.0.0:32838
volumes:
- "nbxplorer_datadir:/datadir"
postgres:
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
volumes:
postgres_datadir:
btcpay_datadir:
nbxplorer_datadir:
btcpay_datadir:

View File

@@ -0,0 +1,17 @@
version: "3"
services:
nbxplorer:
restart: unless-stopped
image: nicolasdorier/nbxplorer:1.0.2.31
expose:
- "32838"
environment:
NBXPLORER_NETWORK: ${NBITCOIN_NETWORK:-regtest}
NBXPLORER_BIND: 0.0.0.0:32838
volumes:
- "nbxplorer_datadir:/datadir"
volumes:
nbxplorer_datadir:

View File

@@ -0,0 +1,11 @@
version: "3"
services:
postgres:
restart: unless-stopped
image: postgres:9.6.5
volumes:
- "postgres_datadir:/var/lib/postgresql/data"
volumes:
postgres_datadir:

View File

@@ -42,15 +42,6 @@ namespace DockerGenerator
composition.SelectedProxy = (Environment.GetEnvironmentVariable("BTCPAYGEN_REVERSEPROXY") ?? "").ToLowerInvariant();
composition.SelectedLN = (Environment.GetEnvironmentVariable("BTCPAYGEN_LIGHTNING") ?? "").ToLowerInvariant();
composition.AdditionalFragments = (Environment.GetEnvironmentVariable("BTCPAYGEN_ADDITIONAL_FRAGMENTS") ?? "").ToLowerInvariant().Split(';').Where(t => !string.IsNullOrWhiteSpace(t)).ToArray();
if (composition.SelectedProxy == "traefik" && !composition.AdditionalFragments.Contains("traefik-labels"))
{
var additionalFragments = new List<string>();
additionalFragments.AddRange(composition.AdditionalFragments);
additionalFragments.Add("traefik-labels");
composition.AdditionalFragments = additionalFragments.ToArray();
}
return composition;
}
}

View File

@@ -8,18 +8,21 @@ namespace DockerGenerator
{
class Program
{
static void Main(string[] args)
{
var root = Environment.GetEnvironmentVariable("INSIDE_CONTAINER") == "1" ? FindRoot("app")
: Path.GetFullPath(Path.Combine(FindRoot("docker-compose-generator"), ".."));
Dictionary<string,string> ProxyMapping = new Dictionary<string, string>()
{
{"nginx", Path.GetFullPath(Path.Combine(root, "Production"))},
{"no-reverseproxy", Path.GetFullPath(Path.Combine(root, "Production-NoReverseProxy"))},
{"traefik", Path.GetFullPath(Path.Combine(root, "Production-Traefik"))}
};
if(args.Any(a => a == "pregen"))
{
var productionLocation = Path.GetFullPath(Path.Combine(root, "Production"));
var testLocation = Path.GetFullPath(Path.Combine(root, "Production-NoReverseProxy"));
foreach(var proxy in new[] { "nginx", "no-reverseproxy", "traefik" })
foreach(var proxy in ProxyMapping.Keys)
{
foreach(var lightning in new[] { "clightning", "" })
{
@@ -40,11 +43,7 @@ namespace DockerGenerator
composition.SelectedCryptos.Add(ltc);
composition.SelectedLN = lightning;
composition.SelectedProxy = proxy;
if (composition.SelectedProxy == "traefik")
{
composition.AdditionalFragments = new []{"traefik-labels"};
}
new Program().Run(composition, name, new string[] {"nginx", "traefik"}.Contains(proxy)? productionLocation : testLocation);
new Program().Run(composition, name, ProxyMapping[proxy]);
}
}
}
@@ -76,15 +75,19 @@ namespace DockerGenerator
case "nginx":
fragments.Add("nginx");
fragments.Add("btcpayserver-nginx");
break;
case "traefik":
fragments.Add("traefik");
fragments.Add("traefik-labels");
break;
case "no-reverseproxy":
fragments.Add("btcpayserver-noreverseproxy");
break;
}
fragments.Add("btcpayserver");
fragments.Add("nbxplorer");
fragments.Add("postgres");
foreach(var crypto in CryptoDefinition.GetDefinitions())
{
if(!composition.SelectedCryptos.Contains(crypto.Crypto))