Add Drone CI

This commit is contained in:
Greg Hellings
2022-10-10 21:52:49 +00:00
parent f18262fa0b
commit 9aaa2621e4
5 changed files with 82 additions and 4 deletions
+1
View File
@@ -4,6 +4,7 @@
imports = [
./git.nix
./hardware-configuration.nix
./podman.nix
./nextcloud.nix
./nginx.nix
./postgres.nix
+70 -4
View File
@@ -1,6 +1,17 @@
{ config, ... }:
{ config, pkgs, ... }:
{
let
srcDomain = "src.thehellings.com";
ciDomain = "ci.thehellings.com";
ciPort = "17080";
droneDir = "/var/lib/drone";
in {
##########################################################################################
###########
# GIT SERVICES
##########
##########################################################################################
services.gitea = rec {
enable = true;
appName = "Greg's Sources";
@@ -10,7 +21,7 @@
user = "gitea";
};
disableRegistration = true;
domain = "src.thehellings.com";
domain = srcDomain;
dump = {
enable = true;
type = "tar.xz";
@@ -18,7 +29,7 @@
rootUrl = "https://${domain}/";
};
greg.proxies."src.thehellings.com" = {
greg.proxies."${srcDomain}" = {
target = "http://localhost:${toString config.services.gitea.httpPort}";
ssl = true;
genAliases = false;
@@ -39,4 +50,59 @@
};
};
};
##########################################################################################
###########
# CI SERVICES
##########
##########################################################################################
# Service user
users.users.drone = {
isSystemUser = true;
group = "drone";
home = droneDir;
};
users.groups.drone = {};
# Environment secrets
age.secrets.drone = {
file = ../../secrets/drone.age;
owner = "root";
};
virtualisation.oci-containers = {
backend = "podman";
containers = {
"drone" = {
environment = {
DRONE_GITEA_SERVER = "https://${srcDomain}";
DRONE_SERVER_HOST = ciDomain;
DRONE_SERVER_PROTO = "https";
DRONE_SERVER_PROXY_HOST = ciDomain;
DRONE_SERVER_PROXY_PROTO = "https";
DRONE_TLS_AUTOCERT = "false"; # Suppress it generating SSL certificates, as our proxy handles that
};
environmentFiles = [
"/run/agenix/drone"
];
extraOptions = [ "--pull=newer" ];
image = "drone/drone:2.13";
ports = [ "${ciPort}:80" ];
volumes = [ "${droneDir}:/data" ];
};
};
};
systemd.services."podman-drone".serviceConfig = {
StateDirectory = "drone";
StateDirectoryMode = pkgs.lib.mkForce "0777";
WorkingDirectory = droneDir;
};
greg.proxies."${ciDomain}" = {
target = "http://localhost:${ciPort}";
ssl = true;
genAliases = false;
};
}
+9
View File
@@ -0,0 +1,9 @@
{ ... }:
{
virtualisation.podman = {
enable = true;
dockerCompat = true;
dockerSocket.enable = true;
};
}
BIN
View File
Binary file not shown.
+2
View File
@@ -11,4 +11,6 @@ in
# age.secrets.matrix.file = ../../secrets/matrix.age;
# Then you can reference the file at /run/agenix/matrix
"nextcloudadmin.age".publicKeys = [ linode user ];
"drone.age".publicKeys = [ linode user ];
}