dotnix/machines/dragonwell/teamcity/teamcity.nix

137 lines
3.5 KiB
Nix

# 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"];
};
}