dotfiles.nix/nixos/viridian/containers/microbin/default.nix

48 lines
1 KiB
Nix
Raw Normal View History

2024-08-08 09:02:42 +08:00
{config, ...}: let
2024-06-16 23:08:52 +08:00
port = "8181";
2024-08-08 09:02:42 +08:00
in {
2024-05-09 11:40:42 +08:00
age.secrets.microbin = {
2024-08-08 09:02:42 +08:00
# Environment variables for microbin
rekeyFile = ./environment.age;
owner = "sajenim";
group = "users";
2024-05-09 11:40:42 +08:00
};
virtualisation.oci-containers.containers = {
# Self-hosted, open-source pastbin
microbin = {
autoStart = true;
image = "danielszabo99/microbin:2.0";
ports = [
2024-06-16 23:08:52 +08:00
"${port}:8080/tcp" # WebUI
2024-05-09 11:40:42 +08:00
];
volumes = [
# Container data
"/srv/containers/microbin:/app/microbin_data:rw"
];
environmentFiles = [
config.age.secrets.microbin.path
];
};
};
services.traefik.dynamicConfigOptions.http.routers = {
microbin = {
rule = "Host(`bin.kanto.dev`)";
entryPoints = [
"websecure"
];
middlewares = [
"internal"
];
service = "microbin";
};
};
services.traefik.dynamicConfigOptions.http.services = {
microbin.loadBalancer.servers = [
2024-08-08 09:02:42 +08:00
{url = "http://127.0.0.1:${port}";}
];
};
2024-05-09 11:40:42 +08:00
}