2024-10-11 14:12:05 +02:00
|
|
|
# Auto-generated using compose2nix v0.3.1-pre.
|
|
|
|
{ pkgs, lib, ... }:
|
|
|
|
|
|
|
|
{
|
2024-10-11 16:32:48 +02:00
|
|
|
|
2024-10-11 14:12:05 +02:00
|
|
|
# Containers
|
|
|
|
virtualisation.oci-containers.containers."5d-diplomacy-backend" = {
|
2024-10-11 17:03:32 +02:00
|
|
|
image = "compose2nix-5d-diplomacy-backend";
|
2024-10-11 14:12:05 +02:00
|
|
|
environment = {
|
|
|
|
"ConnectionStrings__Database" = "Server=mssql;Database=diplomacy;User=SA;Password=Passw0rd@;Encrypt=True;TrustServerCertificate=True";
|
|
|
|
};
|
|
|
|
log-driver = "journald";
|
|
|
|
extraOptions = [
|
|
|
|
"--network-alias=backend"
|
|
|
|
"--network=5d-diplomacy_default"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
systemd.services."docker-5d-diplomacy-backend" = {
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = lib.mkOverride 90 "always";
|
|
|
|
RestartMaxDelaySec = lib.mkOverride 90 "1m";
|
|
|
|
RestartSec = lib.mkOverride 90 "100ms";
|
|
|
|
RestartSteps = lib.mkOverride 90 9;
|
|
|
|
};
|
|
|
|
after = [
|
|
|
|
"docker-build-5d-diplomacy-backend.service"
|
|
|
|
"docker-network-5d-diplomacy_default.service"
|
|
|
|
];
|
|
|
|
requires = [
|
|
|
|
"docker-build-5d-diplomacy-backend.service"
|
|
|
|
"docker-network-5d-diplomacy_default.service"
|
|
|
|
];
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
};
|
|
|
|
virtualisation.oci-containers.containers."5d-diplomacy-frontend" = {
|
2024-10-11 17:03:32 +02:00
|
|
|
image = "compose2nix-5d-diplomacy-frontend";
|
2024-10-11 14:12:05 +02:00
|
|
|
log-driver = "journald";
|
|
|
|
extraOptions = [
|
|
|
|
"--network-alias=frontend"
|
|
|
|
"--network=5d-diplomacy_default"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
systemd.services."docker-5d-diplomacy-frontend" = {
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = lib.mkOverride 90 "always";
|
|
|
|
RestartMaxDelaySec = lib.mkOverride 90 "1m";
|
|
|
|
RestartSec = lib.mkOverride 90 "100ms";
|
|
|
|
RestartSteps = lib.mkOverride 90 9;
|
|
|
|
};
|
|
|
|
after = [
|
|
|
|
"docker-build-5d-diplomacy-frontend.service"
|
|
|
|
"docker-network-5d-diplomacy_default.service"
|
|
|
|
];
|
|
|
|
requires = [
|
|
|
|
"docker-build-5d-diplomacy-frontend.service"
|
|
|
|
"docker-network-5d-diplomacy_default.service"
|
|
|
|
];
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
};
|
|
|
|
virtualisation.oci-containers.containers."5d-diplomacy-mssql" = {
|
|
|
|
image = "mcr.microsoft.com/mssql/server:2022-latest";
|
|
|
|
environment = {
|
|
|
|
"ACCEPT_EULA" = "y";
|
|
|
|
"MSSQL_SA_PASSWORD" = "Passw0rd@";
|
|
|
|
};
|
|
|
|
user = "root";
|
|
|
|
log-driver = "journald";
|
|
|
|
extraOptions = [
|
|
|
|
"--network-alias=mssql"
|
|
|
|
"--network=5d-diplomacy_default"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
systemd.services."docker-5d-diplomacy-mssql" = {
|
|
|
|
serviceConfig = {
|
|
|
|
Restart = lib.mkOverride 90 "no";
|
|
|
|
};
|
|
|
|
after = [ "docker-network-5d-diplomacy_default.service" ];
|
|
|
|
requires = [ "docker-network-5d-diplomacy_default.service" ];
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Networks
|
|
|
|
systemd.services."docker-network-5d-diplomacy_default" = {
|
|
|
|
path = [ pkgs.docker ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
ExecStop = "docker network rm -f 5d-diplomacy_default";
|
|
|
|
};
|
|
|
|
script = ''
|
|
|
|
docker network inspect 5d-diplomacy_default || docker network create 5d-diplomacy_default
|
|
|
|
'';
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
# Builds
|
|
|
|
systemd.services."docker-build-5d-diplomacy-backend" = {
|
|
|
|
path = [
|
|
|
|
pkgs.docker
|
|
|
|
pkgs.git
|
|
|
|
];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
TimeoutSec = 300;
|
|
|
|
};
|
|
|
|
script = ''
|
2024-10-11 16:40:52 +02:00
|
|
|
docker build -t compose2nix-5d-diplomacy-backend https://github.com/Oliveriver/5d-diplomacy-with-multiverse-time-travel.git#main:server
|
2024-10-11 14:12:05 +02:00
|
|
|
'';
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
};
|
|
|
|
systemd.services."docker-build-5d-diplomacy-frontend" = {
|
|
|
|
path = [
|
|
|
|
pkgs.docker
|
|
|
|
pkgs.git
|
|
|
|
];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
RemainAfterExit = true;
|
|
|
|
TimeoutSec = 300;
|
|
|
|
};
|
|
|
|
script = ''
|
2024-10-11 16:40:52 +02:00
|
|
|
docker build -t compose2nix-5d-diplomacy-frontend https://github.com/Oliveriver/5d-diplomacy-with-multiverse-time-travel.git#main:client
|
2024-10-11 14:12:05 +02:00
|
|
|
'';
|
|
|
|
partOf = [ "docker-compose-5d-diplomacy-root.target" ];
|
|
|
|
wantedBy = [ "docker-compose-5d-diplomacy-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-5d-diplomacy-root" = {
|
|
|
|
unitConfig = {
|
|
|
|
Description = "Root target generated by compose2nix.";
|
|
|
|
};
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
|
|
|
}
|