1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

alew: init on ful

This commit is contained in:
2024-11-15 09:48:11 +01:00
parent a1a0a517a2
commit ee24ef7340
3 changed files with 92 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
inputs = {
agenix.url = "github:ryantm/agenix";
# alew-web.url = "git+ssh://gitea@code.kmein.de:22022/kfm/alew-web.git?ref=refs/heads/master";
brockman.url = "github:kmein/brockman";
coptic-dictionary.url = "github:kmein/coptic-dictionary";
flake-utils.url = "github:numtide/flake-utils";
@@ -17,9 +18,9 @@
nur.url = "github:nix-community/NUR";
recht.url = "github:kmein/recht";
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
stockholm.url = "github:krebs/stockholm";
rust-overlay.url = "github:oxalica/rust-overlay";
scripts.url = "github:kmein/scripts";
stockholm.url = "github:krebs/stockholm";
stylix.url = "github:danth/stylix/release-24.05";
telebots.url = "github:kmein/telebots";
tinc-graph.url = "github:kmein/tinc-graph";

89
systems/ful/alew.nix Normal file
View File

@@ -0,0 +1,89 @@
{ pkgs, config, inputs, ... }:
let
postgrestPort = 3001;
alewPort = 3000;
in
{
systemd.services.postgrest = {
enable = true;
wantedBy = ["podman-alew.service"];
wants = ["postgresql.service"];
environment = {
PGRST_DB_ANON_ROLE = "alew_1";
PGRST_DB_SCHEMA = "alew_2022_05"; # alew_2023_09 for most recent (beta)
PGRST_DB_URI = "postgres://alew_1:alew_1@localhost:5432/alew";
PGRST_SERVER_PORT = toString postgrestPort;
};
script = "${pkgs.postgrest}/bin/postgrest";
serviceConfig = {
User = "postgres";
Group = "postgres";
};
};
services.nginx.virtualHosts."alew.kmein.de" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString alewPort}";
};
};
# deploy nuxt app using
# $ cd alew/web/
# $ rsync -rav --delete . ful:/var/lib/alew --exclude .git --exclude .nuxt --exclude node_modules
systemd.services.alew = {
enable = true;
wantedBy = ["multi-user.target"];
wants = ["postgrest.service"];
path = [
pkgs.yarn
pkgs.python3
pkgs.gcc
pkgs.bash
pkgs.coreutils
pkgs.gnumake
];
environment = {
NODE_OPTIONS= "--openssl-legacy-provider";
POSTGREST_URL = "http://localhost:${toString postgrestPort}";
BETA = "0";
PORT = toString alewPort;
};
preStart = ''
rsync -rav --delete ${inputs.alew-web.outPath}/ .
yarn install
yarn build
'';
script = "yarn start";
serviceConfig = {
User = "alew";
Group = "alew";
WorkingDirectory = config.users.extraUsers.alew.home;
};
};
users.extraUsers.alew = {
isSystemUser = true;
createHome = true;
home = "/var/lib/alew";
group = "alew";
};
users.extraGroups.alew = {};
environment.systemPackages = [pkgs.podman];
services.postgresql = {
enable = true;
ensureDatabases = ["alew"];
ensureUsers = [
{
name = "alew";
ensureDBOwnership = true;
}
{ name = "alew_1"; } # readonly
];
package = pkgs.postgresql_16;
};
}

View File

@@ -13,6 +13,7 @@ in {
./panoptikon.nix
./hledger.nix
./brockman.nix
./alew.nix
../../configs/monitoring.nix
../../configs/tor.nix
../../configs/save-space.nix