Add webserver service

This commit is contained in:
Tristan Daniël Maat 2021-04-12 01:44:10 +01:00
parent 98cf95a922
commit 40002ac76e
Signed by: tlater
GPG key ID: 49670FD774E43268
4 changed files with 170 additions and 4 deletions
configuration

View file

@ -1,7 +1,8 @@
{ config, pkgs, ... }:
{
imports = [ ./services/gitea.nix ./services/nextcloud.nix ];
imports =
[ ./services/gitea.nix ./services/nextcloud.nix ./services/webserver.nix ];
nix = {
package = pkgs.nixFlakes;
@ -53,6 +54,7 @@
locations."/" = { proxyPass = "http://localhost:${toString port}"; };
} // extra;
in {
"tlater.net" = host 3002 { serverAliases = [ "www.tlater.net" ]; };
"gitea.tlater.net" = host 3000 { };
"nextcloud.tlater.net" = host 3001 { };
};

View file

@ -0,0 +1,27 @@
{ config, pkgs, ... }:
{
virtualisation.oci-containers.containers.webserver = {
image = "tlaternet/webserver";
imageFile = pkgs.dockerTools.buildImage {
name = "tlaternet/webserver";
tag = "latest";
contents = pkgs.tlaternet-webserver.webserver;
config = {
Cmd = [ "tlaternet-webserver" ];
Volumes = { "/srv/mail" = { }; };
Env = [
"ROCKET_PORT=80"
"ROCKET_TEMPLATE_DIR=${pkgs.tlaternet-templates.templates}/browser/"
];
ExposedPorts = { "80" = { }; };
};
};
ports = [ "3002:80" ];
volumes = [ "tlaternet-mail:/srv/mail" ];
extraOptions = [ "--hostname=tlater.net" ];
};
}