[bookstack] Adds bookstack and cleans up a bunch of other files. Rewrites how mariadb instances are provisioned.

This commit is contained in:
2025-03-25 14:37:12 -07:00
parent 0ddb2989b4
commit 83ed3a4809
7 changed files with 133 additions and 31 deletions

View File

@@ -28,15 +28,15 @@ in
dependsOn ? [],
domain ? havenisms,
volumes ? [],
environment ? [],
environment ? {},
environmentFiles ? [],
public ? false
}:
let routerRule = if public then hostRule hostName domain else localHostRule hostName domain;
in
{
image = image;
inherit image dependsOn volumes environment environmentFiles;
autoStart = true;
dependsOn = dependsOn;
extraOptions = [
"-l=traefik.enable=true"
"-l=traefik.http.routers.${hostName}.rule=${routerRule}"
@@ -47,7 +47,38 @@ in
"-l=homepage.href=https://${hostName}.${domain}"
"-l=homepage.description=${homepageOpts.description}"
];
volumes = volumes;
environment = environment;
};
# Creates a MariaDB container for a specific app. It should be safe to give
# it the same UID and GID as the app it is made for. The contaner will be
# named `${name}-mariadb`. The database name is the same as the database
# user.
#
# Note that this returns a _module_ so that it can be imported and provide many different config values.
mkMariaDbContainer = {
name,
uid,
gid,
passwordSecret,
directory,
}: { config, ... }: {
virtualisation.oci-containers.containers."${name}-mariadb" = {
image = "lscr.io/linuxserver/mariadb:latest";
autoStart = true;
ports = [ "3306:3306" ];
volumes = [
"${directory}:/config"
"${config.sops.secrets.mariadb_root_password.path}:/run/secrets/mariadb_root_password"
"${config.sops.secrets."${passwordSecret}".path}:/run/secrets/mariadb_password"
];
environment = {
PUID = "${toString uid}";
PGID = "${toString gid}";
MYSQL_USER = name;
MYSQL_DATABASE = name;
FILE__MYSQL_ROOT_PASSWORD = "/run/secrets/mariadb_root_password";
FILE__MYSQL_PASSWORD = "/run/secrets/mariadb_password";
};
};
};
}