58 lines
1.9 KiB
Nix
58 lines
1.9 KiB
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
container_name = "it-tools";
|
|
compose_file = "podman/it-tools/compose.yaml";
|
|
in
|
|
|
|
{
|
|
config = {
|
|
environment.etc."${compose_file}".text =
|
|
/*
|
|
yaml
|
|
*/
|
|
''
|
|
services:
|
|
it-tools:
|
|
container_name: it-tools
|
|
image: corentinth/it-tools
|
|
networks:
|
|
it-tools_frontend:
|
|
labels:
|
|
- traefik.enable=true
|
|
- traefik.http.services.it-tools.loadbalancer.server.port=80
|
|
- traefik.http.services.it-tools.loadbalancer.server.scheme=http
|
|
- traefik.http.routers.it-tools-https.entrypoints=websecure
|
|
- traefik.http.routers.it-tools-https.rule=Host(`it-tools.$DOMAIN_NAME`)
|
|
- traefik.http.routers.it-tools-https.tls=true
|
|
- traefik.http.routers.it-tools-https.tls.certresolver=cloudflare
|
|
restart: unless-stopped
|
|
networks:
|
|
it-tools_frontend:
|
|
external: true
|
|
'';
|
|
|
|
systemd.services.${container_name} = {
|
|
description = "Podman container : ${container_name}";
|
|
after = [ "network.target" ];
|
|
requires = [ "traefik.service" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
path = [ pkgs.podman ];
|
|
|
|
serviceConfig = {
|
|
User = "numbus-admin";
|
|
Environment = [ "XDG_RUNTIME_DIR=/run/user/1000" ];
|
|
Type = "exec";
|
|
# Pull the latest image before running
|
|
ExecStartPre = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} pull";
|
|
# Bring the service up
|
|
ExecStart = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} up --remove-orphans";
|
|
# Take it down gracefully
|
|
ExecStop = "${pkgs.podman-compose}/bin/podman-compose -f /etc/${compose_file} down";
|
|
Restart = "on-failure";
|
|
RestartSec = "5m";
|
|
StartLimitBurst = "3";
|
|
};
|
|
};
|
|
};
|
|
} |