Move the NFS share to the filesystem

This commit is contained in:
Andreas Zweili 2023-12-28 23:01:50 +01:00
parent d7fd953018
commit ff2a6235b0
5 changed files with 38 additions and 8 deletions

View File

@ -10,6 +10,7 @@ let
}").overrideAttrs (old: {
buildCommand = "${old.buildCommand}\n patchShebangs $out";
});
volumePath = "/mnt/server-data/docker-mailserver";
in
{
options = {
@ -47,6 +48,11 @@ in
mailserver-setup
];
fileSystems."${volumePath}" = {
device = "10.7.89.108:server_data/docker-mailserver";
fsType = "nfs";
options = [ "hard" "noatime" "rw" ];
};
services.az-docker.enable = true;
virtualisation.oci-containers = {
@ -73,12 +79,12 @@ in
"/run/agenix:/run/agenix:ro"
"/var/lib/acme/mail.zweili.org:/etc/letsencrypt/live/mail.zweili.org:ro"
"/var/lib/redis:/var/lib/redis"
"${volumePath}/maildata:/var/mail"
"${volumePath}/mailstate:/var/mail-state"
"${volumePath}/maillogs:/var/log/mail"
"${volumePath}/config:/tmp/docker-mailserver"
];
extraOptions = [
''--mount=type=volume,source=maildata,target=/var/mail,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/docker-mailserver/maildata,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
''--mount=type=volume,source=mailstate,target=/var/mail-state,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/docker-mailserver/mailstate,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
''--mount=type=volume,source=maillogs,target=/var/log/mail,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/docker-mailserver/maillogs,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
''--mount=type=volume,source=config,target=/tmp/docker-mailserver,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/docker-mailserver/config,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway"
"--cap-add=NET_ADMIN"
"--cap-add=SYS_PTRACE"

View File

@ -1,6 +1,7 @@
{ config, inputs, lib, ... }:
let
cfg = config.services.az-gitea;
volumePath = "/mnt/server-data/gitea";
in
{
options = {
@ -14,6 +15,11 @@ in
config = lib.mkIf cfg.enable {
age.secrets.giteaEnv.file = "${inputs.self}/scrts/gitea_env.age";
fileSystems."${volumePath}" = {
device = "10.7.89.108:server_data/gitea/data";
fsType = "nfs";
options = [ "hard" "noatime" "rw" ];
};
services = {
az-docker.enable = true;
az-mariadb-for-containers.enable = true;
@ -59,9 +65,9 @@ in
volumes = [
"/etc/timezone:/etc/timezone:ro"
"/etc/localtime:/etc/localtime:ro"
"${volumePath}:/data"
];
extraOptions = [
''--mount=type=volume,source=gitea_data,target=/data,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/gitea/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway"
"--log-opt=tag='gitea'"
];

View File

@ -1,6 +1,7 @@
{ config, lib, ... }:
let
cfg = config.services.az-grav;
volumePath = "/mnt/server-data/grav";
in
{
options = {
@ -10,6 +11,11 @@ in
config = lib.mkIf cfg.enable {
services.az-docker.enable = true;
fileSystems."${volumePath}" = {
device = "10.7.89.108:server_data/grav";
fsType = "nfs";
options = [ "hard" "noatime" "rw" ];
};
virtualisation.oci-containers = {
backend = "docker";
containers."grav" = {
@ -27,9 +33,9 @@ in
volumes = [
"/etc/timezone:/etc/timezone:ro"
"/etc/localtime:/etc/localtime:ro"
"${volumePath}:/config"
];
extraOptions = [
''--mount=type=volume,source=grav,target=/config,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/grav,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--log-opt=tag='grav'"
];
};

View File

@ -1,6 +1,7 @@
{ config, lib, ... }:
let
cfg = config.services.az-heimdall;
volumePath = "/mnt/server-data/heimdall";
in
{
options = {
@ -10,6 +11,11 @@ in
config = lib.mkIf cfg.enable {
services.az-docker.enable = true;
fileSystems."${volumePath}" = {
device = "10.7.89.108:server_data/heimdall";
fsType = "nfs";
options = [ "hard" "noatime" "rw" ];
};
virtualisation.oci-containers = {
backend = "docker";
containers."heimdall" = {
@ -26,9 +32,9 @@ in
];
volumes = [
"/etc/localtime:/etc/localtime:ro"
"${volumePath}:/config"
];
extraOptions = [
''--mount=type=volume,source=heimdall,target=/config,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/heimdall,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--log-opt=tag='heimdall'"
];
};

View File

@ -16,6 +16,7 @@ let
nextcloudImage = "ghcr.io/nebucatnetzer/nextcloud-smb/nextcloud-smb:28.0.1@sha256:2fc015f2844e44e861099474927696244ddb59bcfb3fc7b693468a30543a211e";
nextcloudService = "${config.virtualisation.oci-containers.backend}-nextcloud";
cronService = "${config.virtualisation.oci-containers.backend}-cron";
volumePath = "/mnt/server-data/nextcloud";
in
{
options = {
@ -29,6 +30,11 @@ in
config = lib.mkIf cfg.enable {
age.secrets.nextcloudEnv.file = "${inputs.self}/scrts/nextcloud_env.age";
fileSystems."${volumePath}" = {
device = "10.7.89.108:server_data/nextcloud/data";
fsType = "nfs";
options = [ "hard" "noatime" "rw" ];
};
services = {
az-acme-base.enable = true;
az-docker.enable = true;
@ -108,7 +114,6 @@ in
"/etc/localtime:/etc/localtime:ro"
];
extraOptions = [
''--mount=type=volume,source=nextcloud_data,target=/var/www/html,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/server_data/nextcloud/data,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--add-host=host.docker.internal:host-gateway"
"--net=nextcloud"
"--log-opt=tag='nextcloud-cron'"
@ -119,6 +124,7 @@ in
autoStart = true;
volumes = [
"/etc/localtime:/etc/localtime:ro"
"${volumePath}:/var/www/html"
];
extraOptions = [
"--net=${networkName}"