WIP: flora-6/gitea: Move towards docker containers #161

Closed
b12f wants to merge 1 commit from update/gitea-docker into infra

View file

@ -16,6 +16,67 @@
owner = "gitea"; owner = "gitea";
}; };
users.users.git = {
description = "Gitea SSH Service";
home = "/var/lib/gitea/git";
Review

Let's stick to the gitea docs:

    home = "/home/git";
Let's stick to the gitea docs: ``` home = "/home/git"; ```
useDefaultShell = false;
Review
    shell = "/home/git/ssh-shell";
``` shell = "/home/git/ssh-shell"; ```
uid = 995;
Review

995 is taken by user systemd-oom, uid 992 is still free on flora-6.

`995` is taken by user `systemd-oom`, uid `992` is still free on flora-6.
isSystemUser = true;
};
virtualisation = {
docker = {
enable = true; # sadly podman is not supported rightnow
};
oci-containers = {
backend = "docker";
containers."gitea" = {
image = "gitea:gitea:1.18.3";
Review
       image = "gitea/gitea:1.18.3";
``` image = "gitea/gitea:1.18.3"; ```
autoStart = true;
user = "995";
Review

Let's use 992 here, too.

Let's use `992` here, too.
ports = [
"127.0.0.1:3000:3000"
"127.0.0.1:2222:22"
];
volumes = [
"/var/lib/gitea:/data"
Review
          "/home/git/.ssh/:/data/git/.ssh"
``` "/home/git/.ssh/:/data/git/.ssh"
# Secrets go in the app.ini file, the rest wil be done in nix via environment variables
"/var/lib/gitea/custom/conf/app.ini:/${config.age.secrets.gitea-secrets-app-ini.path}"
Review
          "${config.age.secrets.gitea-secrets-app-ini.path}:/data/gitea/conf/app.ini" 
``` "${config.age.secrets.gitea-secrets-app-ini.path}:/data/gitea/conf/app.ini" ```
"/etc/timezone:/etc/timezone:ro"
"/etc/localtime:/etc/localtime:ro"
];
extraOptions = [
"--network=gitea"
];
environment = {
USER_UID = "postgres";
USER_GID = "postgres";
Review

Let's match the user inside the container with the git user on the host

          USER = "git";
          USER_UID = "992";
          USER_GID = "991";
Let's match the user inside the container with the `git` user on the host ``` USER = "git"; USER_UID = "992"; USER_GID = "991"; ```
RUN_MODE = "prod";
SSH_DOMAIN = "git.pub.solar";
ROOT_URL = "git.pub.solar";
DB_TYPE = "postgres";
DB_HOST = "gitea-db";
DISABLE_REGISTRATION = "true";
};
Review
        dependsOn = ["gitea-db"];
``` dependsOn = ["gitea-db"]; ```
};
containers."gitea-db" = {
image = "postgres:14";
autoStart = true;
volumes = [
"/var/lib/gitea-db:/var/lib/postgresql/data"
];
extraOptions = [
"--network=gitea"
];
environmentFiles = [
config.age.secrets.gitea-db-secrets.path
];
};
};
};
# gitea # gitea
services.gitea = { services.gitea = {
enable = true; enable = true;