tlaternet-server/configuration/services/webserver.nix

44 lines
1.1 KiB
Nix
Raw Normal View History

2021-04-12 01:44:10 +01:00
{ config, pkgs, ... }:
{
users.extraUsers.webserver = {
uid = config.ids.uids.webserver;
isSystemUser = true;
description = "tlater.net web server user";
};
2021-04-12 01:44:10 +01:00
virtualisation.oci-containers.containers.webserver = {
image = "tlaternet/webserver";
imageFile = pkgs.dockerTools.buildImage {
name = "tlaternet/webserver";
tag = "latest";
contents = pkgs.tlaternet-webserver.webserver;
config = let
user = config.users.extraUsers.webserver;
group = config.users.groups.${user.group};
uid = toString user.uid;
gid = toString group.gid;
in {
2021-04-12 01:44:10 +01:00
Cmd = [ "tlaternet-webserver" ];
Volumes = { "/srv/mail" = { }; };
Env = [
"ROCKET_PORT=3002"
2021-04-12 01:44:10 +01:00
"ROCKET_TEMPLATE_DIR=${pkgs.tlaternet-templates.templates}/browser/"
];
ExposedPorts = { "3002" = { }; };
User = "${uid}:${gid}";
2021-04-12 01:44:10 +01:00
};
};
ports = [ "3002:3002" ];
2021-04-12 01:44:10 +01:00
volumes = [ "tlaternet-mail:/srv/mail" ];
extraOptions = [
"--hostname=tlater.net"
# This can change with rocket 0.5.
"--stop-signal=SIGKILL"
];
2021-04-12 01:44:10 +01:00
};
}