From 61cf4905fe4ad01b87c0251d7a90426b7b0ea3bc Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 26 May 2024 21:54:55 +0300 Subject: [PATCH] feat(ops/modules): launch teleirc for Volga Sprint For the duration of the sprint, this bot will take care of synchronising the IRC channel with the Telegram group. After the sprint, it will be removed again. Change-Id: I6d5b1316fc85ddd26adf55e31f6bff742907fc24 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11727 Reviewed-by: flokli Tested-by: BuildkiteCI --- ops/machines/whitby/default.nix | 5 ++++ ops/modules/teleirc.nix | 40 ++++++++++++++++++++++++++++++++ ops/secrets/secrets.nix | 4 ++++ ops/secrets/teleirc.age | Bin 0 -> 1006 bytes 4 files changed, 49 insertions(+) create mode 100644 ops/modules/teleirc.nix create mode 100644 ops/secrets/teleirc.age diff --git a/ops/machines/whitby/default.nix b/ops/machines/whitby/default.nix index 6a8ee56ab..41391c8c0 100644 --- a/ops/machines/whitby/default.nix +++ b/ops/machines/whitby/default.nix @@ -25,6 +25,7 @@ in (mod "restic.nix") (mod "smtprelay.nix") (mod "sourcegraph.nix") + (mod "teleirc.nix") (mod "tvl-buildkite.nix") (mod "tvl-slapd/default.nix") (mod "tvl-users.nix") @@ -232,6 +233,7 @@ in owothia.file = secretFile "owothia"; panettone.file = secretFile "panettone"; smtprelay.file = secretFile "smtprelay"; + teleirc.file = secretFile "teleirc"; buildkite-agent-token = { file = secretFile "buildkite-agent-token"; @@ -410,6 +412,9 @@ in }; }; + # Run the Telegram<>IRC bridge for Volga Sprint. + teleirc.enable = true; + # Run atward, the search engine redirection thing. atward.enable = true; diff --git a/ops/modules/teleirc.nix b/ops/modules/teleirc.nix new file mode 100644 index 000000000..9f9ac059c --- /dev/null +++ b/ops/modules/teleirc.nix @@ -0,0 +1,40 @@ +# Run the Telegram<>IRC sync bot for the Volga Sprint channel. +# +# This module is written in a pretty ad-hoc style, as it is sort of a +# throwaway thing (will be removed again after the event). +{ depot, config, lib, pkgs, ... }: + +let + cfg = config.services.depot.owothia; + description = "IRC<>Telegram sync for Volga Sprint channel"; + configFile = builtins.toFile "teleirc.env" '' + # connect through tvlbot's ZNC bouncer + IRC_SERVER="localhost" + IRC_PORT=2627 + IRC_USE_SSL=false + IRC_CHANNEL="#volgasprint" + IRC_BLACKLIST="tvlbot" + IRC_BOT_NAME="tvlbot" + IRC_BOT_REALNAME="TVL bot for Volga Sprint" + IRC_BOT_IDENT="tvlbot" + IRC_SEND_STICKER_EMOJI=false # look into this + TELEGRAM_CHAT_ID=-1002153072030 + ''; +in +{ + options.services.depot.teleirc.enable = lib.mkEnableOption description; + + config = lib.mkIf cfg.enable { + systemd.services.teleirc = { + inherit description; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + DynamicUser = true; + Restart = "always"; + EnvironmentFile = "/run/agenix/teleirc"; + ExecStart = "${depot.third_party.teleirc}/bin/teleirc -conf ${configFile}"; + }; + }; + }; +} diff --git a/ops/secrets/secrets.nix b/ops/secrets/secrets.nix index 5cbf2bf61..660fe5a79 100644 --- a/ops/secrets/secrets.nix +++ b/ops/secrets/secrets.nix @@ -9,6 +9,9 @@ let # zamalek "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBRXeb8EuecLHP0bW4zuebXp4KRnXgJTZfeVWXQ1n1R" + + # khamovnik + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1ptE5HvGSXxSXo+aHBTKa5PBlAM1HqmpzWz0yAhHLj" ]; aspen = [ @@ -47,6 +50,7 @@ in "owothia.age" = whitbyDefault; "panettone.age" = whitbyDefault; "smtprelay.age" = whitbyDefault; + "teleirc.age" = whitbyDefault; "tf-buildkite.age" = terraform; "tf-glesys.age" = terraform; "tf-keycloak.age" = terraform; diff --git a/ops/secrets/teleirc.age b/ops/secrets/teleirc.age new file mode 100644 index 0000000000000000000000000000000000000000..ebc88fc9ef1dc31ec0fc63d7bf2e681c9ec00c57 GIT binary patch literal 1006 zcmZ9_%j?^8003}zngnEr9Yik%5eAl;N0TOTI!N0z&8x2@ZQ5PT`_;UYe$yV@#a%=c z=0y*R2SxCph%)ss4~n8V(7O+iP0_*d@dGcSh}YleANZKQ+jUdBJmhtlrH^H$kL)q1 zdkL*7|*l=G1?WaE(!SpVC!}xhzv8E$UD#ub^|BGC%P%>bznm? zZs}Sz=JG|}E29u|5~5Si0PW#&S_p_9Bo0NSRXr29)7#M=HUSIQyjx`%8!OCknl-r- zM!Lo;Gr}td%>dPTVeG4dl8n%30fBHlb~kD0B!XYWVI(NRPUuO=it)^>;T9RO>#(bs zRMVS|seYT3M7>1;REmMVPdR;~ z5v4)P9nFxyc4Sdgsb6jT%aB^zT0+f@R<}=Y!(1Hr3s|bm;Gl0n&kPz63ABW7e9ZPE zW>HJ~N^mM5gn&>{-PfU+?yd8%RyR&I-}F3ABxR1Z_#?vY`r$;`;gIeP>o zROzGxdCV<*D4)hGOAINhI1CrP*5L9G0q$PYJk>B3OPrI8Ix!}JHUa-{+b7f~t*&3X zX63@OM`ZZoCHn%rp`f`7a;%LgbsUnN>`<*M###|=fR9zvl%x?dT}4zf_xlQCrg_$J zJIV^RjZ&Iaj#2DTNUY?LaVOKJ#VysC8J;u>7!$K{I>HBXT_F8^?DGWF?RH_}5U~x= z6;h;|Ly9(>w(&-mZ5`Kph2*n{Uk)2YM=Oq_pws&%diy_gxa_)skfBb`Z z?)Hl}&yT+RVE*gf5%KKvHy%IpyAD1_@B7I*`R2OT{p6n49y0E~Q9Q+eSX@2V`=>m9 dbuahXwKp$cdEo0$Uzslc^1t}@y=Pv1=Rcu>US9wJ literal 0 HcmV?d00001