mirror of
https://github.com/Smaug123/PulumiConfig
synced 2025-10-10 19:18:40 +00:00
Prometheus (#14)
This commit is contained in:
68
PulumiWebServer/Nix/woodpecker/woodpecker.nix
Normal file
68
PulumiWebServer/Nix/woodpecker/woodpecker.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
services.woodpecker-config = {
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "example.com";
|
||||
description = lib.mdDoc "Top-level domain to configure";
|
||||
};
|
||||
subdomain = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "woodpecker";
|
||||
description = lib.mdDoc "Subdomain in which to put Woodpecker";
|
||||
};
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
description = lib.mdDoc "Woodpecker localhost port";
|
||||
default = 9001;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config.users.users."woodpecker" = {
|
||||
isSystemUser = true;
|
||||
group = "woodpecker";
|
||||
extraGroups = ["docker"];
|
||||
};
|
||||
config.users.groups."woodpecker" = {};
|
||||
|
||||
config.environment.etc = {
|
||||
"woodpecker.yaml" = {
|
||||
text = builtins.replaceStrings ["%%WOODPECKER_PORT%%" "%%WOODPECKER_SUBDOMAIN%%" "%%WOODPECKER_DOMAIN%%" "%%GITEA_SUBDOMAIN%%"] [(toString config.services.woodpecker-config.port) config.services.woodpecker-config.subdomain config.services.woodpecker-config.domain config.services.gitea-config.subdomain] (builtins.readFile ./compose.yaml);
|
||||
mode = "0440";
|
||||
user = "woodpecker";
|
||||
};
|
||||
};
|
||||
|
||||
config.systemd.services.start-woodpecker = {
|
||||
description = "start-woodpecker";
|
||||
wantedBy = ["multi-user.target"];
|
||||
path = [pkgs.docker];
|
||||
script = builtins.readFile ./start.sh;
|
||||
serviceConfig = {
|
||||
Restart = "on-failure";
|
||||
Type = "exec";
|
||||
User = "woodpecker";
|
||||
Group = "woodpecker";
|
||||
};
|
||||
environment = {
|
||||
DOCKER = "${pkgs.docker}/bin/docker";
|
||||
OPENSSL = "${pkgs.openssl}/bin/openssl";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
services.nginx.virtualHosts."${config.services.woodpecker-config.subdomain}.${config.services.woodpecker-config.domain}" = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations."/" = {
|
||||
proxyPass = "http://localhost:${toString config.services.woodpecker-config.port}/";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user