2022-12-22 22:16:19 -08:00
|
|
|
{ self, pkgs, config, ... }:
|
2022-12-09 07:48:26 -08:00
|
|
|
{
|
2022-12-21 04:33:39 -08:00
|
|
|
age.secrets.woodpecker-server-secrets.owner = "woodpecker";
|
|
|
|
age.secrets.woodpecker-server-secrets.file = "${self}/secrets/woodpecker-server-secrets.age";
|
|
|
|
|
|
|
|
age.secrets.woodpecker-agent-secret.owner = "woodpecker";
|
|
|
|
age.secrets.woodpecker-agent-secret.file = "${self}/secrets/woodpecker-agent-secret.age";
|
2022-12-09 07:48:26 -08:00
|
|
|
users.users.woodpecker = {
|
2022-12-21 04:33:39 -08:00
|
|
|
group = "woodpecker";
|
2022-12-09 07:48:26 -08:00
|
|
|
description = "woodpecker user";
|
|
|
|
home = "/var/lib/woodpecker";
|
|
|
|
createHome = true;
|
2022-12-22 22:16:19 -08:00
|
|
|
isNormalUser = true;
|
2022-12-09 07:48:26 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.woodpecker = { };
|
|
|
|
|
|
|
|
services.nginx.virtualHosts."ci.sealight.xyz" = {
|
|
|
|
enableACME = true;
|
|
|
|
forceSSL = true;
|
2022-12-22 22:16:19 -08:00
|
|
|
locations."/".proxyPass = "http://localhost:38125";
|
2022-12-09 07:48:26 -08:00
|
|
|
};
|
|
|
|
|
2022-12-22 22:16:19 -08:00
|
|
|
networking.firewall.allowedTCPPorts = [ 80 443 22 ];
|
|
|
|
|
2022-12-09 07:48:26 -08:00
|
|
|
services.postgresql = {
|
|
|
|
ensureDatabases = [ "woodpecker" ];
|
|
|
|
ensureUsers = [{
|
|
|
|
name = "woodpecker";
|
2024-01-05 23:44:08 -08:00
|
|
|
ensureDBOwnership = true;
|
2022-12-09 07:48:26 -08:00
|
|
|
}];
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.woodpecker-server = {
|
2023-05-12 03:50:51 -07:00
|
|
|
after = [ "postgresql.service" ];
|
2022-12-09 07:48:26 -08:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
2022-12-22 22:16:19 -08:00
|
|
|
WorkingDirectory = "/var/lib/woodpecker";
|
2022-12-09 07:48:26 -08:00
|
|
|
EnvironmentFile = [
|
2022-12-21 04:33:39 -08:00
|
|
|
/run/agenix/woodpecker-server-secrets
|
|
|
|
/run/agenix/woodpecker-agent-secret
|
2022-12-09 07:48:26 -08:00
|
|
|
];
|
|
|
|
Environment = [
|
2022-12-22 22:16:19 -08:00
|
|
|
"WOODPECKER_OPEN=false"
|
|
|
|
"WOODPECKER_HOST=https://ci.sealight.xyz"
|
|
|
|
"WOODPECKER_SERVER_ADDR=:38125"
|
2022-12-09 07:48:26 -08:00
|
|
|
|
|
|
|
"WOODPECKER_GITEA=true"
|
|
|
|
"WOODPECKER_GITEA_URL=https://git.sealight.xyz"
|
|
|
|
|
|
|
|
"WOODPECKER_DATABASE_DATASOURCE=postgres:///woodpecker?host=/run/postgresql"
|
|
|
|
"WOODPECKER_DATABASE_DRIVER=postgres"
|
2023-05-30 05:23:05 -07:00
|
|
|
"WOODPECKER_ADMIN=aynish"
|
2022-12-09 07:48:26 -08:00
|
|
|
];
|
|
|
|
ExecStart = "${pkgs.woodpecker-server}/bin/woodpecker-server";
|
2022-12-22 22:16:19 -08:00
|
|
|
User = "woodpecker";
|
|
|
|
Group = "woodpecker";
|
2022-12-09 07:48:26 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|