From 6df0b60f8af8a486ec89f6630e827720efd445ca Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:45:32 +0200 Subject: wolf: cleanup --- shared/1systems/wolf.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'shared') diff --git a/shared/1systems/wolf.nix b/shared/1systems/wolf.nix index 722a08812..0b4448022 100644 --- a/shared/1systems/wolf.nix +++ b/shared/1systems/wolf.nix @@ -1,20 +1,18 @@ -{ config, lib, pkgs, ... }: - +{ config, pkgs, ... }: let shack-ip = config.krebs.build.host.nets.shack.ip4.addr; - internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr; in { imports = [ ../. + ../2configs/cgit-mirror.nix ../2configs/collectd-base.nix - ../2configs/shack-nix-cacher.nix + ../2configs/graphite.nix + ../2configs/repo-sync.nix ../2configs/shack-drivedroid.nix + ../2configs/shack-nix-cacher.nix ../2configs/shared-buildbot.nix - ../2configs/cgit-mirror.nix - ../2configs/repo-sync.nix - ../2configs/graphite.nix ../2configs/share-shack.nix ]; # use your own binary cache, fallback use cache.nixos.org (which is used by -- cgit v1.2.3 From 6b453f7068e4eff470821341e9fcfdbb6d5483ca Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:46:45 +0200 Subject: shared shack-drivedroid: krebs.nginx -> services.nginx --- shared/2configs/shack-drivedroid.nix | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'shared') diff --git a/shared/2configs/shack-drivedroid.nix b/shared/2configs/shack-drivedroid.nix index 3581f9e96..07fcffa42 100644 --- a/shared/2configs/shack-drivedroid.nix +++ b/shared/2configs/shack-drivedroid.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ config, pkgs, ... }: with import ; let repodir = "/var/srv/drivedroid"; @@ -7,6 +7,20 @@ in { environment.systemPackages = [ pkgs.drivedroid-gen-repo ]; + services.nginx = { + enable = mkDefault true; + virtualHosts.shack-drivedroid = { + serverAliases = [ + "drivedroid.shack" + ]; + # TODO: prepare this somehow + locations."/".extraConfig = '' + root ${repodir}; + index main.json; + ''; + }; + }; + systemd.services.drivedroid = { description = "generates drivedroid repo file"; restartIfChanged = true; @@ -27,18 +41,4 @@ in ''; }; }; - - krebs.nginx = { - enable = lib.mkDefault true; - servers = { - drivedroid-repo = { - server-names = [ "drivedroid.shack" ]; - # TODO: prepare this somehow - locations = lib.singleton (lib.nameValuePair "/" '' - root ${repodir}; - index main.json; - ''); - }; - }; - }; } -- cgit v1.2.3 From 82aa7c6f101c16d7e2607f3429cfbb222c572438 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:47:07 +0200 Subject: shared shack-nix-cacher: krebs.nginx -> services.nginx --- shared/2configs/shack-nix-cacher.nix | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'shared') diff --git a/shared/2configs/shack-nix-cacher.nix b/shared/2configs/shack-nix-cacher.nix index 7519bb3ac..4fcbf3a4e 100644 --- a/shared/2configs/shack-nix-cacher.nix +++ b/shared/2configs/shack-nix-cacher.nix @@ -1,25 +1,28 @@ -{ pkgs, lib, ... }: - +{ config, pkgs, ... }: +with import ; +let + cfg = config.krebs.apt-cacher-ng; +in { - krebs.nginx = { - enable = lib.mkDefault true; - servers = { - apt-cacher-ng = { - server-names = [ "acng.shack" ]; - locations = lib.singleton (lib.nameValuePair "/" '' - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_pass http://localhost:3142/; - ''); - }; - }; - }; - krebs.apt-cacher-ng = { enable = true; port = 3142; bindAddress = "localhost"; cacheExpiration = 30; }; + + services.nginx = { + enable = mkDefault true; + virtualHosts.shack-nix-cacher = { + serverAliases = [ + "acng.shack" + ]; + locations."/".extraConfig = '' + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://localhost:${toString cfg.port}/; + ''; + }; + }; } -- cgit v1.2.3 From d34d95ec3ed4230faa2dc9dd90938e9991dd73d7 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 15:59:27 +0200 Subject: shared shack-drivedroid: cleanup --- shared/2configs/shack-drivedroid.nix | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'shared') diff --git a/shared/2configs/shack-drivedroid.nix b/shared/2configs/shack-drivedroid.nix index 07fcffa42..12e4a39c3 100644 --- a/shared/2configs/shack-drivedroid.nix +++ b/shared/2configs/shack-drivedroid.nix @@ -1,8 +1,7 @@ { config, pkgs, ... }: with import ; let - repodir = "/var/srv/drivedroid"; - srepodir = shell.escape repodir; + root = "/var/srv/drivedroid"; in { environment.systemPackages = [ pkgs.drivedroid-gen-repo ]; @@ -15,28 +14,34 @@ in ]; # TODO: prepare this somehow locations."/".extraConfig = '' - root ${repodir}; + root ${root}; index main.json; ''; }; }; - systemd.services.drivedroid = { + systemd.services.drivedroid-gen-repo = { description = "generates drivedroid repo file"; - restartIfChanged = true; + path = [ + pkgs.coreutils + pkgs.drivedroid-gen-repo + pkgs.inotify-tools + ]; wantedBy = [ "multi-user.target" ]; serviceConfig = { Type = "simple"; Restart = "always"; - ExecStartPre = pkgs.writeScript "prepare-drivedroid-gen-repo" '' - #!/bin/sh - mkdir -p ${srepodir}/repos + ExecStartPre = pkgs.writeDash "prepare-drivedroid-gen-repo" '' + mkdir -p ${root}/repos ''; - ExecStart = pkgs.writeScript "start-drivedroid-gen-repo" '' - #!/bin/sh + ExecStart = pkgs.writeDash "start-drivedroid-gen-repo" '' + set -efu + cd ${root} while sleep 60; do - ${pkgs.inotify-tools}/bin/inotifywait -r ${srepodir} && ${pkgs.drivedroid-gen-repo}/bin/drivedroid-gen-repo --chdir "${srepodir}" repos/ > "${srepodir}/main.json" + if inotifywait -r .; then + drivedroid-gen-repo repos > main.json + fi done ''; }; -- cgit v1.2.3 From c577d6b9972203941c577d9fb5488345d5fe84b5 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 17 Apr 2017 16:22:09 +0200 Subject: krebs.nginx: RIP --- shared/1systems/test-all-krebs-modules.nix | 1 - 1 file changed, 1 deletion(-) (limited to 'shared') diff --git a/shared/1systems/test-all-krebs-modules.nix b/shared/1systems/test-all-krebs-modules.nix index b42968cfb..39d7c494b 100644 --- a/shared/1systems/test-all-krebs-modules.nix +++ b/shared/1systems/test-all-krebs-modules.nix @@ -36,7 +36,6 @@ in { enable = true; tables = {}; }; - nginx.enable = true; realwallpaper.enable = true; tinc.retiolum.enable = true; retiolum-bootstrap.enable = true; -- cgit v1.2.3 From 55b77bd2ece03769e6df3ebdfa891bc255f92665 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Apr 2017 10:05:12 +0200 Subject: s 1 wolf: send stats to omo --- shared/1systems/wolf.nix | 1 + shared/2configs/central-stats-client.nix | 68 ++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 shared/2configs/central-stats-client.nix (limited to 'shared') diff --git a/shared/1systems/wolf.nix b/shared/1systems/wolf.nix index 0b4448022..75307be12 100644 --- a/shared/1systems/wolf.nix +++ b/shared/1systems/wolf.nix @@ -14,6 +14,7 @@ in ../2configs/shack-nix-cacher.nix ../2configs/shared-buildbot.nix ../2configs/share-shack.nix + ../2configs/central-stats-client.nix ]; # use your own binary cache, fallback use cache.nixos.org (which is used by # apt-cacher-ng in first place) diff --git a/shared/2configs/central-stats-client.nix b/shared/2configs/central-stats-client.nix new file mode 100644 index 000000000..0412eba9a --- /dev/null +++ b/shared/2configs/central-stats-client.nix @@ -0,0 +1,68 @@ +{pkgs, config, ...}: +{ + services.collectd = { + enable = true; + autoLoadPlugin = true; + extraConfig = '' + Hostname ${config.krebs.build.host.name} + LoadPlugin load + LoadPlugin disk + LoadPlugin memory + LoadPlugin df + Interval 30.0 + + LoadPlugin interface + + Interface "*Link" + Interface "lo" + Interface "vboxnet*" + Interface "virbr*" + IgnoreSelected true + + + LoadPlugin df + + MountPoint "/nix/store" + # MountPoint "/run*" + # MountPoint "/sys*" + # MountPoint "/dev" + # MountPoint "/dev/shm" + # MountPoint "/tmp" + FSType "tmpfs" + FSType "binfmt_misc" + FSType "debugfs" + FSType "mqueue" + FSType "hugetlbfs" + FSType "systemd-1" + FSType "cgroup" + FSType "securityfs" + FSType "ramfs" + FSType "proc" + FSType "devpts" + FSType "devtmpfs" + MountPoint "/var/lib/docker/devicemapper" + IgnoreSelected true + + + LoadPlugin cpu + + ReportByCpu true + ReportByState true + ValuesPercentage true + + + LoadPlugin network + + Server "stats.makefu.r" "25826" + + + LoadPlugin curl + + + URL "http://smarthome.shack/"; + MeasureResponseTime true + + + ''; + }; +} -- cgit v1.2.3 From de22f21195ee0f8d217b6377b0cf915bbfc2d2a8 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 19 Apr 2017 10:06:36 +0200 Subject: s 2 buildbot: configure nginx for buildbot --- shared/2configs/shared-buildbot.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'shared') diff --git a/shared/2configs/shared-buildbot.nix b/shared/2configs/shared-buildbot.nix index cf08882a9..1d6883afe 100644 --- a/shared/2configs/shared-buildbot.nix +++ b/shared/2configs/shared-buildbot.nix @@ -9,11 +9,20 @@ { # due to the fact that we actually build stuff on the box via the daemon, # /nix/store should be cleaned up automatically as well + services.nginx.virtualHosts.build = { + serverAliases = [ "build.wolf.r" ]; + locations."/".extraConfig = '' + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_pass http://localhost:${toString config.krebs.buildbot.master.web.port}; + ''; + }; + nix.gc.automatic = true; nix.gc.dates = "05:23"; networking.firewall.allowedTCPPorts = [ 8010 9989 ]; krebs.buildbot.master = let - stockholm-mirror-url = http://cgit.wolf/stockholm-mirror ; + stockholm-mirror-url = http://cgit.wolf.r/stockholm-mirror ; in { secrets = [ "retiolum-ci.rsa_key.priv" "cac.json" ]; workers = { @@ -151,6 +160,9 @@ channels = [ { channel = "retiolum"; } ]; allowForce = true; }; + extraConfig = '' + c['buildbotURL'] = "http://build.wolf.r/" + ''; }; krebs.buildbot.worker = { -- cgit v1.2.3