fix(ops): drop clbot
This removes the old clbot, which kept an SSH connection to gerrit open. Change-Id: If8faecdd018b45dd087b7332fe3d3a8280947358 Reviewed-on: https://cl.snix.dev/c/snix/+/30525 Tested-by: besadii Reviewed-by: Ryan Lahfa <ryan@lahfa.xyz>
This commit is contained in:
parent
8035195939
commit
0bcae4c083
13 changed files with 0 additions and 1545 deletions
|
|
@ -15,7 +15,6 @@ in
|
|||
(mod "o11y/tempo.nix")
|
||||
(mod "o11y/alertmanager-irc-relay.nix")
|
||||
(mod "known-hosts.nix")
|
||||
(mod "clbot.nix")
|
||||
(mod "irccat.nix")
|
||||
|
||||
(mod "www/mimir.snix.dev.nix")
|
||||
|
|
@ -56,28 +55,6 @@ in
|
|||
prometheus.enable = true;
|
||||
loki.enable = true;
|
||||
tempo.enable = true;
|
||||
clbot = {
|
||||
enable = false;
|
||||
channels = {
|
||||
"#snix" = { };
|
||||
|
||||
flags = {
|
||||
gerrit_host = "cl.snix.dev:29418";
|
||||
gerrit_ssh_auth_username = "clbot";
|
||||
# gerrit_ssh_auth_key = config.age.secrets.clbot-ssh-private-key.path;
|
||||
|
||||
irc_server = "irc.hackint.org:6697";
|
||||
irc_tls = true;
|
||||
irc_user = "snixbot";
|
||||
irc_nick = "snixbot";
|
||||
|
||||
notify_branches = "canon,refs/meta/config";
|
||||
notify_repo = "snix";
|
||||
|
||||
irc_pass = "$CLBOT_PASS";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.irccat = {
|
||||
|
|
|
|||
|
|
@ -134,32 +134,6 @@ in
|
|||
restic-bucket-credentials.file = secretFile "restic-bucket-credentials";
|
||||
};
|
||||
|
||||
# Start the Gerrit->IRC bot
|
||||
# services.depot.clbot = {
|
||||
# enable = true;
|
||||
# channels = {
|
||||
# "#snix-dev" = { };
|
||||
# };
|
||||
|
||||
# # See //fun/clbot for details.
|
||||
# flags = {
|
||||
# gerrit_host = "cl.tvl.fyi:29418";
|
||||
# gerrit_ssh_auth_username = "clbot";
|
||||
# gerrit_ssh_auth_key = config.age.secretsDir + "/clbot-ssh";
|
||||
|
||||
# irc_server = "localhost:${toString config.services.znc.config.Listener.l.Port}";
|
||||
# irc_user = "tvlbot";
|
||||
# irc_nick = "tvlbot";
|
||||
|
||||
# notify_branches = "canon,refs/meta/config";
|
||||
# notify_repo = "depot";
|
||||
|
||||
# # This secret is read from an environment variable, which is
|
||||
# # populated by a systemd EnvironmentFile.
|
||||
# irc_pass = "$CLBOT_PASS";
|
||||
# };
|
||||
# };
|
||||
|
||||
services.fail2ban.enable = true;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
|
|
|
|||
|
|
@ -1,76 +0,0 @@
|
|||
# Module that configures CLBot, our Gerrit->IRC info bridge.
|
||||
{ depot, config, lib, utils, ... }:
|
||||
|
||||
let
|
||||
inherit (builtins) attrValues concatStringsSep mapAttrs;
|
||||
|
||||
inherit (lib)
|
||||
listToAttrs
|
||||
mapAttrsToList
|
||||
mkEnableOption
|
||||
mkIf
|
||||
mkOption
|
||||
types;
|
||||
|
||||
description = "Bot to forward CL notifications";
|
||||
cfg = config.services.depot.clbot;
|
||||
|
||||
mkFlags = flags:
|
||||
concatStringsSep " "
|
||||
(attrValues (mapAttrs (key: value: "-${key} \"${toString value}\"") flags));
|
||||
|
||||
mkUnit = channel: channelFlags: {
|
||||
name = "clbot-${utils.escapeSystemdPath channel}";
|
||||
value = {
|
||||
description = "${description} to ${channel}";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
script = "${depot.fun.clbot}/bin/clbot ${mkFlags (cfg.flags // channelFlags // {
|
||||
irc_channel = channel;
|
||||
})} -alsologtostderr";
|
||||
|
||||
serviceConfig = {
|
||||
User = "clbot";
|
||||
EnvironmentFile = cfg.secretsFile;
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.services.depot.clbot = {
|
||||
enable = mkEnableOption description;
|
||||
|
||||
flags = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = "Key value pairs for command line flags";
|
||||
};
|
||||
|
||||
channels = mkOption {
|
||||
type = with types; attrsOf (attrsOf str);
|
||||
description = "Channels in which to post (generates one unit per channel); nested attrs are used as extra flags to the service, which override the attrs in `flags`";
|
||||
};
|
||||
|
||||
secretsFile = mkOption {
|
||||
type = types.str;
|
||||
description = "EnvironmentFile from which to load secrets";
|
||||
default = config.age.secretsDir + "/clbot";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# This does not use DynamicUser because we need to make some files
|
||||
# (notably the SSH private key) readable by this user outside of
|
||||
# the module.
|
||||
users = {
|
||||
groups.clbot = { };
|
||||
|
||||
users.clbot = {
|
||||
group = "clbot";
|
||||
isSystemUser = true;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services = listToAttrs (mapAttrsToList mkUnit cfg.channels);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue