forked from lix-project/hydra
module: append application_name
to HYDRA_DBI
This will make it easier to track specifically where queries are being made from (assuming a `log_line_prefix` that includes `%a` in the postgres configuration).
This commit is contained in:
parent
68ac64dbd9
commit
fe70160008
|
@ -58,6 +58,11 @@ in
|
||||||
example = "dbi:Pg:dbname=hydra;host=postgres.example.org;user=foo;";
|
example = "dbi:Pg:dbname=hydra;host=postgres.example.org;user=foo;";
|
||||||
description = ''
|
description = ''
|
||||||
The DBI string for Hydra database connection.
|
The DBI string for Hydra database connection.
|
||||||
|
|
||||||
|
NOTE: Attempts to set `application_name` will be overridden by
|
||||||
|
`hydra-TYPE` (where TYPE is e.g. `evaluator`, `queue-runner`,
|
||||||
|
etc.) in all hydra services to more easily distinguish where
|
||||||
|
queries are coming from.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,7 +253,9 @@ in
|
||||||
{ wantedBy = [ "multi-user.target" ];
|
{ wantedBy = [ "multi-user.target" ];
|
||||||
requires = optional haveLocalDB "postgresql.service";
|
requires = optional haveLocalDB "postgresql.service";
|
||||||
after = optional haveLocalDB "postgresql.service";
|
after = optional haveLocalDB "postgresql.service";
|
||||||
environment = env;
|
environment = env // {
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-init";
|
||||||
|
};
|
||||||
path = [ pkgs.utillinux ];
|
path = [ pkgs.utillinux ];
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p ${baseDir}
|
mkdir -p ${baseDir}
|
||||||
|
@ -304,7 +311,9 @@ in
|
||||||
{ wantedBy = [ "multi-user.target" ];
|
{ wantedBy = [ "multi-user.target" ];
|
||||||
requires = [ "hydra-init.service" ];
|
requires = [ "hydra-init.service" ];
|
||||||
after = [ "hydra-init.service" ];
|
after = [ "hydra-init.service" ];
|
||||||
environment = serverEnv;
|
environment = serverEnv // {
|
||||||
|
HYDRA_DBI = "${serverEnv.HYDRA_DBI};application_name=hydra-server";
|
||||||
|
};
|
||||||
restartTriggers = [ hydraConf ];
|
restartTriggers = [ hydraConf ];
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart =
|
{ ExecStart =
|
||||||
|
@ -326,6 +335,7 @@ in
|
||||||
environment = env // {
|
environment = env // {
|
||||||
PGPASSFILE = "${baseDir}/pgpass-queue-runner"; # grrr
|
PGPASSFILE = "${baseDir}/pgpass-queue-runner"; # grrr
|
||||||
IN_SYSTEMD = "1"; # to get log severity levels
|
IN_SYSTEMD = "1"; # to get log severity levels
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-queue-runner";
|
||||||
};
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v";
|
{ ExecStart = "@${cfg.package}/bin/hydra-queue-runner hydra-queue-runner -v";
|
||||||
|
@ -345,7 +355,9 @@ in
|
||||||
restartTriggers = [ hydraConf ];
|
restartTriggers = [ hydraConf ];
|
||||||
after = [ "hydra-init.service" "network.target" ];
|
after = [ "hydra-init.service" "network.target" ];
|
||||||
path = with pkgs; [ nettools cfg.package jq ];
|
path = with pkgs; [ nettools cfg.package jq ];
|
||||||
environment = env;
|
environment = env // {
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-evaluator";
|
||||||
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "@${cfg.package}/bin/hydra-evaluator hydra-evaluator";
|
{ ExecStart = "@${cfg.package}/bin/hydra-evaluator hydra-evaluator";
|
||||||
ExecStopPost = "${cfg.package}/bin/hydra-evaluator --unlock";
|
ExecStopPost = "${cfg.package}/bin/hydra-evaluator --unlock";
|
||||||
|
@ -358,7 +370,9 @@ in
|
||||||
systemd.services.hydra-update-gc-roots =
|
systemd.services.hydra-update-gc-roots =
|
||||||
{ requires = [ "hydra-init.service" ];
|
{ requires = [ "hydra-init.service" ];
|
||||||
after = [ "hydra-init.service" ];
|
after = [ "hydra-init.service" ];
|
||||||
environment = env;
|
environment = env // {
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-update-gc-roots";
|
||||||
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "@${cfg.package}/bin/hydra-update-gc-roots hydra-update-gc-roots";
|
{ ExecStart = "@${cfg.package}/bin/hydra-update-gc-roots hydra-update-gc-roots";
|
||||||
User = "hydra";
|
User = "hydra";
|
||||||
|
@ -369,7 +383,9 @@ in
|
||||||
systemd.services.hydra-send-stats =
|
systemd.services.hydra-send-stats =
|
||||||
{ wantedBy = [ "multi-user.target" ];
|
{ wantedBy = [ "multi-user.target" ];
|
||||||
after = [ "hydra-init.service" ];
|
after = [ "hydra-init.service" ];
|
||||||
environment = env;
|
environment = env // {
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-send-stats";
|
||||||
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "@${cfg.package}/bin/hydra-send-stats hydra-send-stats";
|
{ ExecStart = "@${cfg.package}/bin/hydra-send-stats hydra-send-stats";
|
||||||
User = "hydra";
|
User = "hydra";
|
||||||
|
@ -383,6 +399,7 @@ in
|
||||||
restartTriggers = [ hydraConf ];
|
restartTriggers = [ hydraConf ];
|
||||||
environment = env // {
|
environment = env // {
|
||||||
PGPASSFILE = "${baseDir}/pgpass-queue-runner"; # grrr
|
PGPASSFILE = "${baseDir}/pgpass-queue-runner"; # grrr
|
||||||
|
HYDRA_DBI = "${env.HYDRA_DBI};application_name=hydra-notify";
|
||||||
};
|
};
|
||||||
serviceConfig =
|
serviceConfig =
|
||||||
{ ExecStart = "@${cfg.package}/bin/hydra-notify hydra-notify";
|
{ ExecStart = "@${cfg.package}/bin/hydra-notify hydra-notify";
|
||||||
|
|
Loading…
Reference in a new issue