diff --git a/machines/dragonwell/default.nix b/machines/dragonwell/default.nix index 9ba2714..aa70fd7 100644 --- a/machines/dragonwell/default.nix +++ b/machines/dragonwell/default.nix @@ -2,7 +2,7 @@ let username = "jolheiser"; key = ''ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDfKqCWtDlS3tgvfT6hQN+ii8UtabIZ+ZNmYN+bLwIa8PHOEW5MbfaqXSlhKkSi4+7SfQDCHphw0SMfhsQ4qMEcoywZ+4niDgKlQEVkl+S/VGbLuPe92NRStkyreZBLPr3Rh7ScNlGHcmHmoV9v7725fMnsMmabGVhpGO84PwNHOfJyv2tx2h6LxFbAV8S44UQu2lc8YLWCK2UvKuRnBerBXLnDQThUUX8UuCFzb786gQzD5XDU0MENbByxiy0XdVGAC+tFXEiSIgFZlFbFYyShgdTP9MzX2MOglEi+ae+1UIFncraW7ptUey7qHFJylpHWWWvE+GTwsg2G50i0FvFj jolheiser@jolheiser''; in { - imports = [./caddy.nix ./dex.nix ./golink.nix ./gotosocial.nix ./restic.nix ./tandoor.nix ./ugit.nix ./vikunja.nix ./hardware.nix]; + imports = [./caddy.nix ./dex.nix ./golink.nix ./gotosocial.nix ./restic.nix ./tandoor.nix ./teamcity ./ugit.nix ./vikunja.nix ./hardware.nix]; boot.tmp.cleanOnBoot = true; zramSwap.enable = true; diff --git a/machines/dragonwell/teamcity/README.md b/machines/dragonwell/teamcity/README.md new file mode 100644 index 0000000..6a451a7 --- /dev/null +++ b/machines/dragonwell/teamcity/README.md @@ -0,0 +1,9 @@ +To generate the nix file, use either of the following commands depending on whether you're in the root dir or not: + +```sh +nix run github:aksiksi/compose2nix -- --inputs machines/dragonwell/teamcity.yml --output machines/dragonwell/teamcity.nix --runtime docker +``` + +```sh +nix run github:aksiksi/compose2nix -- --inputs teamcity.yml --output teamcity.nix --runtime docker +``` diff --git a/machines/dragonwell/teamcity/buildAgent.properties b/machines/dragonwell/teamcity/buildAgent.properties new file mode 100644 index 0000000..5ff79b2 --- /dev/null +++ b/machines/dragonwell/teamcity/buildAgent.properties @@ -0,0 +1,9 @@ +name=Agent 1 +ownPort=9090 +serverUrl=http\://teamcity\:8111 + +workDir=../work +tempDir=../temp +systemDir=../system + +teamcity.docker.use.sudo=true diff --git a/machines/dragonwell/teamcity/default.nix b/machines/dragonwell/teamcity/default.nix new file mode 100644 index 0000000..79425e7 --- /dev/null +++ b/machines/dragonwell/teamcity/default.nix @@ -0,0 +1,3 @@ +{ + imports = [./teamcity-compose.nix]; +} diff --git a/machines/dragonwell/teamcity/teamcity.nix b/machines/dragonwell/teamcity/teamcity.nix new file mode 100644 index 0000000..46fedeb --- /dev/null +++ b/machines/dragonwell/teamcity/teamcity.nix @@ -0,0 +1,136 @@ +# Auto-generated using compose2nix v0.2.0-pre. +{ + pkgs, + lib, + ... +}: { + # Runtime + virtualisation.docker = { + enable = true; + autoPrune.enable = true; + }; + virtualisation.oci-containers.backend = "docker"; + + # Containers + virtualisation.oci-containers.containers."teamcity-teamcity" = { + image = "jetbrains/teamcity-server:2024.03.3"; + volumes = [ + "/var/lib/teamcity/logs:/opt/teamcity/logs:rw" + "/var/lib/teamcity/server:/data/teamcity_server/datadir:rw" + ]; + ports = [ + "8112:8111/tcp" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=teamcity" + "--network=teamcity_default" + ]; + }; + systemd.services."docker-teamcity-teamcity" = { + serviceConfig = { + Restart = lib.mkForce "no"; + }; + after = [ + "docker-network-teamcity_default.service" + ]; + requires = [ + "docker-network-teamcity_default.service" + ]; + partOf = [ + "docker-compose-teamcity-root.target" + ]; + wantedBy = [ + "docker-compose-teamcity-root.target" + ]; + }; + virtualisation.oci-containers.containers."teamcity-teamcity-agent-1" = { + image = "jetbrains/teamcity-agent:2024.03.3-linux-sudo"; + environment = { + DOCKER_IN_DOCKER = "start"; + }; + volumes = [ + "/var/lib/teamcity/agent-1/conf:/data/teamcity_agent/conf:rw" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=teamcity-agent-1" + "--network=teamcity_default" + "--privileged" + ]; + }; + systemd.services."docker-teamcity-teamcity-agent-1" = { + serviceConfig = { + Restart = lib.mkForce "no"; + }; + after = [ + "docker-network-teamcity_default.service" + ]; + requires = [ + "docker-network-teamcity_default.service" + ]; + partOf = [ + "docker-compose-teamcity-root.target" + ]; + wantedBy = [ + "docker-compose-teamcity-root.target" + ]; + }; + virtualisation.oci-containers.containers."teamcity-teamcity-agent-2" = { + image = "jetbrains/teamcity-agent:2024.03.3-linux-sudo"; + environment = { + DOCKER_IN_DOCKER = "start"; + }; + volumes = [ + "/var/lib/teamcity/agent-2/conf:/data/teamcity_agent/conf:rw" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=teamcity-agent-2" + "--network=teamcity_default" + "--privileged" + ]; + }; + systemd.services."docker-teamcity-teamcity-agent-2" = { + serviceConfig = { + Restart = lib.mkForce "no"; + }; + after = [ + "docker-network-teamcity_default.service" + ]; + requires = [ + "docker-network-teamcity_default.service" + ]; + partOf = [ + "docker-compose-teamcity-root.target" + ]; + wantedBy = [ + "docker-compose-teamcity-root.target" + ]; + }; + + # Networks + systemd.services."docker-network-teamcity_default" = { + path = [pkgs.docker]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStop = "${pkgs.docker}/bin/docker network rm -f teamcity_default"; + }; + script = '' + docker network inspect teamcity_default || docker network create teamcity_default + ''; + partOf = ["docker-compose-teamcity-root.target"]; + wantedBy = ["docker-compose-teamcity-root.target"]; + }; + + # Root service + # When started, this will automatically create all resources and start + # the containers. When stopped, this will teardown all resources. + systemd.targets."docker-compose-teamcity-root" = { + unitConfig = { + Description = "Root target generated by compose2nix."; + }; + wantedBy = ["multi-user.target"]; + }; +} diff --git a/machines/dragonwell/teamcity/teamcity.yml b/machines/dragonwell/teamcity/teamcity.yml new file mode 100644 index 0000000..d29e94e --- /dev/null +++ b/machines/dragonwell/teamcity/teamcity.yml @@ -0,0 +1,23 @@ +name: teamcity +services: + teamcity: + image: jetbrains/teamcity-server:2024.03.3 + ports: + - "8112:8111" + volumes: + - /var/lib/teamcity/server:/data/teamcity_server/datadir + - /var/lib/teamcity/logs:/opt/teamcity/logs + teamcity-agent-1: + image: jetbrains/teamcity-agent:2024.03.3-linux-sudo + privileged: true + volumes: + - /var/lib/teamcity/agent-1/conf:/data/teamcity_agent/conf + environment: + - DOCKER_IN_DOCKER=start + teamcity-agent-2: + image: jetbrains/teamcity-agent:2024.03.3-linux-sudo + privileged: true + volumes: + - /var/lib/teamcity/agent-2/conf:/data/teamcity_agent/conf + environment: + - DOCKER_IN_DOCKER=start