mirror of
https://github.com/TheWanderingCrow/CrOS.git
synced 2026-01-10 01:24:05 -05:00
booklore up and running
This commit is contained in:
parent
6ce540f5aa
commit
213cc8c10a
4 changed files with 89 additions and 34 deletions
8
flake.lock
generated
8
flake.lock
generated
|
|
@ -188,11 +188,11 @@
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1765897479,
|
"lastModified": 1765919359,
|
||||||
"narHash": "sha256-0F5UW4sb3wKd9TwDoEvEGEb+eFov92jOERRpDN7n6bM=",
|
"narHash": "sha256-gUvmyGPzRf7skvhuwl6ose5SwvkdBtzgt7z9uYmGY/c=",
|
||||||
"ref": "refs/heads/master",
|
"ref": "refs/heads/master",
|
||||||
"rev": "0b68766f3340049baa1e01418b92905cad8888a1",
|
"rev": "0cefdfc056fbfe8d6ab706c89675193fa5b59f77",
|
||||||
"revCount": 161,
|
"revCount": 162,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://git@github.com/TheWanderingCrow/nix-secrets"
|
"url": "ssh://git@github.com/TheWanderingCrow/nix-secrets"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
# Quadlets
|
# Quadlets
|
||||||
"modules/quadlets"
|
"modules/quadlets"
|
||||||
|
"modules/quadlets/booklore"
|
||||||
|
|
||||||
# Hosted services
|
# Hosted services
|
||||||
"modules/services/mealie"
|
"modules/services/mealie"
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,24 @@
|
||||||
# FIXME(lib.custom): Add some stuff from hmajid2301/dotfiles/lib/module/default.nix, as simplifies option declaration
|
# FIXME(lib.custom): Add some stuff from hmajid2301/dotfiles/lib/module/default.nix, as simplifies option declaration
|
||||||
{lib, ...}: {
|
{ lib, ... }:
|
||||||
|
{
|
||||||
# use path relative to the root of the project
|
# use path relative to the root of the project
|
||||||
relativeToRoot = lib.path.append ../.;
|
relativeToRoot = lib.path.append ../.;
|
||||||
scanPaths = path:
|
scanPaths =
|
||||||
|
path:
|
||||||
builtins.map (f: (path + "/${f}")) (
|
builtins.map (f: (path + "/${f}")) (
|
||||||
builtins.attrNames (
|
builtins.attrNames (
|
||||||
lib.attrsets.filterAttrs (
|
lib.attrsets.filterAttrs (
|
||||||
path: _type:
|
path: _type:
|
||||||
(_type == "directory") # include directories
|
(_type == "directory") # include directories
|
||||||
|| (
|
|| (
|
||||||
(path != "default.nix") # ignore default.nix
|
(path != "default.nix") # ignore default.nix
|
||||||
&& (lib.strings.hasSuffix ".nix" path) # include .nix files
|
&& (lib.strings.hasSuffix ".nix" path) # include .nix files
|
||||||
)
|
)
|
||||||
) (builtins.readDir path)
|
) (builtins.readDir path)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
autoport =
|
||||||
|
service-name:
|
||||||
|
(builtins.fromTOML "v=0x${(builtins.substring 0 4 (builtins.hashString "md5" service-name))}").v
|
||||||
|
+ 1023;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,88 @@
|
||||||
{ config, ... }:
|
|
||||||
{
|
{
|
||||||
services.caddy.virtualHosts."booklore.wanderingcrow.net".extraConfig = ''
|
lib,
|
||||||
reverse_proxy http://10.88.0.4:6060
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
port = builtins.toString (lib.custom.autoport "booklore");
|
||||||
|
volumePath = "/overseer/services";
|
||||||
|
sopsFolder = inputs.nix-secrets + "/sops";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${volumePath}/booklore"
|
||||||
|
"d ${volumePath}/booklore/books"
|
||||||
|
"d ${volumePath}/booklore/bookdrop"
|
||||||
|
"d ${volumePath}/booklore/data"
|
||||||
|
"d ${volumePath}/booklore/database"
|
||||||
|
];
|
||||||
|
|
||||||
|
sops.secrets = {
|
||||||
|
"booklore/db/root_pass" = {
|
||||||
|
sopsFile = "${sopsFolder}/services.yaml";
|
||||||
|
};
|
||||||
|
"booklore/db/pass" = {
|
||||||
|
sopsFile = "${sopsFolder}/services.yaml";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sops.templates."booklore-env".content = ''
|
||||||
|
MYSQL_ROOT_PASSWORD = ${config.sops.placeholder."booklore/db/root_pass"}
|
||||||
|
MYSQL_PASSWORD = ${config.sops.placeholder."booklore/db/pass"}
|
||||||
|
DATABASE_PASSWORD = ${config.sops.placeholder."booklore/db/pass"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
services.caddy.virtualHosts."booklore.wanderingcrow.net".extraConfig = ''
|
||||||
|
reverse_proxy localhost:${port}
|
||||||
|
'';
|
||||||
|
|
||||||
virtualisation.quadlet = {
|
virtualisation.quadlet = {
|
||||||
containers = {
|
containers = {
|
||||||
booklore-web.containerConfig = {
|
booklore-web.containerConfig = {
|
||||||
image = "ghcr.io/booklore-app/booklore:v1.14.1";
|
image = "ghcr.io/booklore-app/booklore:v1.14.1";
|
||||||
environments = {
|
|
||||||
USER_ID = "0";
|
|
||||||
GROUP_ID = "0";
|
|
||||||
TZ = "America/New_York";
|
|
||||||
DATABASE_URL = "jdbc:mariadb://booklore-db:3306/booklore";
|
|
||||||
DB_USER = "booklore";
|
|
||||||
DB_PASSWORD = "changeme";
|
|
||||||
BOOKLORE_PORT = "6060";
|
|
||||||
};
|
|
||||||
publishPorts = [
|
|
||||||
""
|
|
||||||
];
|
|
||||||
pod = config.virtualisation.quadlet.pods.booklore.ref;
|
pod = config.virtualisation.quadlet.pods.booklore.ref;
|
||||||
|
environments = {
|
||||||
|
DATABASE_URL = "jdbc:mariadb://localhost:3306/booklore";
|
||||||
|
DATABASE_USERNAME = "booklore";
|
||||||
|
BOOKLORE_PORT = "6060";
|
||||||
|
# FIXME: convert to secrets
|
||||||
|
DATABASE_PASSWORD = "changeme";
|
||||||
|
};
|
||||||
|
environmentFiles = [
|
||||||
|
config.sops.templates."booklore-env".path
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"${volumePath}/booklore/books:/books"
|
||||||
|
"${volumePath}/booklore/bookdrop:/bookdrop"
|
||||||
|
"${volumePath}/booklore/data:/app/data"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
booklore-db.containerConfig = {
|
booklore-db.containerConfig = {
|
||||||
image = "lscr.io/linuxserver/mariadb:11.4.5";
|
image = "lscr.io/linuxserver/mariadb:11.4.8";
|
||||||
|
pod = config.virtualisation.quadlet.pods.booklore.ref;
|
||||||
environments = {
|
environments = {
|
||||||
PUID = "1000";
|
TZ = "Etc/UTC";
|
||||||
PGID = "1000";
|
PUID = "0";
|
||||||
TZ = "America/New_York";
|
PGID = "0";
|
||||||
MYSQL_ROOT_PASSWORD = "changeme";
|
|
||||||
MYSQL_DATABASE = "booklore";
|
|
||||||
MYSQL_USER = "booklore";
|
MYSQL_USER = "booklore";
|
||||||
|
MYSQL_DATABASE = "booklore";
|
||||||
|
# FIXME: convert to secrets
|
||||||
|
MYSQL_ROOT_PASSWORD = "changeme";
|
||||||
MYSQL_PASSWORD = "changeme";
|
MYSQL_PASSWORD = "changeme";
|
||||||
};
|
};
|
||||||
pod = config.virtualisation.quadlet.pods.booklore.ref;
|
environmentFiles = [
|
||||||
|
config.sops.templates."booklore-env".path
|
||||||
|
];
|
||||||
|
volumes = [
|
||||||
|
"${volumePath}/booklore/database:/config"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
pods.booklore = { };
|
pods.booklore = {
|
||||||
|
podConfig.publishPorts = [
|
||||||
|
"${port}:6060"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue