feat(ebook-search): set up uv cache management and pruning service
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 27s
test ebook search / test-ebook-search (pull_request) Successful in 34s
build_systems / build-brain (pull_request) Successful in 48s
build_systems / build-bob (pull_request) Successful in 50s
build_systems / build-rhapsody-in-green (pull_request) Successful in 1m3s
build_systems / build-jeeves (pull_request) Successful in 2m14s
treefmt / nix fmt (push) Successful in 4s
test ebook search / test-ebook-search (push) Successful in 27s
pytest / pytest (push) Successful in 30s
build_systems / build-brain (push) Successful in 34s
build_systems / build-bob (push) Successful in 37s
build_systems / build-jeeves (push) Successful in 2m9s
build_systems / build-rhapsody-in-green (push) Successful in 48s
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 27s
test ebook search / test-ebook-search (pull_request) Successful in 34s
build_systems / build-brain (pull_request) Successful in 48s
build_systems / build-bob (pull_request) Successful in 50s
build_systems / build-rhapsody-in-green (pull_request) Successful in 1m3s
build_systems / build-jeeves (pull_request) Successful in 2m14s
treefmt / nix fmt (push) Successful in 4s
test ebook search / test-ebook-search (push) Successful in 27s
pytest / pytest (push) Successful in 30s
build_systems / build-brain (push) Successful in 34s
build_systems / build-bob (push) Successful in 37s
build_systems / build-jeeves (push) Successful in 2m9s
build_systems / build-rhapsody-in-green (push) Successful in 48s
This commit was merged in pull request #40.
This commit is contained in:
@@ -11,6 +11,8 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
UV_PYTHON_DOWNLOADS: never
|
UV_PYTHON_DOWNLOADS: never
|
||||||
|
UV_CACHE_DIR: /var/cache/uv
|
||||||
|
UV_LINK_MODE: copy
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-ebook-search:
|
test-ebook-search:
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ docker compose -f python/ebook_search/docker/docker-compose.yml ps
|
|||||||
|
|
||||||
The image builds its environment with uv from `pyproject.toml` + `uv.lock` in this
|
The image builds its environment with uv from `pyproject.toml` + `uv.lock` in this
|
||||||
directory — this is the source of truth for the container's dependencies. To add or
|
directory — this is the source of truth for the container's dependencies. To add or
|
||||||
update a dependency, edit `pyproject.toml` here and regenerate the lock (requires uv
|
update a dependency, edit `pyproject.toml` here and regenerate the lock (uv is
|
||||||
on the host; it is not in the nix dev shell):
|
available in the `ebook-search` dev shell):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cd python/ebook_search/docker && uv lock
|
nix develop .#ebook-search -c uv lock --project python/ebook_search/docker
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
imports = [ ./nix_builder.nix ];
|
imports = [
|
||||||
|
./nix_builder.nix
|
||||||
|
./uv_cache_prune.nix
|
||||||
|
];
|
||||||
|
|
||||||
services.nix_builder.containers = {
|
services.nix_builder.containers = {
|
||||||
nix-builder-00.enable = true;
|
nix-builder-00.enable = true;
|
||||||
|
|||||||
@@ -62,6 +62,11 @@ in
|
|||||||
mountPoint = "/run/secrets/gitea-runners";
|
mountPoint = "/run/secrets/gitea-runners";
|
||||||
isReadOnly = true;
|
isReadOnly = true;
|
||||||
};
|
};
|
||||||
|
uv-cache = {
|
||||||
|
hostPath = vars.uv_cache;
|
||||||
|
mountPoint = "/var/cache/uv";
|
||||||
|
isReadOnly = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
config =
|
config =
|
||||||
{
|
{
|
||||||
@@ -138,7 +143,6 @@ in
|
|||||||
nixos-rebuild
|
nixos-rebuild
|
||||||
nodejs
|
nodejs
|
||||||
treefmt
|
treefmt
|
||||||
uv
|
|
||||||
wget
|
wget
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -154,7 +158,8 @@ in
|
|||||||
}
|
}
|
||||||
) cfg.containers;
|
) cfg.containers;
|
||||||
|
|
||||||
systemd.services = builtins.listToAttrs (
|
systemd = {
|
||||||
|
services = builtins.listToAttrs (
|
||||||
map (name: {
|
map (name: {
|
||||||
name = "container@${name}";
|
name = "container@${name}";
|
||||||
value = {
|
value = {
|
||||||
@@ -163,5 +168,10 @@ in
|
|||||||
};
|
};
|
||||||
}) (builtins.attrNames (filterAttrs (_: c: c.enable) cfg.containers))
|
}) (builtins.attrNames (filterAttrs (_: c: c.enable) cfg.containers))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tmpfiles.rules = [
|
||||||
|
"d ${vars.uv_cache} 0755 ${runnerUsername} ${runnerUsername} - -"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
vars = import ../vars.nix;
|
||||||
|
runnerUsername = "gitea-runner";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
systemd = {
|
||||||
|
services.uv-cache-prune = {
|
||||||
|
description = "Prune the shared gitea runner uv cache";
|
||||||
|
environment.UV_CACHE_DIR = vars.uv_cache;
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = runnerUsername;
|
||||||
|
Group = runnerUsername;
|
||||||
|
ExecStart = "${pkgs.uv}/bin/uv cache prune";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
timers.uv-cache-prune = {
|
||||||
|
description = "Monthly prune of the shared gitea runner uv cache";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "*-*-01 04:00:00";
|
||||||
|
Persistent = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ sudo zfs create media/secure/share -o mountpoint=/zfs/media/share -o exec=off
|
|||||||
# scratch datasets
|
# scratch datasets
|
||||||
sudo zfs create scratch/kafka -o mountpoint=/zfs/scratch/kafka -o recordsize=1M
|
sudo zfs create scratch/kafka -o mountpoint=/zfs/scratch/kafka -o recordsize=1M
|
||||||
sudo zfs create scratch/transmission -o mountpoint=/zfs/scratch/transmission -o recordsize=16k -o sync=disabled -o redundant_metadata=none
|
sudo zfs create scratch/transmission -o mountpoint=/zfs/scratch/transmission -o recordsize=16k -o sync=disabled -o redundant_metadata=none
|
||||||
|
sudo zfs create scratch/uv_cache -o mountpoint=/zfs/scratch/uv_cache
|
||||||
|
|
||||||
# storage datasets
|
# storage datasets
|
||||||
sudo zfs create storage/ollama -o recordsize=1M -o compression=zstd-19 -o sync=disabled
|
sudo zfs create storage/ollama -o recordsize=1M -o compression=zstd-19 -o sync=disabled
|
||||||
|
|||||||
@@ -121,3 +121,9 @@ monthly = 2
|
|||||||
hourly = 0
|
hourly = 0
|
||||||
daily = 0
|
daily = 0
|
||||||
monthly = 0
|
monthly = 0
|
||||||
|
|
||||||
|
["scratch/uv_cache"]
|
||||||
|
15_min = 2
|
||||||
|
hourly = 0
|
||||||
|
daily = 0
|
||||||
|
monthly = 0
|
||||||
|
|||||||
@@ -17,5 +17,6 @@ in
|
|||||||
transmission = "${zfs_storage}/transmission";
|
transmission = "${zfs_storage}/transmission";
|
||||||
ollama = "${zfs_storage}/ollama";
|
ollama = "${zfs_storage}/ollama";
|
||||||
transmission_scratch = "${zfs_scratch}/transmission";
|
transmission_scratch = "${zfs_scratch}/transmission";
|
||||||
|
uv_cache = "${zfs_scratch}/uv_cache";
|
||||||
kafka = "${zfs_scratch}/kafka";
|
kafka = "${zfs_scratch}/kafka";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user