Browse Source

add in fragments and additional fragments related to traefik

feature/auto_ssh
Andrew Camilleri 6 years ago
parent
commit
16cd65c37f
  1. 10
      docker-compose-generator/docker-fragments/traefik-labels.yml
  2. 21
      docker-compose-generator/docker-fragments/traefik.yml
  3. 9
      docker-compose-generator/src/DockerComposition.cs
  4. 9
      docker-compose-generator/src/Program.cs
  5. 29
      docker-compose-generator/src/docker-compose-generator.csproj

10
docker-compose-generator/docker-fragments/traefik-labels.yml

@ -0,0 +1,10 @@
version: "3"
services:
btcpayserver:
labels:
- "traefik.backend=btcpayserver"
- "traefik.backend.loadbalancer.sticky=true"
- "traefik.enable=true"
- "traefik.frontend.rule=Host:${BTCPAY_HOST}"
- "traefik.port.rule=49392"

21
docker-compose-generator/docker-fragments/traefik.yml

@ -0,0 +1,21 @@
version: "3"
services:
traefik:
restart: unless-stopped
image: traefik
container_name: traefik
ports:
- "80:80"
- "443:443"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./traefik.toml:/traefik.toml"
- "./acme.json:/acme.json"
- "./servers.toml:/servers.toml"
- "./traefik_logs:/traefik_logs"
links:
- btcpayserver
volumes:
traefik_logs:

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

@ -42,6 +42,15 @@ 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;
}
}

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

@ -19,7 +19,7 @@ namespace DockerGenerator
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", "emit-traefik-labels" })
foreach(var proxy in new[] { "nginx", "no-reverseproxy", "traefik" })
{
foreach(var lightning in new[] { "clightning", "" })
{
@ -40,6 +40,10 @@ 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);
}
}
@ -74,12 +78,9 @@ namespace DockerGenerator
fragments.Add("nginx");
break;
case "traefik":
fragments.Add("traefik");
break;
case "emit-traefik-labels":
case "no-reverseproxy":
fragments.Add("btcpayserver-noreverseproxy");
break;
}

29
docker-compose-generator/src/docker-compose-generator.csproj

@ -10,4 +10,33 @@
<PackageReference Include="YamlDotNet" Version="4.3.1" />
</ItemGroup>
<ItemGroup>
<Content Include="..\docker-fragments\.gitignore" />
<Content Include="..\docker-fragments\bgold-lnd.yml" />
<Content Include="..\docker-fragments\bgold.yml" />
<Content Include="..\docker-fragments\bitcoin-clightning.yml" />
<Content Include="..\docker-fragments\bitcoin-lnd.yml" />
<Content Include="..\docker-fragments\bitcoin.yml" />
<Content Include="..\docker-fragments\btcpayserver-noreverseproxy.yml" />
<Content Include="..\docker-fragments\btcpayserver.yml" />
<Content Include="..\docker-fragments\feathercoin.yml" />
<Content Include="..\docker-fragments\groestlcoin.yml" />
<Content Include="..\docker-fragments\litecoin-clightning.yml" />
<Content Include="..\docker-fragments\litecoin-lnd.yml" />
<Content Include="..\docker-fragments\litecoin.yml" />
<Content Include="..\docker-fragments\nginx.yml" />
<Content Include="..\docker-fragments\opt-lnd-autopilot.yml" />
<Content Include="..\docker-fragments\opt-save-storage-s.yml" />
<Content Include="..\docker-fragments\opt-save-storage-xs.yml" />
<Content Include="..\docker-fragments\opt-save-storage-xxs.yml" />
<Content Include="..\docker-fragments\opt-save-storage.yml" />
<Content Include="..\docker-fragments\traefik-labels.yml">
<Link>opt-save-storage.yml</Link>
</Content>
<Content Include="..\docker-fragments\traefik.yml">
<Link>nginx.yml</Link>
</Content>
<Content Include="..\docker-fragments\viacoin.yml" />
</ItemGroup>
</Project>

Loading…
Cancel
Save