Commit c53e5201 authored by matthewcroughan's avatar matthewcroughan Committed by Valentin Gagarin
Browse files

nixos/scion: make storing path database optional

Storing the SCION path sqlite databases persistently on disk is a valid
setup that improves performance, but may have outstanding bugs that need
to be investigated, so this makes persisent storage optional, off by
default.
parent 7e78326c
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -3,8 +3,10 @@
with lib;

let
  globalCfg = config.services.scion;
  cfg = config.services.scion.scion-control;
  toml = pkgs.formats.toml { };
  connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
  defaultConfig = {
    general = {
      id = "cs";
@@ -12,13 +14,13 @@ let
      reconnect_to_dispatcher = true;
    };
    beacon_db = {
      connection = "/run/scion-control/control.beacon.db";
      connection = "${connectionDir}/scion-control/control.beacon.db";
    };
    path_db = {
      connection = "/run/scion-control/control.path.db";
      connection = "${connectionDir}/scion-control/control.path.db";
    };
    trust_db = {
      connection = "/run/scion-control/control.trust.db";
      connection = "${connectionDir}/scion-control/control.trust.db";
    };
    log.console = {
      level = "info";
@@ -62,7 +64,7 @@ in
        DynamicUser = true;
        Restart = "on-failure";
        BindPaths = [ "/dev/shm:/run/shm" ];
        RuntimeDirectory = "scion-control";
        ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-control";
      };
    };
  };
+5 −3
Original line number Diff line number Diff line
@@ -3,8 +3,10 @@
with lib;

let
  globalCfg = config.services.scion;
  cfg = config.services.scion.scion-daemon;
  toml = pkgs.formats.toml { };
  connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
  defaultConfig = {
    general = {
      id = "sd";
@@ -12,10 +14,10 @@ let
      reconnect_to_dispatcher = true;
    };
    path_db = {
      connection = "/run/scion-daemon/sd.path.db";
      connection = "${connectionDir}/scion-daemon/sd.path.db";
    };
    trust_db = {
      connection = "/run/scion-daemon/sd.trust.db";
      connection = "${connectionDir}/scion-daemon/sd.trust.db";
    };
    log.console = {
      level = "info";
@@ -57,7 +59,7 @@ in
        ExecStart = "${pkgs.scion}/bin/scion-daemon --config ${configFile}";
        Restart = "on-failure";
        DynamicUser = true;
        RuntimeDirectory = "scion-daemon";
        ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-daemon";
      };
    };
  };
+2 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
with lib;

let
  globalCfg = config.services.scion;
  cfg = config.services.scion.scion-dispatcher;
  toml = pkgs.formats.toml { };
  defaultConfig = {
@@ -66,7 +67,7 @@ in
        ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
        ExecStart = "${pkgs.scion}/bin/scion-dispatcher --config ${configFile}";
        Restart = "on-failure";
        RuntimeDirectory = "scion-dispatcher";
        ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-dispatcher";
      };
    };
  };
+2 −1
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
with lib;

let
  globalCfg = config.services.scion;
  cfg = config.services.scion.scion-router;
  toml = pkgs.formats.toml { };
  defaultConfig = {
@@ -42,7 +43,7 @@ in
        ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
        Restart = "on-failure";
        DynamicUser = true;
        RuntimeDirectory = "scion-router";
        ${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-router";
      };
    };
  };
+16 −0
Original line number Diff line number Diff line
@@ -8,6 +8,22 @@ in
{
  options.services.scion = {
    enable = mkEnableOption "all of the scion components and services";
    stateless = mkOption {
      type = types.bool;
      default = true;
      description = ''
        Setting this value to false (stateful) can lead to improved caching and
        performance.

        This option decides whether to persist the SCION path sqlite databases
        on disk or not. Persisting this data can lead to database corruption in
        extreme cases such as power outage, meaning SCION fails to work on the
        next boot. This is being investigated.

        If true, /run/scion-* is used for data
        If false, use /var/lib/scion-* is used for data
      '';
    };
    bypassBootstrapWarning = mkOption {
      type = types.bool;
      default = false;