From f6b61b09e253375e8c441293ef736dc9d4e266a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Wed, 21 Dec 2022 14:27:08 +0000 Subject: [PATCH] up number of containers to 4 --- nixos/boxes/vpsfree1/woodpecker.nix | 122 ++++++++++++++-------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/nixos/boxes/vpsfree1/woodpecker.nix b/nixos/boxes/vpsfree1/woodpecker.nix index 4fa39e72..70d30403 100644 --- a/nixos/boxes/vpsfree1/woodpecker.nix +++ b/nixos/boxes/vpsfree1/woodpecker.nix @@ -21,6 +21,65 @@ }; woodpeckerEnvSecretName = "woodpecker-env"; woodpeckerEnvSecretPath = "/run/secrets/${woodpeckerEnvSecretName}"; + woodpeckerAgentContainer = { + autoStart = true; + forwardPorts = [ + ]; + bindMounts = { + "${woodpeckerEnvSecretPath}" = { + hostPath = "${woodpeckerEnvSecretPath}"; + isReadOnly = true; + }; + "/var/run/docker.sock" = { + hostPath = "/var/run/podman/podman.sock"; + isReadOnly = false; + }; + }; + config = { + config, + pkgs, + lib, + ... + }: { + system.stateVersion = "22.11"; + users = { + mutableUsers = false; + allowNoPasswordLogin = true; + users."${systemUserName}" = { + inherit uid; + isSystemUser = true; + isNormalUser = false; + group = systemGroupName; + }; + groups."${systemGroupName}" = { + inherit gid; + members = ["${systemUserName}"]; + }; + groups."podman" = { + gid = podmanGid; + members = ["${systemUserName}"]; + }; + }; + + systemd.services.woodpecker-agent = { + wantedBy = ["multi-user.target"]; + environment = { + WOODPECKER_SERVER = "${domain}:${toString agentPort}"; + WOODPECKER_MAX_PROCS = "1"; + WOODPECKER_DEBUG_PRETTY = "true"; + WOODPECKER_LOG_LEVEL = "info"; + }; + serviceConfig = { + EnvironmentFile = [ + woodpeckerEnvSecretPath + ]; + ExecStart = "${pkgs.woodpecker-agent}/bin/woodpecker-agent"; + User = systemUserName; + Group = systemGroupName; + }; + }; + }; + }; in { imports = [../nginx.nix]; @@ -90,63 +149,8 @@ in { ]; }; }; - containers.woodpecker-agent1 = { - autoStart = true; - forwardPorts = [ - ]; - bindMounts = { - "${woodpeckerEnvSecretPath}" = { - hostPath = "${woodpeckerEnvSecretPath}"; - isReadOnly = true; - }; - "/var/run/docker.sock" = { - hostPath = "/var/run/podman/podman.sock"; - isReadOnly = false; - }; - }; - config = { - config, - pkgs, - lib, - ... - }: { - system.stateVersion = "22.11"; - users = { - mutableUsers = false; - allowNoPasswordLogin = true; - users."${systemUserName}" = { - inherit uid; - isSystemUser = true; - isNormalUser = false; - group = systemGroupName; - }; - groups."${systemGroupName}" = { - inherit gid; - members = ["${systemUserName}"]; - }; - groups."podman" = { - gid = podmanGid; - members = ["${systemUserName}"]; - }; - }; - - systemd.services.woodpecker-agent = { - wantedBy = ["multi-user.target"]; - environment = { - WOODPECKER_SERVER = "${domain}:${toString agentPort}"; - WOODPECKER_MAX_PROCS = "1"; - WOODPECKER_DEBUG_PRETTY = "true"; - WOODPECKER_LOG_LEVEL = "info"; - }; - serviceConfig = { - EnvironmentFile = [ - woodpeckerEnvSecretPath - ]; - ExecStart = "${pkgs.woodpecker-agent}/bin/woodpecker-agent"; - User = systemUserName; - Group = systemGroupName; - }; - }; - }; - }; + containers.woodpecker-agent1 = woodpeckerAgentContainer; + containers.woodpecker-agent2 = woodpeckerAgentContainer; + containers.woodpecker-agent3 = woodpeckerAgentContainer; + containers.woodpecker-agent4 = woodpeckerAgentContainer; }