From e9fce22b71a24e84edb667f461046e8586b600dd Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Tue, 20 Aug 2024 22:57:55 +0200 Subject: [PATCH] hiroshi/languagetool: Migrate from fuuko --- machines/fuuko/configuration.nix | 1 - machines/hiroshi/configuration.nix | 6 ++++++ machines/{fuuko => hiroshi}/services/languagetool.nix | 8 ++++++-- machines/koyomi/services/haproxy.nix | 6 +++++- machines/vueko/services/fuuko-proxy.nix | 1 - 5 files changed, 17 insertions(+), 5 deletions(-) rename machines/{fuuko => hiroshi}/services/languagetool.nix (76%) diff --git a/machines/fuuko/configuration.nix b/machines/fuuko/configuration.nix index 421617c..e3aa00d 100644 --- a/machines/fuuko/configuration.nix +++ b/machines/fuuko/configuration.nix @@ -9,7 +9,6 @@ ../../modules ../../users/simon - ./services/languagetool.nix ./services/media-backup.nix ./services/media.nix ./services/photoprism.nix diff --git a/machines/hiroshi/configuration.nix b/machines/hiroshi/configuration.nix index 0c5c84a..a1cecd8 100644 --- a/machines/hiroshi/configuration.nix +++ b/machines/hiroshi/configuration.nix @@ -6,6 +6,8 @@ imports = [ ./hardware-configuration.nix ../../modules + + ./services/languagetool.nix ]; sbruder = { @@ -13,6 +15,10 @@ restic.system.enable = true; wireguard.home.enable = true; infovhost.enable = true; + nginx = { + hardening.enable = true; + proxyv4.enable = true; + }; }; networking.hostName = "hiroshi"; diff --git a/machines/fuuko/services/languagetool.nix b/machines/hiroshi/services/languagetool.nix similarity index 76% rename from machines/fuuko/services/languagetool.nix rename to machines/hiroshi/services/languagetool.nix index 861aa5f..a51598e 100644 --- a/machines/fuuko/services/languagetool.nix +++ b/machines/hiroshi/services/languagetool.nix @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023 Simon Bruder +# SPDX-FileCopyrightText: 2023-2024 Simon Bruder # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -12,8 +12,9 @@ in #allowOrigin = "https://languagetool.sbruder.de"; allowOrigin = "*"; settings = { + # http://languagetool.org/download/ngram-data/ languageModel = "/var/lib/languagetool/ngrams"; - word2vecModel = "/var/lib/languagetool/word2vec"; + # https://fasttext.cc/docs/en/language-identification.html fasttextModel = "/var/lib/languagetool/fasttext/lid.176.bin"; fasttextBinary = "${pkgs.fasttext}/bin/fasttext"; }; @@ -23,6 +24,9 @@ in #systemd.services.languagetool.serviceConfig.StandardOutput = "null"; services.nginx.virtualHosts."languagetool.sbruder.de" = { + enableACME = true; + forceSSL = true; + locations = { "/".proxyPass = "http://127.0.0.1:${toString cfg.port}"; }; diff --git a/machines/koyomi/services/haproxy.nix b/machines/koyomi/services/haproxy.nix index 100bd60..bd945a0 100644 --- a/machines/koyomi/services/haproxy.nix +++ b/machines/koyomi/services/haproxy.nix @@ -5,7 +5,11 @@ { config, lib, pkgs, ... }: let baseDomain = "koyomi.sbruder.de"; - backends = { }; + backends = { + hiroshi = [ + "languagetool.sbruder.de" + ]; + }; fallbackCert = pkgs.runCommandNoCC "fallback-cert" { } '' cat > openssl.cnf << EOF diff --git a/machines/vueko/services/fuuko-proxy.nix b/machines/vueko/services/fuuko-proxy.nix index 3124606..9c6ad90 100644 --- a/machines/vueko/services/fuuko-proxy.nix +++ b/machines/vueko/services/fuuko-proxy.nix @@ -19,7 +19,6 @@ }; }) [ - "languagetool.sbruder.de" "media.sbruder.de" "photoprism.sbruder.de" "torrent.sbruder.de"