diff options
author | lassulus <lass@aidsballs.de> | 2015-07-23 02:26:42 +0200 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-07-23 02:26:42 +0200 |
commit | 0db3f4ee695148b60238861384b86f0fdc880459 (patch) | |
tree | 8249b4e2713aeabdf4a9d1aeee4c38e1a527e487 /3modules/tv/consul.nix | |
parent | b590d9e21d8c99a91fd419c3e0bea949a9ac6849 (diff) | |
parent | 791a7e79977de76908ab9e33eb64cbd2b02da3ed (diff) |
Merge branch 'tv' into master
Diffstat (limited to '3modules/tv/consul.nix')
-rw-r--r-- | 3modules/tv/consul.nix | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/3modules/tv/consul.nix b/3modules/tv/consul.nix index 48019845..312faa02 100644 --- a/3modules/tv/consul.nix +++ b/3modules/tv/consul.nix @@ -5,8 +5,7 @@ # TODO consul-bootstrap HOST that actually does is # TODO tools to inspect state of a cluster in outage state -with builtins; -with lib; +with import ../../4lib/tv { inherit lib pkgs; }; let cfg = config.tv.consul; @@ -24,10 +23,10 @@ let enable = mkEnableOption "tv.consul"; dc = mkOption { - type = types.unspecified; + type = types.label; }; hosts = mkOption { - type = with types; listOf unspecified; + type = with types; listOf host; }; encrypt-file = mkOption { type = types.str; # TODO path (but not just into store) @@ -38,7 +37,7 @@ let default = "/var/lib/consul"; }; self = mkOption { - type = types.unspecified; + type = types.host; }; server = mkOption { type = types.bool; @@ -56,9 +55,11 @@ let log_level = "INFO"; #node_name = server = cfg.server; - bind_addr = cfg.self.addr; # TODO cfg.addr enable_syslog = true; - retry_join = map (getAttr "addr") (filter (host: host.fqdn != cfg.self.fqdn) cfg.hosts); + retry_join = + # TODO allow consul in other nets than retiolum [maybe] + concatMap (host: host.nets.retiolum.addrs) + (filter (host: host.name != cfg.self.name) cfg.hosts); leave_on_terminate = true; } // optionalAttrs cfg.server { bootstrap_expect = length cfg.hosts; @@ -88,7 +89,7 @@ let ExecStartPre = pkgs.writeScript "consul-init" '' #! /bin/sh mkdir -p ${cfg.data-dir} - chown consul: ${cfg.data-dir} + chown ${user.name}: ${cfg.data-dir} install -o ${user.name} -m 0400 ${cfg.encrypt-file} /tmp/encrypt.json ''; ExecStart = pkgs.writeScript "consul-service" '' @@ -111,7 +112,7 @@ let user = { name = "consul"; - uid = 2983239726; # genid consul + uid = 2999951406; # genid consul }; in |