added web.nix to jeevesjr

This commit is contained in:
Richie Cahill 2024-05-27 20:20:00 -04:00
parent 80bbbc8e9e
commit cabba86d1a
4 changed files with 59 additions and 1 deletions

View File

@ -19,6 +19,7 @@
"builtins",
"cachix",
"charliermarsh",
"cloudflared",
"codezombiech",
"Compat",
"concatLists",

View File

@ -1,6 +1,9 @@
{ pkgs, ... }:
{
imports = [ ../../users/richie/global/zerotier.nix ];
imports = [
../../users/richie/global/zerotier.nix
./docker
];
networking = {
hostId = "1beb3026";

View File

@ -0,0 +1,15 @@
{ pkgs, config, ... }:
{
imports = [ ./web.nix ];
virtualisation.oci-containers.backend = "docker";
system.activationScripts.mkVPN =
let
docker = config.virtualisation.oci-containers.backend;
dockerBin = "${pkgs.${docker}}/bin/${docker}";
in
''
${dockerBin} network inspect web >/dev/null 2>&1 || ${dockerBin} network create web --subnet 172.100.5.0/16
'';
}

View File

@ -0,0 +1,39 @@
{
virtualisation.oci-containers.containers = {
arch_mirror = {
image = "ubuntu/apache2:latest";
volumes = [
"/ZFS/Media/Docker/Docker/templates/file_server/sites/:/etc/apache2/sites-enabled/"
"/ZFS/Media/Mirror/:/data"
];
ports = [ "800:80" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
haproxy = {
image = "haproxy:latest";
user = "998:998";
environment = {
TZ = "Etc/EST";
};
volumes = [
"/ZFS/Main/Docker/jeeves-jr/haproxy/web/haproxy/cloudflare.pem:/etc/ssl/certs/cloudflare.pem"
"/ZFS/Main/Docker/jeeves-jr/haproxy/web/haproxy/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg"
];
dependsOn = [ "arch_mirror" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
cloud_flare_tunnel = {
image = "cloudflare/cloudflared:latest";
cmd = [
"tunnel"
"run"
];
environmentFiles = [ "/ZFS/Main/Docker/jeeves-jr/haproxy/web/cloudflare_tunnel.env" ];
dependsOn = [ "haproxy" ];
extraOptions = [ "--network=web" ];
autoStart = true;
};
};
}