1

Finally fix gitea + actions

This commit is contained in:
2023-11-09 19:39:46 +01:00
parent 1241196567
commit 715ad266ae
3 changed files with 49 additions and 11 deletions

View File

@ -15,6 +15,7 @@
./services/authelia.nix ./services/authelia.nix
./services/gitea.nix ./services/gitea.nix
./services/gitea-runner.nix ./services/gitea-runner.nix
# ./services/gitlab.nix
./services/homepage.nix ./services/homepage.nix
./services/nginx-proxy-manager.nix ./services/nginx-proxy-manager.nix
./services/pihole.nix ./services/pihole.nix
@ -139,11 +140,21 @@
users.users.christoph = { users.users.christoph = {
isNormalUser = true; isNormalUser = true;
description = "Christoph"; description = "Christoph";
extraGroups = ["networkmanager" "wheel"]; extraGroups = ["networkmanager" "wheel" "docker"];
shell = pkgs.fish; shell = pkgs.fish;
packages = with pkgs; []; packages = with pkgs; [];
}; };
users.users.git = {
uid = 500;
group = "git";
isNormalUser = false;
isSystemUser = true;
description = "Gitea User";
extraGroups = ["docker"];
shell = pkgs.fish;
};
home-manager.users.christoph = {pkgs, ...}: { home-manager.users.christoph = {pkgs, ...}: {
home.packages = with pkgs; [ home.packages = with pkgs; [
lazygit lazygit
@ -256,11 +267,15 @@
# PiHole requires these ports, as it's running in --net=host mode # PiHole requires these ports, as it's running in --net=host mode
53 53
80 80
3000 # Gitea runner needs to reach local gitea instance
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
# PiHole requires these ports, as it's running in --net=host mode # PiHole requires these ports, as it's running in --net=host mode
53 53
67 # PiHole DHCP 67 # PiHole DHCP
3000 # Gitea runner needs to reach local gitea instance
]; ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
enable = true; enable = true;

View File

@ -5,7 +5,10 @@
... ...
}: { }: {
virtualisation.oci-containers.containers.gitea-runner = { virtualisation.oci-containers.containers.gitea-runner = {
# Question: For gitea/act_runner dind set config.yaml/docker_host to "unix:///var/run/user/1000/docker.sock"?
image = "gitea/act_runner:latest"; image = "gitea/act_runner:latest";
# image = "vegardit/gitea-act-runner:dind-latest";
autoStart = true; autoStart = true;
dependsOn = [ dependsOn = [
@ -16,20 +19,40 @@
volumes = [ volumes = [
"gitea-runner_data:/data" "gitea-runner_data:/data"
"gitea-runner_config:/config" # Managed by env variables for vegardit image
"/var/run/docker.sock:/var/run/docker.sock" # For rootless-dind
# "gitea-runner_rootless-docker-auth:/home/rootless/.docker"
# Cache dind pulled images
# "gitea-runner_overlay2:/var/lib/docker/overlay2"
# "gitea-runner_image:/var/lib/docker/image"
"/var/run/docker.sock:/var/run/docker.sock" # Disable for dind
]; ];
environment = { environment = {
GITEA_INSTANCE_URL = "http://gitea:3000"; # NOTE: gitlab.local.chriphost.de doesn't work, because it gets resolved to 192.168.86.25:443, which is nginx
GITEA_INSTANCE_URL = "http://192.168.86.25:3000";
GITEA_RUNNER_NAME = "servenix";
# Can be generated from inside the container using act_runner generate-config > /config/config.yaml
CONFIG_FILE = "/config/config.yaml";
# NOTE: This token is invalid, when re-registering is needed it has to be refreshed # NOTE: This token is invalid, when re-registering is needed it has to be refreshed
GITEA_RUNNER_REGISTRATION_TOKEN = "nNNfjQOLmCVMdmx5rGZGCPYZwOH2jHVnQkFtaOYC"; GITEA_RUNNER_REGISTRATION_TOKEN = "2tYcfzALjmIKILPO4jnIdgfGO8RjBGIZCOoP4bYS";
GITEA_RUNNER_NAME = "servenix";
# These are for the specific vegardit/gitea-act-runner image
# GITEA_RUNNER_LOG_LEVEL = "debug";
# GITEA_INSTANCE_INSECURE = "true";
# GITEA_RUNNER_JOB_CONTAINER_NETWORK = "host"; # "host" for dind, "behind-nginx" otherwise
# GITEA_RUNNER_JOB_CONTAINER_PRIVILEGED = "true"; # Enable for dind
}; };
extraOptions = [ extraOptions = [
"--network=behind-nginx" # "--privileged" # Enable for dind
"--net=behind-nginx"
]; ];
}; };
} }

View File

@ -23,7 +23,7 @@
}; };
extraOptions = [ extraOptions = [
"--network=behind-nginx" "--net=behind-nginx"
]; ];
}; };
@ -50,9 +50,9 @@
]; ];
environment = { environment = {
USER = "christoph"; USER = "git";
USER_UID = "1000"; USER_UID = "500";
USER_GID = "100"; # USER_GID = "100";
GITEA__database__DB_TYPE = "postgres"; GITEA__database__DB_TYPE = "postgres";
GITEA__database__HOST = "gitea-db:5432"; GITEA__database__HOST = "gitea-db:5432";
@ -63,7 +63,7 @@
}; };
extraOptions = [ extraOptions = [
"--network=behind-nginx" "--net=behind-nginx"
]; ];
}; };
} }