persist attic data
This commit is contained in:
parent
f8b0e13356
commit
0c57b2deae
4 changed files with 90 additions and 22 deletions
|
@ -1,33 +1,94 @@
|
|||
{
|
||||
kubernetes.resources = {
|
||||
deployments.atticd = {
|
||||
metadata.labels.app = "atticd";
|
||||
{ pkgs, ... }: {
|
||||
kubernetes.resources =
|
||||
let
|
||||
atticdSettings = {
|
||||
database.url = "ref+sops://secrets/sops.yaml#atticd/databaseURL";
|
||||
|
||||
spec = {
|
||||
selector.matchLabels.app = "atticd";
|
||||
storage = {
|
||||
type = "local";
|
||||
path = "/var/lib/atticd/storage";
|
||||
};
|
||||
|
||||
template = {
|
||||
metadata.labels.app = "atticd";
|
||||
listen = "[::]:8080";
|
||||
|
||||
spec = {
|
||||
containers.atticd = {
|
||||
image = "git.kun.is/pim/atticd-nix-image:test";
|
||||
ports.web.containerPort = 8080;
|
||||
# Data chunking
|
||||
#
|
||||
# Warning: If you change any of the values here, it will be
|
||||
# difficult to reuse existing chunks for newly-uploaded NARs
|
||||
# since the cutpoints will be different. As a result, the
|
||||
# deduplication ratio will suffer for a while after the change.
|
||||
chunking = {
|
||||
# The minimum NAR size to trigger chunking
|
||||
#
|
||||
# If 0, chunking is disabled entirely for newly-uploaded NARs.
|
||||
# If 1, all NARs are chunked.
|
||||
nar-size-threshold = 64 * 1024; # 64 KiB
|
||||
|
||||
# The preferred minimum size of a chunk, in bytes
|
||||
min-size = 16 * 1024; # 16 KiB
|
||||
|
||||
# The preferred average size of a chunk, in bytes
|
||||
avg-size = 64 * 1024; # 64 KiB
|
||||
|
||||
# The preferred maximum size of a chunk, in bytes
|
||||
max-size = 256 * 1024; # 256 KiB
|
||||
};
|
||||
};
|
||||
generatedConfig = (pkgs.formats.toml { }).generate "atticd.toml" atticdSettings;
|
||||
in
|
||||
{
|
||||
configMaps = {
|
||||
atticd-env.data.ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64 = "ref+sops://secrets/sops.yaml#atticd/jwtToken";
|
||||
atticd-config.data.config = builtins.readFile generatedConfig;
|
||||
};
|
||||
|
||||
deployments.atticd = {
|
||||
metadata.labels.app = "atticd";
|
||||
|
||||
spec = {
|
||||
selector.matchLabels.app = "atticd";
|
||||
|
||||
template = {
|
||||
metadata.labels.app = "atticd";
|
||||
|
||||
spec = {
|
||||
containers.atticd = {
|
||||
image = "git.kun.is/home/atticd:fd910d91c2143295e959d2c903e9ea25cf94ba27";
|
||||
envFrom = [{ configMapRef.name = "atticd-env"; }];
|
||||
ports.web.containerPort = 8080;
|
||||
args = [ "-f" "/etc/atticd/config.toml" ];
|
||||
|
||||
volumeMounts = [
|
||||
{
|
||||
name = "data";
|
||||
mountPath = "/var/lib/atticd/storage";
|
||||
}
|
||||
{
|
||||
name = "config";
|
||||
mountPath = "/etc/atticd/config.toml";
|
||||
subPath = "config";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
volumes = {
|
||||
data.persistentVolumeClaim.claimName = "atticd";
|
||||
config.configMap.name = "atticd-config";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.atticd.spec = {
|
||||
selector.app = "atticd";
|
||||
services.atticd.spec = {
|
||||
selector.app = "atticd";
|
||||
|
||||
ports.web = {
|
||||
port = 80;
|
||||
targetPort = "web";
|
||||
ports.web = {
|
||||
port = 80;
|
||||
targetPort = "web";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
lab = {
|
||||
ingresses.atticd = {
|
||||
|
@ -38,5 +99,7 @@
|
|||
portName = "web";
|
||||
};
|
||||
};
|
||||
|
||||
nfsVolumes.atticd.path = "atticd";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
spec = {
|
||||
containers.blog = {
|
||||
image = "git.kun.is/home/blog-pim:5a7cb47dd4a8b6286f6987781683b174cd280b95";
|
||||
image = "git.kun.is/home/blog-pim:fd910d91c2143295e959d2c903e9ea25cf94ba27";
|
||||
ports.web.containerPort = 80;
|
||||
};
|
||||
};
|
||||
|
|
Reference in a new issue