From ee2f71327d05993137cf14ef1a52a0797554769d Mon Sep 17 00:00:00 2001 From: lunik1 Date: Thu, 21 Jan 2021 23:07:52 +0100 Subject: [PATCH] Add traefik example --- examples/traefik/arion-compose.nix | 28 ++++++++++++++++++++++++++++ examples/traefik/arion-pkgs.nix | 6 ++++++ 2 files changed, 34 insertions(+) create mode 100644 examples/traefik/arion-compose.nix create mode 100644 examples/traefik/arion-pkgs.nix diff --git a/examples/traefik/arion-compose.nix b/examples/traefik/arion-compose.nix new file mode 100644 index 0000000..03cacb6 --- /dev/null +++ b/examples/traefik/arion-compose.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: { + + config.services = { + traefik.service = { + image = "traefik:v2.4"; + container_name = "traefik"; + command = [ + "--api.insecure=true" + "--providers.docker=true" + "--providers.docker.exposedbydefault=false" + "--entrypoints.web.address=:80" + ]; + ports = [ "80:80" "8080:8080" ]; + volumes = [ "/var/run/docker.sock:/var/run/docker.sock:ro" ]; + }; + + whoami.service = { + image = "traefik/whoami"; + container_name = "simple-service"; + labels = { + "traefik.enable" = "true"; + "traefik.http.routers.whoami.rule" = "Host(`whoami.localhost`)"; + "traefik.http.routers.whoami.entrypoints" = "web"; + }; + }; + }; +} + diff --git a/examples/traefik/arion-pkgs.nix b/examples/traefik/arion-pkgs.nix new file mode 100644 index 0000000..69aad13 --- /dev/null +++ b/examples/traefik/arion-pkgs.nix @@ -0,0 +1,6 @@ +# Instead of pinning Nixpkgs, we can opt to use the one in NIX_PATH +import { + # We specify the architecture explicitly. Use a Linux remote builder when + # calling arion from other platforms. + system = "x86_64-linux"; +}