summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/deployment/wiki-irc.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-04-26 14:42:52 +0200
committermakefu <github@syntax-fehler.de>2017-04-26 14:42:52 +0200
commitb1cad2a6497ac285c7c1a11d5bdeadb64e6bc2a5 (patch)
tree99746828d67e449fb3a1dadff0da1d65d67af5b4 /makefu/2configs/deployment/wiki-irc.nix
parentbcf11edfd669e8fc4d1a8bcbb86e09242acd591f (diff)
m 2 wiki-irc: add logstash config for github hook
Diffstat (limited to 'makefu/2configs/deployment/wiki-irc.nix')
-rw-r--r--makefu/2configs/deployment/wiki-irc.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/makefu/2configs/deployment/wiki-irc.nix b/makefu/2configs/deployment/wiki-irc.nix
new file mode 100644
index 000000000..73b85d821
--- /dev/null
+++ b/makefu/2configs/deployment/wiki-irc.nix
@@ -0,0 +1,49 @@
+{ pkgs, lib, ... }:
+
+with lib;
+let
+ port = 18872;
+in {
+ services.logstash = {
+ enable = true;
+ inputConfig = ''
+ http {
+ port => ${toString port}
+ host => "127.0.0.1"
+ }
+ '';
+ filterConfig = ''
+ if ([pages]) {
+ ruby {
+ code => '
+ o = ""
+ event["pages"].each { |p| o = o + "\"" + p["title"] + "\" " + p["action"] +" by "+ event["sender"]["login"]+" " +p["html_url"] + "/_compare/" + p["sha"] + "\n" }
+ event["output"] = o
+ '
+ }
+ }
+ '';
+ outputConfig = ''
+ file { path => "/tmp/logs.json" codec => "json_lines" }
+ if [output] {
+ irc {
+ channels => [ "#krebs" ]
+ host => "irc.freenode.net"
+ nick => "nixos-wiki"
+ format => "%{output}"
+ }
+ }
+ '';
+ plugins = [ ];
+ };
+
+ services.nginx = {
+ enable = lib.mkDefault true;
+ virtualHosts."ghook.krebsco.de" = {
+ locations."/".proxyPass = "http://localhost:${toString port}/";
+ enableSSL = true;
+ enableACME = true;
+ forceSSL = true;
+ };
+ };
+}