From 96fcce0e7c95460ce55ba644cab60580547a2981 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 24 Apr 2017 23:21:28 +0200 Subject: m 1 gum: add newsbot deployment --- makefu/2configs/deployment/newsbot.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 makefu/2configs/deployment/newsbot.nix (limited to 'makefu/2configs/deployment') diff --git a/makefu/2configs/deployment/newsbot.nix b/makefu/2configs/deployment/newsbot.nix new file mode 100644 index 00000000..74880344 --- /dev/null +++ b/makefu/2configs/deployment/newsbot.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +let + newsfile = pkgs.writeText "feeds" '' + nixoswiki-bot|https://github.com/Mic92/nixos-wiki/wiki.atom|#krebs + ''; +in { + environment.systemPackages = [ + pkgs.newsbot-js + ]; + krebs.newsbot-js = { + enable = true; + ircServer = "chat.freenode.net"; + feeds = newsfile; + urlShortenerHost = "go"; + urlShortenerPort = "80"; + }; +} -- cgit v1.2.3 From b1cad2a6497ac285c7c1a11d5bdeadb64e6bc2a5 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 26 Apr 2017 14:42:52 +0200 Subject: m 2 wiki-irc: add logstash config for github hook --- makefu/2configs/deployment/wiki-irc.nix | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 makefu/2configs/deployment/wiki-irc.nix (limited to 'makefu/2configs/deployment') diff --git a/makefu/2configs/deployment/wiki-irc.nix b/makefu/2configs/deployment/wiki-irc.nix new file mode 100644 index 00000000..73b85d82 --- /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; + }; + }; +} -- cgit v1.2.3