From 0bcabe1c4b1dd74af233674dfa6c6ec3011ce2c0 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 18 Jan 2022 09:43:24 +0100 Subject: restructuring directories --- hosts/chaski/services/VaaS/.gitignore | 1 - hosts/chaski/services/VaaS/CHANGELOG.md | 5 - hosts/chaski/services/VaaS/app/Main.hs | 58 ---------- hosts/chaski/services/VaaS/default.nix | 30 ------ hosts/chaski/services/VaaS/haskell.cabal | 35 ------ hosts/chaski/services/VaaS/index.html | 46 -------- hosts/chaski/services/exneuland.nix | 58 ---------- hosts/chaski/services/geolocation.nix | 6 -- hosts/chaski/services/gtfs.nix | 38 ------- hosts/chaski/services/jitsi.nix | 59 ---------- hosts/chaski/services/uplcg.nix | 23 ---- hosts/chaski/services/woitb.nix | 32 ------ hosts/chaski/services/woitb/index.html | 124 --------------------- hosts/chaski/services/woitb/info.html | 180 ------------------------------- hosts/chaski/services/workadventure.nix | 93 ---------------- 15 files changed, 788 deletions(-) delete mode 100644 hosts/chaski/services/VaaS/.gitignore delete mode 100644 hosts/chaski/services/VaaS/CHANGELOG.md delete mode 100644 hosts/chaski/services/VaaS/app/Main.hs delete mode 100644 hosts/chaski/services/VaaS/default.nix delete mode 100644 hosts/chaski/services/VaaS/haskell.cabal delete mode 100644 hosts/chaski/services/VaaS/index.html delete mode 100644 hosts/chaski/services/exneuland.nix delete mode 100644 hosts/chaski/services/geolocation.nix delete mode 100644 hosts/chaski/services/gtfs.nix delete mode 100644 hosts/chaski/services/jitsi.nix delete mode 100644 hosts/chaski/services/uplcg.nix delete mode 100644 hosts/chaski/services/woitb.nix delete mode 100644 hosts/chaski/services/woitb/index.html delete mode 100644 hosts/chaski/services/woitb/info.html delete mode 100644 hosts/chaski/services/workadventure.nix (limited to 'hosts/chaski/services') diff --git a/hosts/chaski/services/VaaS/.gitignore b/hosts/chaski/services/VaaS/.gitignore deleted file mode 100644 index b5e3679..0000000 --- a/hosts/chaski/services/VaaS/.gitignore +++ /dev/null @@ -1 +0,0 @@ -dist-newstyle/* diff --git a/hosts/chaski/services/VaaS/CHANGELOG.md b/hosts/chaski/services/VaaS/CHANGELOG.md deleted file mode 100644 index 500a0d0..0000000 --- a/hosts/chaski/services/VaaS/CHANGELOG.md +++ /dev/null @@ -1,5 +0,0 @@ -# Revision history for haskell - -## 0.1.0.0 -- YYYY-mm-dd - -* First version. Released on an unsuspecting world. diff --git a/hosts/chaski/services/VaaS/app/Main.hs b/hosts/chaski/services/VaaS/app/Main.hs deleted file mode 100644 index b5697d7..0000000 --- a/hosts/chaski/services/VaaS/app/Main.hs +++ /dev/null @@ -1,58 +0,0 @@ -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE OverloadedStrings #-} - -module Main where - -import Control.Exception (try) -import Control.Exception.Base (handle) -import qualified Data.ByteString as BS -import Data.ByteString.Base32 -import qualified Data.ByteString.Char8 as C8 -import qualified Data.ByteString.Lazy as LB -import Data.Maybe (mapMaybe) -import Network.HTTP.Client (httpLbs, newManager, parseRequest, - responseBody) -import Network.HTTP.Client.TLS -import Network.HTTP.Types -import Network.Wai -import Network.Wai.Handler.Warp (run) -import qualified System.Environment as SE -import System.Process - -simpleResponse = responseLBS status200 [("Content-Type", "text/plain")] - -simpleError = responseLBS status400 [("Content-Type", "text/plain")] - -serveFile filename = do - content <- LB.readFile filename - pure $ responseLBS status200 [("Content-Type", "text/html")] content - -app :: FilePath -> FilePath -> Application -app validator index req respond = - case requestMethod req of - "GET" -> case pathInfo req of - [] -> serveFile index >>= respond - ["validate"] -> do - let gtfsuri = head $ mapMaybe (\case { ("gtfs",a) -> Just a; _ -> Nothing }) $ queryString req - putStrLn $ "uri is " <> show gtfsuri - case gtfsuri of - Just uri -> do - man <- newManager tlsManagerSettings - request <- parseRequest $ C8.unpack uri - gtfs <- httpLbs request man - let filename = "/tmp/" <> C8.unpack (encodeBase32' uri) <> ".zip" - LB.writeFile filename (responseBody gtfs) - readProcessWithExitCode "python" [validator,"-n", filename, "--output", "/tmp/gtfs-validated.html"] "" - - serveFile "/tmp/gtfs-validated.html" >>= respond - - Nothing -> respond $ simpleError "missing gtfs parameter" - _ -> respond $ simpleError "unknown path" - _ -> respond $ simpleError "invalid reqeust method" - -main :: IO () -main = do - args <- SE.getArgs - let validator = head args - putStrLn "http://localhost:7000/" - run 7000 $ app validator (args!!1) diff --git a/hosts/chaski/services/VaaS/default.nix b/hosts/chaski/services/VaaS/default.nix deleted file mode 100644 index 427270c..0000000 --- a/hosts/chaski/services/VaaS/default.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ pkgs, compiler ? "default", doBenchmark ? false }: - -let - - inherit pkgs; - - f = { mkDerivation, base, base32, bytestring, http-client - , http-client-tls, http-types, lib, process, wai, warp - }: - mkDerivation { - pname = "VaaS"; - version = "0.1.0.0"; - src = ./.; - isLibrary = false; - isExecutable = true; - executableHaskellDepends = [ - base base32 bytestring http-client http-client-tls http-types - process wai warp - ]; - license = "unknown"; - hydraPlatforms = lib.platforms.none; - }; - - haskellPackages = if compiler == "default" - then pkgs.haskellPackages - else pkgs.haskell.packages.${compiler}; - - variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id; -in - variant (haskellPackages.callPackage f {}) diff --git a/hosts/chaski/services/VaaS/haskell.cabal b/hosts/chaski/services/VaaS/haskell.cabal deleted file mode 100644 index 262b65f..0000000 --- a/hosts/chaski/services/VaaS/haskell.cabal +++ /dev/null @@ -1,35 +0,0 @@ -cabal-version: 2.4 -name: VaaS -version: 0.1.0.0 - --- A short (one-line) description of the package. --- synopsis: - --- A longer description of the package. --- description: - --- A URL where users can report bugs. --- bug-reports: - --- The license under which the package is released. --- license: -author: stuebinm -maintainer: stuebinm@disroot.org - --- A copyright notice. --- copyright: --- category: -extra-source-files: CHANGELOG.md - -executable VaaS - main-is: Main.hs - - -- Modules included in this executable, other than Main. - -- other-modules: - - -- LANGUAGE extensions used by modules in this package. - -- other-extensions: - build-depends: base ^>=4.14.1.0, wai, warp, http-types, bytestring, process, - http-client, http-client-tls, base32 - hs-source-dirs: app - default-language: Haskell2010 diff --git a/hosts/chaski/services/VaaS/index.html b/hosts/chaski/services/VaaS/index.html deleted file mode 100644 index a7f59e0..0000000 --- a/hosts/chaski/services/VaaS/index.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - GTFS Validator - - - - - - - - - - -

GTFS Validator

-

- This runs the validator contained in the - transitfeed - git repository - . -

- -

Paste the url to your GTFS zip below

- - - - - - - diff --git a/hosts/chaski/services/exneuland.nix b/hosts/chaski/services/exneuland.nix deleted file mode 100644 index 3ec3451..0000000 --- a/hosts/chaski/services/exneuland.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - workadventure-nix = builtins.fetchGit { - url = "https://stuebinm.eu/git/workadventure-nix"; - ref = "master"; - }; - wapkgs = import "${workadventure-nix.outPath}/wapkgs.nix" { - inherit pkgs; - lib = pkgs.lib; - }; - frontdrv = wapkgs.workadventure-tcm.front.override { - environment = { - PUSHER_URL = "https://exneuland.stuebinm.eu/pusher"; - START_ROOM_URL = "/_/global/world.di.c3voc.de/maps/main.json"; - }; - }; - exneuland = import ../../../pkgs/exneuland.nix; -in -{ - services.nginx = { - enable = true; - recommendedProxySettings = false; - virtualHosts."exneuland.stuebinm.eu" = { - root = "${frontdrv}/dist"; - locations."/_/".tryFiles = "/index.html =404"; - - locations."/pusher" = { - proxyPass = "http://localhost:4000"; - proxyWebsockets = true; - extraConfig = '' - add_header Access-Control-Allow-Origin https://exneuland.stuebinm.eu; - proxy_pass_request_headers on; - 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_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Host $http_host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection $http_connection; - ''; - }; - - enableACME = true; - forceSSL = true; - }; - }; - - systemd.services.exneuland = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - description = "exneuland backend for workadventure"; - serviceConfig = { - ExecStart = "${exneuland}/bin/exneuland start"; - Restart = "always"; - }; - }; -} diff --git a/hosts/chaski/services/geolocation.nix b/hosts/chaski/services/geolocation.nix deleted file mode 100644 index 4b095bd..0000000 --- a/hosts/chaski/services/geolocation.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - services.nginx.virtualHosts."ilztal.live".locations."/geolocation".root = - ../../../assets/ilztal.live; -} diff --git a/hosts/chaski/services/gtfs.nix b/hosts/chaski/services/gtfs.nix deleted file mode 100644 index 61837a1..0000000 --- a/hosts/chaski/services/gtfs.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - vaas = import ./VaaS/default.nix {inherit pkgs; }; - - transitfeed = pkgs.fetchFromGitHub { - owner = "google"; - repo = "transitfeed"; - rev = "d727e97cb66ac2ca2d699a382ea1d449ee26c2a1"; - sha256 = "0kmcmdja6h7gzvi40c9qfzxh6qwv5184g2rgpqx5rhj4ql9ini3h"; - }; - - index = pkgs.copyPathToStore ./VaaS/index.html; -in -{ - systemd.services.vaas = { - enable = true; - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; - description = "GTFS feed validator as a service"; - path = [ pkgs.python2 pkgs.python2Packages.pytz pkgs.python2Packages.enum34 ]; - serviceConfig = { - ExecStart = "${vaas}/bin/VaaS ${transitfeed}/feedvalidator.py ${index}"; - Restart = "always"; - PrivateTmp = "true"; - PrivateDevices = "true"; - ProtectSystem = "strict"; - ReadWritePaths = [ "/tmp" ]; - }; - - }; - - services.nginx.virtualHosts."gtfs.stuebinm.eu" = { - enableACME = true; - forceSSL = true; - locations."/".proxyPass = "http://localhost:7000"; - }; -} diff --git a/hosts/chaski/services/jitsi.nix b/hosts/chaski/services/jitsi.nix deleted file mode 100644 index d6f398b..0000000 --- a/hosts/chaski/services/jitsi.nix +++ /dev/null @@ -1,59 +0,0 @@ -{config, pkgs, ...}: - -with pkgs.luaPackages; -with pkgs; -let extraLua = import ../../../../playground/jitsi/test.nix; -in - -{ - services.jitsi-meet = { - enable = true; - hostName = "jitsi.stuebinm.eu"; - config = { - enableWelcomePage = true; - prejoinPageEnabled = true; - }; - interfaceConfig = { - SHOW_JITSI_WATERMARK = false; - SHOW_WATERMARK_FOR_GUESTS = false; - }; - }; - services.jitsi-videobridge.openFirewall = true; - - services.nginx.virtualHosts."api.jitsi.stuebinm.eu" = { - locations."/room-size" = { - proxyPass = pkgs.lib.mkForce - "http://jitsi.stuebinm.eu:5280/room-size?$args&domain=jitsi.stuebinm.eu"; - - extraConfig = '' - add_header Access-Control-Allow-Origin *; - ''; - }; - locations."/room-list" = { - proxyPass = "http://jitsi.stuebinm.eu:5280/room-list?domain=jitsi.stuebinm.eu"; - extraConfig = '' - add_header Access-Control-Allow-Origin *; - ''; - }; - locations."/dashboard/".root = - pkgs.copyPathToStore ../../../../playground/jitsi/html; - - enableACME = true; - forceSSL = true; - }; - - services.nginx.recommendedProxySettings = false; - - services.prosody = { - #extraModules = [ "muc_size2" ]; - extraModules = [ "jitsi_bundled" ]; - extraPluginPaths = [ - (pkgs.copyPathToStore ../../../../playground/jitsi/plugins) - ]; - package = pkgs.prosody.override { - withExtraLibs = with extraLua; [ basexx luajwtjitsi net-url ]; - }; - }; - - -} diff --git a/hosts/chaski/services/uplcg.nix b/hosts/chaski/services/uplcg.nix deleted file mode 100644 index 5605046..0000000 --- a/hosts/chaski/services/uplcg.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -{ - imports = [ - "${inputs.uplcg.outPath}/module.nix" - ]; - - services.uplcg = { - enable = true; - port = 9080; - domain = "0.0.0.0"; - }; - - services.nginx.enable = true; - services.nginx.virtualHosts."cards.stuebinm.eu" = { - locations."/" = { - proxyPass = "http://localhost:9080"; - proxyWebsockets = true; - }; - enableACME = true; - forceSSL = true; - }; -} diff --git a/hosts/chaski/services/woitb.nix b/hosts/chaski/services/woitb.nix deleted file mode 100644 index 0c50617..0000000 --- a/hosts/chaski/services/woitb.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, lib, pkgs, inputs, ... }: - -let - #sources = ../../nix/sources.nix; - sources = /home/stuebinm/Dokumente/utils/playground/ilztal/server; -in -{ - # systemd.services.woitb = { - # enable = true; - # description = "wo ist die ilztalbahn?"; - # wantedBy = [ "multi-user.target" ]; - # serviceConfig.type = "simple"; - # script = "${import sources}/bin/woitb"; - # }; - - services.nginx.enable = true; - services.nginx.virtualHosts."ilztal.live" = { - enableACME = true; - forceSSL = true; - locations."/".root = pkgs.copyPathToStore ./woitb; - - # locations."/upnext".proxyPass = "http://localhost:8000"; - # locations."/geoloc".proxyPass = "http://localhost:8000"; - }; - - services.nginx.virtualHosts."track.ilztal.live" = { - enableACME = true; - forceSSL = true; - locations."/".root = inputs.tracktrain; - }; - -} diff --git a/hosts/chaski/services/woitb/index.html b/hosts/chaski/services/woitb/index.html deleted file mode 100644 index 8d08826..0000000 --- a/hosts/chaski/services/woitb/index.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - Wo ist die Ilztalbahn? - - - - - - - - - - -

Wo ist die Ilztalbahn gerade?

- -

(es gibt eh nur eine)

- -

Gerade nicht unterwegs

Nächste Fahrt 2022

Fahrplan ist noch nicht bekannt.

- -
-

Andere Abfahrten ab Passau via marudor.de | via Iris der DB

- -

(Diese Seite also known as "oh, die Ilztalbahn hat ja Open Data 😍" – Weitere Infos)

-
- - - - diff --git a/hosts/chaski/services/woitb/info.html b/hosts/chaski/services/woitb/info.html deleted file mode 100644 index e68d728..0000000 --- a/hosts/chaski/services/woitb/info.html +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - Wo ist die Ilztalbahn? - - - - - - - - - - -

Wo ist die Ilztalbahn – Über

- -
-

Was ist das hier?

-

- Diese Webseite zeigt den Fahrplan der Ilztalbahn an, - und macht sonst nicht viel. Bitte beachtet, dass diese Seite nicht von der Ilztalbahn GmbH, - dem Förderverein o.ä. betrieben wird, sondern nur ein privates Projekt einer einzelnen Person - ohne jede Verfügbarkeitsgarantie ist. -

- -

Wie funktioniert das?

-

- Die Ilztalbahn bietet ihren Fahrplan im offenen Standard GTFS - an. Weil GTFS an einigen Stellen ein manchmal schwer zu benutzender Standard ist (und nicht - jeder Besuch dieser Webseite einen Aufruf des GTFS der Ilztalbahn triggern muss), hängt noch - ein kleiner Server dazwischen der die relevanten Teile in JSON übersetzt. -

-

- Der Fahrplan ist jeweils für einen ganzen Sommer gültig, und wird auch währenddessen - (soweit ich sehen kann) nicht verändert oder aktualisiert — es gibt also keinerlei Garantie, - dass die Daten hier korrekt sind! -

- -

Gibt es das auch als App?

-

- Aktuell nicht. Wenn ihr die Webseite im Browser offen lasst, sollte sie sich aber auch offline - noch automatisch aktualisieren. -

- -

Werden Verspätungen/etc. angezeigt?

-

- Leider nein. Es gibt für einige Fahrten der Ilztalbahn zwar Echtzeitdaten von der DB, diese - sind aber nicht im Datensatz der Ilztalbahn enthalten. Vielleicht kommen die hier noch - irgendwann mit rein, solange könnt ihr sie (falls es sie gibt) bei - marudor.de anschauen. -

- -

Gibts hier Quellcode zu?

-

- Ja klar, hier: git-Repository -

- -

Datenschutz?

-

- Diese Seite läuft aktuell auf einer kleinen vps bei Hetzner, - geloggt werden aktuell nur Zugriffe, aber keine IP-Adressen. -

- -

Wer macht das hier?

-

- Auch nur so ein Mensch im Internet. Falls ihr wollt könnt ihr - auf meinem Pleroma vorbeischauen. -

- -

Ich hab ne Idee für ein Feature!

-

- Schreibt mich über Pleroma an, vielleicht habe ich Zeit und Lust es einzubauen. -

- -

Ich hab ein Feature dazuimplementiert!

-

- Cool! Schick mir gerne nen Patch! (Mail ist im Repository) -

-
-
-

(Diese Seite also known as "oh, die Ilztalbahn hat ja Open Data 😍" – Weitere Infos)

-
- - - diff --git a/hosts/chaski/services/workadventure.nix b/hosts/chaski/services/workadventure.nix deleted file mode 100644 index c2b704f..0000000 --- a/hosts/chaski/services/workadventure.nix +++ /dev/null @@ -1,93 +0,0 @@ -{pkgs, lib, config, ...}: - -let - sources = import ../../../nix/sources.nix {}; - # why the double outPath? Dunno, just niv things … - workadventure-nix = sources.workadventure.outPath.outPath; - packageset = ( - import "${workadventure-nix}/wapkgs.nix" { - inherit pkgs lib; - } - ).workadventure-xce; -in -{ - # not the most intuitive of container names, but "workadventure" is too long - containers.wa-space = { - - # we'll need the outer config to get the turn secret inside the container, - # and I'm feeling haskelly so config' it is! - config = let config' = config; in {config, pkgs, ...}: { - imports = [ workadventure-nix ]; - networking.firewall.allowedTCPPorts = [ 80 ]; - - services.workadventure."space.stuebinm.eu" = { - inherit packageset; - - nginx = { - default = true; - domain = "space.stuebinm.eu"; - maps.serve = true; - maps.path = "/workadventuremaps/"; - }; - - frontend.startRoomUrl = "/_/global/space.stuebinm.eu/maps/Floor0/floor0.json"; - - commonConfig = { - webrtc.stun.url = "stun:space.stuebinm.eu:3478"; - webrtc.turn = { - url = "turn:95.217.159.23"; - user = "turn"; - password = config'.services.coturn.static-auth-secret; - }; - jitsi.url = "meet.ffmuc.net"; - }; - }; - }; - - privateNetwork = true; - hostAddress6 = "fd00::42:14"; - localAddress6 = "fd00::42:16"; - - autoStart = true; - - }; - - services.coturn = { - enable = true; - realm = "turn.hacc.space"; - # this is a static "secret" that is also compiled into workadventure, - # so it seems ok to put it into the nix store - static-auth-secret = "1c496cea367f9608c77a754c1ef78079a512e013"; - use-auth-secret = true; - no-cli = true; - no-tcp-relay = true; - - cert = config.security.acme.certs."space.stuebinm.eu".directory + "full.pem"; - pkey = config.security.acme.certs."space.stuebinm.eu".directory + "key.pem"; - }; - - - services.nginx = { - virtualHosts."space.stuebinm.eu" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://[${config.containers.wa-space.localAddress6}]"; - proxyWebsockets = true; - }; - }; - }; - - - networking.firewall = with config.services.coturn; - let - ports = [ listening-port tls-listening-port ]; - in { - allowedTCPPorts = [ 80 ] ++ ports; - allowedUDPPorts = ports; - allowedUDPPortRanges = [ - { from = min-port; to = max-port; } - ]; - }; - -} -- cgit v1.2.3