diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-07 15:22:35 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2018-12-07 15:22:35 +0100 |
commit | 5f554279ec31e8d42266a3f4477035fa8e43a5c7 (patch) | |
tree | 0edb6eea939ec15ed533ca44b4d26ff4b97aea21 /nixos/modules/services/databases | |
parent | 13ee78018cc0ebb8ff0ae25b6d86c9c273fd55b9 (diff) | |
parent | cb2a447c510848c925977c0ecc440eef7443c12f (diff) | |
download | nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.gz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.bz2 nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.lz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.xz nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.tar.zst nixlib-5f554279ec31e8d42266a3f4477035fa8e43a5c7.zip |
Merge master into staging-next
Diffstat (limited to 'nixos/modules/services/databases')
-rw-r--r-- | nixos/modules/services/databases/cockroachdb.nix | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/nixos/modules/services/databases/cockroachdb.nix b/nixos/modules/services/databases/cockroachdb.nix index 8de1e78633d5..e977751b21ef 100644 --- a/nixos/modules/services/databases/cockroachdb.nix +++ b/nixos/modules/services/databases/cockroachdb.nix @@ -13,7 +13,7 @@ let [ # Basic startup "${crdb}/bin/cockroach start" "--logtostderr" - "--store=${cfg.dataDir}" + "--store=/var/lib/cockroachdb" (ifNotNull cfg.locality "--locality='${cfg.locality}'") # WebUI settings @@ -41,7 +41,7 @@ let }; port = mkOption { - type = types.int; + type = types.port; default = defaultPort; description = "Port to bind to for ${descr}"; }; @@ -70,10 +70,12 @@ in like datacenter. The tiers and order must be the same on all nodes. Including more tiers is better than including fewer. For example: + <literal> country=us,region=us-west,datacenter=us-west-1b,rack=12 country=ca,region=ca-east,datacenter=ca-east-2,rack=4 planet=earth,province=manitoba,colo=secondary,power=3 + </literal> ''; }; @@ -83,12 +85,6 @@ in description = "The addresses for connecting the node to a cluster."; }; - dataDir = mkOption { - type = types.path; - default = "/var/lib/cockroachdb"; - description = "Location where CockroachDB stores its table files"; - }; - insecure = mkOption { type = types.bool; default = false; @@ -126,9 +122,12 @@ in The total size for caches. This can be a percentage, expressed with a fraction sign or as a - decimal-point number, or any bytes-based unit. For example, "25%", - "0.25" both represent 25% of the available system memory. The values - "1000000000" and "1GB" both represent 1 gigabyte of memory. + decimal-point number, or any bytes-based unit. For example, + <literal>"25%"</literal>, <literal>"0.25"</literal> both represent + 25% of the available system memory. The values + <literal>"1000000000"</literal> and <literal>"1GB"</literal> both + represent 1 gigabyte of memory. + ''; }; @@ -140,9 +139,11 @@ in data for SQL queries. This can be a percentage, expressed with a fraction sign or as a - decimal-point number, or any bytes-based unit. For example, "25%", - "0.25" both represent 25% of the available system memory. The values - "1000000000" and "1GB" both represent 1 gigabyte of memory. + decimal-point number, or any bytes-based unit. For example, + <literal>"25%"</literal>, <literal>"0.25"</literal> both represent + 25% of the available system memory. The values + <literal>"1000000000"</literal> and <literal>"1GB"</literal> both + represent 1 gigabyte of memory. ''; }; @@ -193,27 +194,21 @@ in requires = [ "time-sync.target" ]; wantedBy = [ "multi-user.target" ]; - unitConfig.RequiresMountsFor = "${cfg.dataDir}"; - - preStart = '' - if ! test -e ${cfg.dataDir}; then - mkdir -m 0700 -p ${cfg.dataDir} - chown -R ${cfg.user} ${cfg.dataDir} - fi - ''; + unitConfig.RequiresMountsFor = "/var/lib/cockroachdb"; serviceConfig = { ExecStart = startupCommand; Type = "notify"; User = cfg.user; - PermissionsStartOnly = true; + StateDirectory = "cockroachdb"; + StateDirectoryMode = "0700"; Restart = "always"; - TimeoutStopSec="60"; - RestartSec="10"; - StandardOutput="syslog"; - StandardError="syslog"; - SyslogIdentifier="cockroach"; + + # A conservative-ish timeout is alright here, because for Type=notify + # cockroach will send systemd pings during startup to keep it alive + TimeoutStopSec = 60; + RestartSec = 10; }; }; }; |