diff --git a/machines/gerd.nix b/machines/gerd.nix index 936b29e..3a5adc1 100644 --- a/machines/gerd.nix +++ b/machines/gerd.nix @@ -30,7 +30,7 @@ ./gerd/services/uptime-kuma.nix - ./gerd/services/rallly.nix + ./gerd/services/rallly ]; networking.hostName = "gerd"; diff --git a/machines/gerd/services/rallly.nix b/machines/gerd/services/rallly/default.nix similarity index 81% rename from machines/gerd/services/rallly.nix rename to machines/gerd/services/rallly/default.nix index 6505507..cf77364 100644 --- a/machines/gerd/services/rallly.nix +++ b/machines/gerd/services/rallly/default.nix @@ -7,23 +7,27 @@ let psqlSocket = "/run/postgresql"; user = "rallly"; - group = user; port = 7384; - internal_port = port; - rally_version = "3.11"; - - ralllyPkgs = pkgs.callPackage ./../../../shared/pkgs/rallly {}; + ralllyPkgsOrig = pkgs.callPackage ./../../../../shared/pkgs/rallly {}; + ralllyPkgs = ralllyPkgsOrig.overrideAttrs (old: { + patches = (if old ? patches then old.patches else []) ++ [ + ./patches/remove-login-register.patch + ]; + }); in { + # setup rallly service systemd.services.rallly = { description = "rallly"; wantedBy = [ "multi-user.target" ]; after = [ "networking.target" ]; + # configuration environment = let rallly-prisma-engines = ralllyPkgs.passthru.rallly-prisma-engines; in rec { - PORT = builtins.toString internal_port; + HOSTNAME = "localhost"; + PORT = builtins.toString port; DATABASE_URL = "postgresql://${user}@localhost/${user}?host=${psqlSocket}"; NEXT_PUBLIC_BASE_URL = "https://${svc_domain}"; NEXTAUTH_URL = NEXT_PUBLIC_BASE_URL; @@ -47,7 +51,7 @@ in { OIDC_CLIENT_ID = "rallly"; # OIDC_CLIENT_SECRET = "specified-in-env"; - # prisma things + # prisma things (database will not work without, needs to match version in rallly deps as well) PRISMA_SCHEMA_ENGINE_BINARY = "${rallly-prisma-engines}/bin/schema-engine"; PRISMA_QUERY_ENGINE_BINARY = "${rallly-prisma-engines}/bin/query-engine"; PRISMA_QUERY_ENGINE_LIBRARY = "${rallly-prisma-engines}/lib/libquery_engine.node"; @@ -55,17 +59,27 @@ in { PRISMA_FMT_BINARY = "${rallly-prisma-engines}/bin/prisma-fmt"; }; + # add, otherwise we get warnings path = [ pkgs.openssl ]; serviceConfig = { - ExecStartPre = "${ralllyPkgs}/bin/rallly-prisma migrate deploy"; + ExecStartPre = [ + # clear cache on each boot, otherwise we might have + # issues when updating it. + "${pkgs.findutils}/bin/find -L /var/cache/${svc_name} -mindepth 1 -delete" + + # run db migration each boot + "${ralllyPkgs}/bin/rallly-prisma migrate deploy" + ]; ExecStart = "${ralllyPkgs}/bin/rallly"; + # secret configurations EnvironmentFile = [ config.age.secrets.rallly-env.path ]; - CacheDirectory = "rallly"; + CacheDirectory = svc_name; CacheDirectoryMode = "0750"; + User = user; DynamicUser = true; Restart = "always"; }; diff --git a/machines/gerd/services/rallly/patches/remove-login-register.patch b/machines/gerd/services/rallly/patches/remove-login-register.patch new file mode 100644 index 0000000..6828355 --- /dev/null +++ b/machines/gerd/services/rallly/patches/remove-login-register.patch @@ -0,0 +1,84 @@ +diff --git a/apps/web/src/app/[locale]/(auth)/login/login-form.tsx b/apps/web/src/app/[locale]/(auth)/login/login-form.tsx +index d4a2adcf..8137a790 100644 +--- a/apps/web/src/app/[locale]/(auth)/login/login-form.tsx ++++ b/apps/web/src/app/[locale]/(auth)/login/login-form.tsx +@@ -159,45 +159,7 @@ export function LoginForm() { + } + })} + > +-
+- {t("stepSummary", { +- current: 1, +- total: 2, +- })} +-
+- +