1
0
Fork 0
dotfiles/container/webserver/default.nix

259 lines
8.3 KiB
Nix
Raw Normal View History

2022-07-30 22:36:06 +00:00
let
2022-07-31 13:10:28 +00:00
secret = import ../../secret/container/webserver;
custom-config = import ./config.nix { inherit secret; };
2022-07-30 22:36:06 +00:00
in
{
virtualisation.arion.projects.webserver.settings = {
services = {
ipv6nat = {
service = {
image = "robbertkl/ipv6nat:latest";
2022-07-31 10:23:30 +00:00
container_name = "ipv6nat";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-07-30 22:36:06 +00:00
capabilities = {
ALL = false;
NET_ADMIN = true;
NET_RAW = true;
};
network_mode = "host";
volumes = [
"/var/run/docker.sock:/var/run/docker.sock:ro"
];
2022-08-04 22:40:11 +00:00
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
2022-07-30 22:36:06 +00:00
};
};
2022-07-30 22:52:43 +00:00
mosquitto = {
service = {
image = "eclipse-mosquitto:2";
container_name = "mosquitto";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-07-30 22:52:43 +00:00
depends_on = [ "ipv6nat" ];
networks = [ "webserver" ];
ports = [ "1883:1883" ];
2022-07-31 10:23:30 +00:00
user = "nobody";
2022-07-30 22:52:43 +00:00
volumes = [
"/etc/container-webserver/mosquitto:/mosquitto/config:ro"
];
2022-08-04 22:40:11 +00:00
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
2022-07-30 22:52:43 +00:00
};
};
2022-07-31 10:23:30 +00:00
traefik = {
service = {
image = "traefik:v2.8";
container_name = "traefik";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-07-31 10:23:30 +00:00
depends_on = [ "ipv6nat" ];
networks = [ "webserver" ];
ports = [
"80:80"
"443:443"
];
command = [ "--configFile=/traefik.toml" ];
environment = secret.container.webserver.traefik.environment;
volumes = [
2022-11-11 15:11:54 +00:00
"/var/run/docker.sock:/var/run/docker.sock:ro"
2022-07-31 10:23:30 +00:00
"/etc/container-webserver/traefik/traefik.toml:/traefik.toml:ro"
"/etc/container-webserver/traefik/acme.json:/acme.json"
"/etc/container-webserver/traefik/custom:/custom_config:ro"
];
labels = secret.container.webserver.traefik.labels;
};
};
2022-07-30 22:36:06 +00:00
ifconfig-sexy = {
service = {
image = "ghcr.io/nifoc/ifconfig.sexy-caddy:master";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-08-08 20:03:06 +00:00
depends_on = [
"ipv6nat"
"traefik"
];
2022-07-30 22:36:06 +00:00
networks = [ "webserver" ];
labels = {
"traefik.enable" = "true";
"traefik.http.routers.ifconfig-sexy-http.rule" = "Host(`ifconfig.sexy`, `www.ifconfig.sexy`, `4.ifconfig.sexy`, `6.ifconfig.sexy`)";
"traefik.http.routers.ifconfig-sexy-http.entrypoints" = "web";
"traefik.http.routers.ifconfig-sexy-http.middlewares" = "https-redirect@file";
"traefik.http.routers.ifconfig-sexy.rule" = "Host(`ifconfig.sexy`, `www.ifconfig.sexy`, `4.ifconfig.sexy`, `6.ifconfig.sexy`)";
"traefik.http.routers.ifconfig-sexy.entrypoints" = "websecure";
"traefik.http.routers.ifconfig-sexy.tls" = "true";
"traefik.http.routers.ifconfig-sexy.tls.certresolver" = "cfresolver";
"traefik.http.routers.ifconfig-sexy.middlewares" = "non-www-redirect@file, content-compression@file";
2022-08-04 22:40:11 +00:00
"com.centurylinklabs.watchtower.enable" = "true";
2022-07-30 22:36:06 +00:00
};
};
};
2022-07-31 10:55:19 +00:00
nifoc-pw-docs = {
service = {
image = "ghcr.io/nifoc/nifoc.pw-docs:master";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-08-08 20:03:06 +00:00
depends_on = [
"ipv6nat"
"traefik"
];
2022-07-31 10:55:19 +00:00
networks = [ "webserver" ];
labels = {
"traefik.enable" = "true";
"traefik.http.routers.nifoc-pw-docs.rule" = "HostRegexp(`{subdomain:[a-z_]+}.nifoc.pw`)";
"traefik.http.routers.nifoc-pw-docs.entrypoints" = "websecure";
"traefik.http.routers.nifoc-pw-docs.tls" = "true";
"traefik.http.routers.nifoc-pw-docs.tls.certresolver" = "cfresolver";
"traefik.http.routers.nifoc-pw-docs.tls.domains[0].main" = "nifoc.pw";
"traefik.http.routers.nifoc-pw-docs.tls.domains[0].sans" = "*.nifoc.pw";
"traefik.http.routers.nifoc-pw-docs.middlewares" = "content-compression@file";
2022-08-04 22:40:11 +00:00
"com.centurylinklabs.watchtower.enable" = "true";
2022-07-31 10:55:19 +00:00
};
};
};
2022-07-31 13:10:28 +00:00
2022-07-31 14:40:01 +00:00
weewx = {
service = {
image = "ghcr.io/nifoc/weewx-docker:master";
2022-08-02 19:05:58 +00:00
restart = "unless-stopped";
2022-08-08 20:03:06 +00:00
depends_on = [
"ipv6nat"
"mosquitto"
"traefik"
];
2022-07-31 14:40:01 +00:00
networks = [ "webserver" ];
environment = {
"TZ" = "Europe/Berlin";
};
volumes = [
"/etc/container-webserver/weewx:/data"
];
labels = secret.container.webserver.weewx.labels;
};
};
2022-11-11 15:11:54 +00:00
# Matrix
synapse = {
service = {
image = "matrixdotorg/synapse:latest";
container_name = "synapse";
restart = "unless-stopped";
depends_on = [
"ipv6nat"
"traefik"
];
networks = [ "webserver" ];
volumes = [
"/etc/container-matrix/synapse:/data"
2022-11-11 16:24:12 +00:00
"/etc/container-matrix/telegram:/bridge-data/telegram:ro"
2022-11-11 21:33:08 +00:00
"/etc/container-matrix/signal:/bridge-data/signal:ro"
2022-11-12 16:59:42 +00:00
"/etc/container-matrix/whatsapp:/bridge-data/whatsapp:ro"
2022-11-11 15:11:54 +00:00
];
labels = {
"traefik.enable" = "true";
2022-11-11 23:22:36 +00:00
"traefik.http.routers.matrix.rule" = "Host(`matrix-synapse.kempkens.io`)";
2022-11-11 15:11:54 +00:00
"traefik.http.routers.matrix.entrypoints" = "websecure";
"traefik.http.routers.matrix.service" = "matrix-web";
"traefik.http.routers.matrix.tls.certresolver" = "cfresolver";
"traefik.http.routers.matrix.tls.domains[0].main" = "kempkens.io";
"traefik.http.routers.matrix.tls.domains[0].sans" = "*.kempkens.io";
"traefik.http.routers.matrix.middlewares" = "content-compression@file";
"traefik.http.services.matrix-web.loadbalancer.server.port" = "8008";
"com.centurylinklabs.watchtower.enable" = "true";
};
};
};
2022-11-11 16:07:21 +00:00
matrix-telegram = {
service = {
image = "dock.mau.dev/mautrix/telegram:latest";
container_name = "mautrix-telegram";
restart = "unless-stopped";
depends_on = [
"ipv6nat"
"synapse"
];
networks = [ "webserver" ];
volumes = [
"/etc/container-matrix/telegram:/data"
];
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
};
};
2022-11-11 21:26:55 +00:00
signald = {
service = {
image = "signald/signald:latest";
container_name = "signald";
restart = "unless-stopped";
depends_on = [ "ipv6nat" ];
networks = [ "webserver" ];
volumes = [
"/etc/container-matrix/signald:/signald"
];
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
};
};
matrix-signal = {
service = {
image = "dock.mau.dev/mautrix/signal:latest";
container_name = "mautrix-signal";
restart = "unless-stopped";
depends_on = [
"ipv6nat"
"synapse"
"signald"
];
networks = [ "webserver" ];
volumes = [
"/etc/container-matrix/signal:/data"
"/etc/container-matrix/signald:/signald"
];
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
};
};
2022-11-12 16:59:42 +00:00
matrix-whatsapp = {
service = {
image = "dock.mau.dev/mautrix/whatsapp:latest";
container_name = "mautrix-whatsapp";
restart = "unless-stopped";
depends_on = [
"ipv6nat"
"synapse"
];
networks = [ "webserver" ];
volumes = [
"/etc/container-matrix/whatsapp:/data"
];
labels = {
"com.centurylinklabs.watchtower.enable" = "true";
};
};
};
2022-07-30 22:36:06 +00:00
};
networks.webserver = {
driver = "bridge";
enable_ipv6 = true;
ipam = {
driver = "default";
config = [
{
subnet = "fd00:dead:beef::/48";
}
];
};
};
};
} // custom-config