Ported/merged properties from the TUD configuration's hydra-module

[?]
Mar 22, 2013, 12:58 PM
ZYEFL36QOB6KUR276RRT4PSAK7HWUJ6TLLZBEZM7SSGUX2WQTMZQC

Dependencies

  • [2] J3G4ZLOK hydra-module: Fix typo.
  • [3] 3FTM52B2 hydra-module: Always GC to have at least 100 GiB available.
  • [4] 3PNG7NIB Remove trailing whitespace
  • [5] QQU7AL7I hydra-module.nix: Remove `.pl' extension for binaries.
  • [6] INUGMXTG hydra-module: Add a `port' option.
  • [7] WXW2GAJY _ -> -
  • [8] D3MDJONY
  • [9] ZVGQP2SX hydra-module: Add a `logo' option.

Change contents

  • replacement in hydra-module.nix at line 16
    [4.355][5.276:451](),[5.276][5.276:451](),[5.451][5.0:47](),[5.47][2.0:91](),[5.47][5.451:498](),[2.91][5.451:498](),[5.94][5.451:498](),[5.451][5.451:498]()
    env = ''export NIX_REMOTE=daemon ''
    + ''HYDRA_DBI="${cfg.dbi}" ''
    + ''HYDRA_CONFIG=${cfg.baseDir}/data/hydra.conf ''
    + ''HYDRA_DATA=${cfg.baseDir}/data ''
    + ''HYDRA_PORT="${toString cfg.port}" ''
    + (if cfg.logo != null
    then ''HYDRA_LOGO="${cfg.logo}" ''
    else "")
    + ''HYDRA_TRACKER="${cfg.tracker}" ;'';
    [4.355]
    [5.498]
    env =
    { NIX_REMOTE = "daemon";
    HYDRA_DBI = cfg.dbi;
    HYDRA_CONFIG = "${cfg.baseDir}/data/hydra.conf";
    HYDRA_DATA = "${cfg.baseDir}/data";
    HYDRA_PORT = "${toString cfg.port}";
    OPENSSL_X509_CERT_FILE = "/etc/ssl/certs/ca-bundle.crt";
    };
    serverEnv = env //
    { HYDRA_LOGO = if cfg.logo != null then cfg.logo else "";
    HYDRA_TRACKER = cfg.tracker;
    };
  • replacement in hydra-module.nix at line 66
    [5.1282][5.1282:1312]()
    default = pkgs.hydra;
    [5.1282]
    [5.1312]
    #default = pkgs.hydra;
  • edit in hydra-module.nix at line 127
    [4.716]
    [4.716]
    useWAL = mkOption {
    default = true;
    description = ''
    Whether to use SQLite's Write-Ahead Logging, which may improve performance.
    '';
    };
  • edit in hydra-module.nix at line 169
    [5.3572]
    [5.3572]
    # Online log compression makes it impossible to get the tail of
    # builds that are in progress.
    build-compress-log = false
  • replacement in hydra-module.nix at line 174
    [5.3573][5.3573:3602]()
    use-sqlite-wal = false
    [5.3573]
    [5.3602]
    use-sqlite-wal = ${if cfg.useWAL then "true" else "false"}
  • replacement in hydra-module.nix at line 177
    [5.3611][5.3611:3739]()
    jobs.hydra_init =
    { description = "hydra-init";
    startOn = "started network-interfaces";
    preStart = ''
    [5.3611]
    [5.3739]
    jobs."hydra-init" =
    { wantedBy = [ "multi-user.target" ];
    script = ''
  • replacement in hydra-module.nix at line 184
    [5.3899][5.3899:3949]()
    exec = ''
    echo done
    '';
    [5.3899]
    [5.3949]
    task = true;
    };
    systemd.services."hydra-server" =
    { wantedBy = [ "multi-user.target" ];
    wants = [ "hydra-init.service" ];
    after = [ "hydra-init.service" ];
    environment = serverEnv;
    serviceConfig =
    { ExecStart = "@${cfg.hydra}/bin/hydra-server hydra-server -f -h \* --max_spare_servers 5 --max_servers 25 --max_requests 100";
    User = cfg.user;
    Restart = "always";
    };
  • replacement in hydra-module.nix at line 199
    [5.3959][5.3959:4133](),[5.4133][5.0:122](),[5.122][5.4258:4270](),[5.125][5.4258:4270](),[5.4258][5.4258:4270]()
    jobs.hydra_server =
    { description = "hydra-server";
    startOn = if cfg.autoStart then "started network-interfaces hydra-init" else "never";
    exec = ''
    ${pkgs.su}/bin/su - ${cfg.user} -c '${env} ${cfg.hydra}/bin/hydra-server > ${cfg.baseDir}/data/server.log 2>&1'
    '';
    [5.3959]
    [5.4270]
    systemd.services."hydra-queue-runner" =
    { wantedBy = [ "multi-user.target" ];
    wants = [ "hydra-init.service" ];
    after = [ "hydra-init.service" "network.target" ];
    path = [ pkgs.nettools pkgs.ssmtp ];
    environment = env;
    serviceConfig =
    { ExecStartPre = "${cfg.hydra}/bin/hydra-queue-runner --unlock";
    ExecStart = "@${cfg.hydra}/bin/hydra-queue-runner hydra-queue-runner";
    User = cfg.user;
    Restart = "always";
    };
  • replacement in hydra-module.nix at line 213
    [5.4280][5.4280:4448](),[5.4448][5.123:234](),[5.234][5.4562:4580](),[5.240][5.4562:4580](),[5.4562][5.4562:4580](),[5.4580][5.235:379](),[5.379][5.4727:4739](),[5.388][5.4727:4739](),[5.4727][5.4727:4739]()
    jobs.hydra_queue_runner =
    { description = "hydra-queue-runner";
    startOn = if cfg.autoStart then "started network-interfaces hydra-init" else "never";
    preStart = "${pkgs.su}/bin/su - ${cfg.user} -c '${env} ${cfg.hydra}/bin/hydra-queue-runner --unlock'";
    exec = ''
    ${pkgs.su}/bin/su - ${cfg.user} -c '${env} nice -n 8 ${cfg.hydra}/bin/hydra-queue-runner > ${cfg.baseDir}/data/queue-runner.log 2>&1'
    '';
    [5.4280]
    [5.4739]
    systemd.services."hydra-evaluator" =
    { wantedBy = [ "multi-user.target" ];
    wants = [ "hydra-init.service" ];
    after = [ "hydra-init.service" "network.target" ];
    path = [ pkgs.nettools pkgs.ssmtp ];
    environment = env;
    serviceConfig =
    { ExecStart = "@${cfg.hydra}/bin/hydra-evaluator hydra-evaluator";
    User = cfg.user;
    Restart = "always";
    };
  • replacement in hydra-module.nix at line 226
    [5.4749][5.4749:4929](),[5.4929][5.380:518](),[5.518][5.5070:5082](),[5.530][5.5070:5082](),[5.5070][5.5070:5082]()
    jobs.hydra_evaluator =
    { description = "hydra-evaluator";
    startOn = if cfg.autoStart then "started network-interfaces hydra-init" else "never";
    exec = ''
    ${pkgs.su}/bin/su - ${cfg.user} -c '${env} nice -n 5 ${cfg.hydra}/bin/hydra-evaluator > ${cfg.baseDir}/data/evaluator.log 2>&1'
    '';
    [5.4749]
    [5.5082]
    systemd.services."hydra-update-gc-roots" =
    { wants = [ "hydra-init.service" ];
    after = [ "hydra-init.service" ];
    environment = env;
    serviceConfig =
    { ExecStart = "@${cfg.hydra}/bin/hydra-update-gc-roots hydra-update-gc-roots";
    User = cfg.user;
    };
  • replacement in hydra-module.nix at line 244
    [3.465][3.465:499]()
    stop hydra_queue_runner
    [3.465]
    [3.499]
    stop hydra_queue_runner
  • replacement in hydra-module.nix at line 246
    [3.514][3.514:718](),[3.718][5.6304:6305](),[5.6304][5.6304:6305](),[5.6305][3.719:1272]()
    if [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFreeEvaluator} * 1024**3)) ]; then
    stop hydra_evaluator
    fi
    '';
    collect = pkgs.writeScript "collect-some-garbage"
    # Arrange to always have at least 100 GiB free.
    '' #!/bin/sh -e
    available="$(df -B1 /nix/store | tail -n 1 | awk '{ print $4 }')"
    target="$((100 * 1024**3))"
    to_free="$(($available > $target ? 200 * 1024**2 : $target - $available))"
    echo "$available B available, and targeting $target B available"
    echo "thus, freeing $to_free B"
    exec "${pkgs.nix}/bin/nix-collect-garbage" --max-freed "$to_free"
    [3.514]
    [3.1272]
    if [ $(($(stat -f -c '%a' /nix/store) * $(stat -f -c '%S' /nix/store))) -lt $((${toString cfg.minimumDiskFreeEvaluator} * 1024**3)) ]; then
    stop hydra_evaluator
    fi
  • replacement in hydra-module.nix at line 257
    [3.1520][3.1520:1662](),[3.1662][5.6314:6315](),[5.6314][5.6314:6315](),[5.6315][3.1663:1746]()
    [ "15 03 * * * root ${collect} &> ${cfg.baseDir}/data/gc.log"
    "15 13 * * * root ${collect} &> ${cfg.baseDir}/data/gc.log"
    "*/5 * * * * root ${checkSpace} &> ${cfg.baseDir}/data/checkspace.log"
    [3.1520]
    [3.1746]
    [ "*/5 * * * * root ${checkSpace} &> ${cfg.baseDir}/data/checkspace.log"
  • replacement in hydra-module.nix at line 259
    [3.1827][3.1827:1945]()
    "15 02 * * * ${cfg.user} ${env} ${cfg.hydra}/bin/hydra-update-gc-roots &> ${cfg.baseDir}/data/gc-roots.log"
    [3.1827]
    [3.1945]
    "15 2 * * * root ${pkgs.systemd}/bin/systemctl start hydra-update-gc-roots.service"