m 2 wiki-irc: add logstash config for github hook
This commit is contained in:
parent
bcf11edfd6
commit
b1cad2a649
49
makefu/2configs/deployment/wiki-irc.nix
Normal file
49
makefu/2configs/deployment/wiki-irc.nix
Normal file
|
@ -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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user