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.
This commit is contained in:
committed by
Valentin Gagarin
parent
7e78326ca9
commit
c53e5201f4
@@ -3,8 +3,10 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
globalCfg = config.services.scion;
|
||||||
cfg = config.services.scion.scion-control;
|
cfg = config.services.scion.scion-control;
|
||||||
toml = pkgs.formats.toml { };
|
toml = pkgs.formats.toml { };
|
||||||
|
connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
|
||||||
defaultConfig = {
|
defaultConfig = {
|
||||||
general = {
|
general = {
|
||||||
id = "cs";
|
id = "cs";
|
||||||
@@ -12,13 +14,13 @@ let
|
|||||||
reconnect_to_dispatcher = true;
|
reconnect_to_dispatcher = true;
|
||||||
};
|
};
|
||||||
beacon_db = {
|
beacon_db = {
|
||||||
connection = "/run/scion-control/control.beacon.db";
|
connection = "${connectionDir}/scion-control/control.beacon.db";
|
||||||
};
|
};
|
||||||
path_db = {
|
path_db = {
|
||||||
connection = "/run/scion-control/control.path.db";
|
connection = "${connectionDir}/scion-control/control.path.db";
|
||||||
};
|
};
|
||||||
trust_db = {
|
trust_db = {
|
||||||
connection = "/run/scion-control/control.trust.db";
|
connection = "${connectionDir}/scion-control/control.trust.db";
|
||||||
};
|
};
|
||||||
log.console = {
|
log.console = {
|
||||||
level = "info";
|
level = "info";
|
||||||
@@ -62,7 +64,7 @@ in
|
|||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
BindPaths = [ "/dev/shm:/run/shm" ];
|
BindPaths = [ "/dev/shm:/run/shm" ];
|
||||||
RuntimeDirectory = "scion-control";
|
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-control";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
globalCfg = config.services.scion;
|
||||||
cfg = config.services.scion.scion-daemon;
|
cfg = config.services.scion.scion-daemon;
|
||||||
toml = pkgs.formats.toml { };
|
toml = pkgs.formats.toml { };
|
||||||
|
connectionDir = if globalCfg.stateless then "/run" else "/var/lib";
|
||||||
defaultConfig = {
|
defaultConfig = {
|
||||||
general = {
|
general = {
|
||||||
id = "sd";
|
id = "sd";
|
||||||
@@ -12,10 +14,10 @@ let
|
|||||||
reconnect_to_dispatcher = true;
|
reconnect_to_dispatcher = true;
|
||||||
};
|
};
|
||||||
path_db = {
|
path_db = {
|
||||||
connection = "/run/scion-daemon/sd.path.db";
|
connection = "${connectionDir}/scion-daemon/sd.path.db";
|
||||||
};
|
};
|
||||||
trust_db = {
|
trust_db = {
|
||||||
connection = "/run/scion-daemon/sd.trust.db";
|
connection = "${connectionDir}/scion-daemon/sd.trust.db";
|
||||||
};
|
};
|
||||||
log.console = {
|
log.console = {
|
||||||
level = "info";
|
level = "info";
|
||||||
@@ -57,7 +59,7 @@ in
|
|||||||
ExecStart = "${pkgs.scion}/bin/scion-daemon --config ${configFile}";
|
ExecStart = "${pkgs.scion}/bin/scion-daemon --config ${configFile}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
RuntimeDirectory = "scion-daemon";
|
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-daemon";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
globalCfg = config.services.scion;
|
||||||
cfg = config.services.scion.scion-dispatcher;
|
cfg = config.services.scion.scion-dispatcher;
|
||||||
toml = pkgs.formats.toml { };
|
toml = pkgs.formats.toml { };
|
||||||
defaultConfig = {
|
defaultConfig = {
|
||||||
@@ -66,7 +67,7 @@ in
|
|||||||
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
|
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf /run/shm/dispatcher";
|
||||||
ExecStart = "${pkgs.scion}/bin/scion-dispatcher --config ${configFile}";
|
ExecStart = "${pkgs.scion}/bin/scion-dispatcher --config ${configFile}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RuntimeDirectory = "scion-dispatcher";
|
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-dispatcher";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
globalCfg = config.services.scion;
|
||||||
cfg = config.services.scion.scion-router;
|
cfg = config.services.scion.scion-router;
|
||||||
toml = pkgs.formats.toml { };
|
toml = pkgs.formats.toml { };
|
||||||
defaultConfig = {
|
defaultConfig = {
|
||||||
@@ -42,7 +43,7 @@ in
|
|||||||
ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
|
ExecStart = "${pkgs.scion}/bin/scion-router --config ${configFile}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
DynamicUser = true;
|
DynamicUser = true;
|
||||||
RuntimeDirectory = "scion-router";
|
${if globalCfg.stateless then "RuntimeDirectory" else "StateDirectory"} = "scion-router";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,6 +8,22 @@ in
|
|||||||
{
|
{
|
||||||
options.services.scion = {
|
options.services.scion = {
|
||||||
enable = mkEnableOption "all of the scion components and services";
|
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 {
|
bypassBootstrapWarning = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user