2024-07-24 15:49:31 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-01-22 15:50:05 -05:00
|
|
|
inherit (config.sops) secrets;
|
2024-07-24 15:49:31 -04:00
|
|
|
inherit (config.khepri) rwDataDir;
|
2024-01-22 15:50:05 -05:00
|
|
|
|
|
|
|
rwPath = rwDataDir + "/forgejo";
|
2024-01-07 04:37:11 -05:00
|
|
|
in {
|
2024-07-24 20:52:32 -04:00
|
|
|
khepri.compositions."forgejo" = {
|
|
|
|
networks.proxy_net = {external = true;};
|
|
|
|
|
|
|
|
services = {
|
|
|
|
"forgejo" = {
|
|
|
|
image = import ./images/forgejo.nix pkgs;
|
|
|
|
|
|
|
|
ports = [
|
|
|
|
# Redirect WAN port 22 to this port
|
|
|
|
"2222:22"
|
|
|
|
"3000:3000"
|
|
|
|
];
|
|
|
|
|
|
|
|
networks = ["proxy_net"];
|
|
|
|
|
|
|
|
restart = "always";
|
|
|
|
dependsOn = ["forgejo-db"];
|
|
|
|
|
|
|
|
environmentFiles = [secrets.forgejo.path];
|
|
|
|
environment = {
|
|
|
|
APP_NAME = "Gitea";
|
|
|
|
|
|
|
|
# TODO: change ids
|
|
|
|
USER_UID = "1000";
|
|
|
|
USER_GID = "1000";
|
|
|
|
|
|
|
|
ROOT_URL = "https://git.nelim.org";
|
|
|
|
SSH_DOMAIN = "git.nelim.org";
|
|
|
|
SSH_PORT = "22";
|
|
|
|
HTTP_PORT = "3000";
|
|
|
|
};
|
|
|
|
|
|
|
|
volumes = [
|
|
|
|
"${rwPath}/data:/data"
|
|
|
|
"/etc/timezone:/etc/timezone:ro"
|
|
|
|
"/etc/localtime:/etc/localtime:ro"
|
|
|
|
];
|
2024-01-07 04:37:11 -05:00
|
|
|
};
|
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
"forgejo-db" = {
|
|
|
|
image = import ./images/postgres.nix pkgs;
|
2024-01-07 04:37:11 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
restart = "always";
|
2024-01-07 04:37:11 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
environmentFiles = [secrets.forgejo-db.path];
|
|
|
|
networks = ["proxy_net"];
|
2024-01-07 04:37:11 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
volumes = ["${rwPath}/db:/var/lib/postgresql/data"];
|
|
|
|
};
|
2024-01-08 01:11:22 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
"act_runner" = {
|
|
|
|
image = import ./images/act_runner.nix pkgs;
|
2024-01-07 04:37:11 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
privileged = true;
|
|
|
|
user = "root:root";
|
|
|
|
networks = ["proxy_net"];
|
2024-07-24 15:49:31 -04:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
restart = "always";
|
|
|
|
dependsOn = ["forgejo"];
|
2024-01-08 01:11:22 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
environmentFiles = [secrets.forgejo-runner.path];
|
|
|
|
environment = {
|
|
|
|
GITEA_INSTANCE_URL = "https://git.nelim.org";
|
|
|
|
GITEA_RUNNER_NAME = "DinD";
|
|
|
|
};
|
2024-01-07 04:37:11 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
volumes = ["${rwPath}/act:/data"];
|
|
|
|
extraHosts = ["git.nelim.org:10.0.0.130"];
|
2024-01-08 01:11:22 -05:00
|
|
|
};
|
2024-01-07 04:37:11 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|