From 457585940971ce34a8e46b330b3bb729cc1af3f8 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Wed, 26 Feb 2020 20:16:30 -0500 Subject: Run pjournal on dragon --- config/pjournal.nix | 14 ++++++++++++-- config/web-server.nix | 12 ++++++++---- data/aliases.nix | 1 + data/dns/db.orbekk.shared.zone | 1 + machines/dragon.nix | 6 ++++++ machines/x220-aji.nix | 2 ++ 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/config/pjournal.nix b/config/pjournal.nix index 840e72a..59c9af8 100644 --- a/config/pjournal.nix +++ b/config/pjournal.nix @@ -6,14 +6,24 @@ in { options = { services.pjournal = { + enable = mkOption { + type = types.bool; + default = false; + }; + package = mkOption { type = types.package; default = pkgs.callPackage ../pkgs/pjournal/default.nix {}; }; + + port = mkOption { + type = types.int; + default = 8080; + }; }; }; - config = { + config = mkIf cfg.enable { environment.systemPackages = [ cfg.package ]; @@ -43,7 +53,7 @@ in # the database. ${cfg.package}/bin/pjournal \ --database_url postgres://pjournal@/pjournal \ - --port 8080 + --port ${toString cfg.port} ''; serviceConfig = { User = "pjournal"; diff --git a/config/web-server.nix b/config/web-server.nix index 4ef070b..77a508a 100644 --- a/config/web-server.nix +++ b/config/web-server.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: let mpd_loc = (import ../data/aliases.nix).services.mpd; mpdweb_loc = (import ../data/aliases.nix).services.mpdweb; + pjournal_loc = (import ../data/aliases.nix).services.pjournal; in { imports = [ ./orbekk-pkgs.nix ]; @@ -34,7 +35,7 @@ locations."/" = { extraConfig = '' try_files $uri @storage; - # kill cache + # kill cache add_header Last-Modified $date_gmt; add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; if_modified_since off; @@ -56,9 +57,9 @@ alias = "/var/www/munin/"; extraConfig = "autoindex on;"; }; - locations."/mpd" = { - proxyPass = "http://${mpd_loc.address}:${toString mpd_loc.port}/"; - }; + locations."/mpd" = { + proxyPass = "http://${mpd_loc.address}:${toString mpd_loc.port}/"; + }; #locations."/systemd" = { # proxyPass = "http://10.0.20.15:11105/"; #}; @@ -92,6 +93,9 @@ "kufieta.net" = template // { locations."/".proxyPass = "http://10.0.20.13:8080"; }; + "journal.orbekk.com" = template // { + locations."/".proxyPass = "http://${pjournal_loc.address}:${toString pjournal_loc.port}"; + }; }; }; } diff --git a/data/aliases.nix b/data/aliases.nix index 28e1ded..979991a 100644 --- a/data/aliases.nix +++ b/data/aliases.nix @@ -16,5 +16,6 @@ rec { wireguard = { port = 11107; }; mpd = { address = ip.dragon; port = 11108; }; mpdweb = { address = ip.dragon; port = 11109; }; + pjournal = { address = ip.dragon; port = 11110; }; }; } diff --git a/data/dns/db.orbekk.shared.zone b/data/dns/db.orbekk.shared.zone index c4c7a99..41787c4 100644 --- a/data/dns/db.orbekk.shared.zone +++ b/data/dns/db.orbekk.shared.zone @@ -29,6 +29,7 @@ git IN CNAME dragon hydra IN CNAME dragon kj IN CNAME dragon ympd IN CNAME dragon +journal IN CNAME dragon raigh IN AAAA 2001:67c:29f4:1008:216:3eff:fe33:4512 diff --git a/machines/dragon.nix b/machines/dragon.nix index d3a1c19..5005619 100644 --- a/machines/dragon.nix +++ b/machines/dragon.nix @@ -19,8 +19,14 @@ in ../config/munin-master.nix ../config/vpn-server.nix ../config/terraria.nix + ../config/pjournal.nix ]; + services.pjournal = { + enable = true; + port = (import ../data/aliases.nix).services.pjournal.port; + }; + environment.systemPackages = with pkgs; [ ipmitool ]; # environment.etc."dhcpcd.duid".text = duid; systemd.services.dhcpcd.preStart = '' diff --git a/machines/x220-aji.nix b/machines/x220-aji.nix index a406f7b..5319d26 100644 --- a/machines/x220-aji.nix +++ b/machines/x220-aji.nix @@ -9,6 +9,8 @@ ../config/pjournal.nix ]; + services.pjournal.enable = true; + services.thinkfan.enable = true; services.thinkfan.sensors = '' hwmon /sys/devices/platform/coretemp.0/hwmon/hwmon4/temp1_input -- cgit v1.2.3