diff options
author | Griffin Smith <grfn@gws.fyi> | 2021-11-07T22·01-0500 |
---|---|---|
committer | grfn <grfn@gws.fyi> | 2021-11-07T23·02+0000 |
commit | e9c3d2f6d91129d173f4f94b4fa3d8269480094c (patch) | |
tree | 9db885c95badf4db02994b6f61e0961625ce5589 /users/grfn/xanthous/server | |
parent | 5327d238e3f292e8c5d9b161df1ee3b56665aa96 (diff) |
feat(gs/mugwump): Run xanthous server r/3021
Add a nixos module for running the xanthous server in a docker container, and install it on mugwump including a prometheus scrape config. Change-Id: Ifeb315845b7eef2ee33af98fa3f71acdd3d9fe6b Reviewed-on: https://cl.tvl.fyi/c/depot/+/3812 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'users/grfn/xanthous/server')
-rw-r--r-- | users/grfn/xanthous/server/docker.nix | 2 | ||||
-rw-r--r-- | users/grfn/xanthous/server/module.nix | 41 |
2 files changed, 41 insertions, 2 deletions
diff --git a/users/grfn/xanthous/server/docker.nix b/users/grfn/xanthous/server/docker.nix index e6054a66d28a..a62943c2b077 100644 --- a/users/grfn/xanthous/server/docker.nix +++ b/users/grfn/xanthous/server/docker.nix @@ -6,7 +6,6 @@ let inherit (depot.users.grfn) xanthous; xanthous-server = xanthous.server; - in pkgs.dockerTools.buildLayeredImage { name = "xanthous-server"; tag = "latest"; @@ -17,5 +16,4 @@ in pkgs.dockerTools.buildLayeredImage { "--xanthous-binary-path" "${xanthous}/bin/xanthous" ]; }; - ci = false; } diff --git a/users/grfn/xanthous/server/module.nix b/users/grfn/xanthous/server/module.nix new file mode 100644 index 000000000000..11adda955d2c --- /dev/null +++ b/users/grfn/xanthous/server/module.nix @@ -0,0 +1,41 @@ +{ config, lib, pkgs, depot, ... }: + +let + cfg = config.services.xanthous-server; +in { + options = with lib; { + services.xanthous-server = { + enable = mkEnableOption "xanthous server"; + + port = mkOption { + type = types.int; + default = 2222; + description = "Port to listen to for SSH connections"; + }; + + metricsPort = mkOption { + type = types.int; + default = 9000; + description = "Port to listen to for prometheus metrics"; + }; + + image = mkOption { + type = types.package; + default = depot.users.grfn.xanthous.server.docker; + description = "OCI image file to run"; + }; + }; + }; + + config = lib.mkIf cfg.enable { + virtualisation.oci-containers.containers."xanthous-server" = { + autoStart = true; + image = "${cfg.image.imageName}:${cfg.image.imageTag}"; + imageFile = cfg.image; + ports = [ + "${toString cfg.port}:22" + "${toString cfg.metricsPort}:9000" + ]; + }; + }; +} |