2021-04-12 01:44:10 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2021-04-19 00:39:33 +01:00
|
|
|
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;
|
|
|
|
|
2021-04-19 00:39:33 +01:00
|
|
|
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 = [
|
2021-04-19 00:39:33 +01:00
|
|
|
"ROCKET_PORT=3002"
|
2021-04-12 01:44:10 +01:00
|
|
|
"ROCKET_TEMPLATE_DIR=${pkgs.tlaternet-templates.templates}/browser/"
|
|
|
|
];
|
2021-04-19 00:39:33 +01:00
|
|
|
ExposedPorts = { "3002" = { }; };
|
|
|
|
User = "${uid}:${gid}";
|
2021-04-12 01:44:10 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-19 00:39:33 +01:00
|
|
|
ports = [ "3002:3002" ];
|
2021-04-12 01:44:10 +01:00
|
|
|
volumes = [ "tlaternet-mail:/srv/mail" ];
|
2021-05-17 00:02:41 +01:00
|
|
|
extraOptions = [
|
|
|
|
"--hostname=tlater.net"
|
|
|
|
# This can change with rocket 0.5.
|
|
|
|
"--stop-signal=SIGKILL"
|
|
|
|
];
|
2021-04-12 01:44:10 +01:00
|
|
|
};
|
|
|
|
}
|