preparing for deployment
This commit is contained in:
parent
1b33d42ae7
commit
9af033b5f3
77
host.nix
77
host.nix
|
@ -90,7 +90,8 @@ lib.flatMap ({ name, config, ip, ports, volumes, ... }:
|
|||
then {}
|
||||
else {
|
||||
"${host}" = {
|
||||
# enableACME = true;
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
locations."/".proxyPass =
|
||||
"http://${ip}:${builtins.toString ports.http}";
|
||||
};
|
||||
|
@ -155,43 +156,43 @@ lib.flatMap ({ name, config, ip, ports, volumes, ... }:
|
|||
};
|
||||
|
||||
# [BACKUPS]
|
||||
systemd = {
|
||||
timers.backup-container-storage = {
|
||||
enable = true;
|
||||
description = "Backup container volumes";
|
||||
wantedBy = ["multi-user.target"];
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 02:00:00";
|
||||
Unit = "backup-container-storage.service";
|
||||
};
|
||||
};
|
||||
services.backup-container-storage = {
|
||||
description = "Backup container volumes";
|
||||
startLimitBurst = 1;
|
||||
startLimitIntervalSec = 1800;
|
||||
script = with builtins; let
|
||||
volumes = concatMap (s: s.volumes) services;
|
||||
backupVolumes = filter (v: if v ? backup then v.backup else true) volumes;
|
||||
backupMountpoints = map (v: hostVolumeDir + v.name) backupVolumes;
|
||||
in ''
|
||||
PATH="$PATH:${pkgs.lib.makeBinPath [
|
||||
pkgs.gnutar
|
||||
pkgs.gzip
|
||||
]}"
|
||||
mountpoint ${hostBackupDir} || {
|
||||
echo "${hostBackupDir} is not a mountpoint!"
|
||||
exit 7
|
||||
}
|
||||
echo "Starting Backup"
|
||||
# 7 days of backups
|
||||
rm -rf ${hostBackupDir}/backup.7.tgz
|
||||
for x in $(seq 6); do
|
||||
mv "${hostBackupDir}/backup.$x.tgz" "${hostBackupDir}/backup.$((x+1)).tgz"
|
||||
done
|
||||
tar -zcvpf ${hostBackupDir}/backup.1.tgz ${toString backupMountpoints}
|
||||
'';
|
||||
};
|
||||
};
|
||||
# systemd = {
|
||||
# timers.backup-container-storage = {
|
||||
# enable = true;
|
||||
# description = "Backup container volumes";
|
||||
# wantedBy = ["multi-user.target"];
|
||||
# timerConfig = {
|
||||
# OnCalendar = "*-*-* 02:00:00";
|
||||
# Unit = "backup-container-storage.service";
|
||||
# };
|
||||
# };
|
||||
# services.backup-container-storage = {
|
||||
# description = "Backup container volumes";
|
||||
# startLimitBurst = 1;
|
||||
# startLimitIntervalSec = 1800;
|
||||
# script = with builtins; let
|
||||
# volumes = concatMap (s: s.volumes) services;
|
||||
# backupVolumes = filter (v: if v ? backup then v.backup else true) volumes;
|
||||
# backupMountpoints = map (v: hostVolumeDir + v.name) backupVolumes;
|
||||
# in ''
|
||||
# PATH="$PATH:${pkgs.lib.makeBinPath [
|
||||
# pkgs.gnutar
|
||||
# pkgs.gzip
|
||||
# ]}"
|
||||
# mountpoint ${hostBackupDir} || {
|
||||
# echo "${hostBackupDir} is not a mountpoint!"
|
||||
# exit 7
|
||||
# }
|
||||
# echo "Starting Backup"
|
||||
# # 7 days of backups
|
||||
# rm -rf ${hostBackupDir}/backup.7.tgz
|
||||
# for x in $(seq 6); do
|
||||
# mv "${hostBackupDir}/backup.$x.tgz" "${hostBackupDir}/backup.$((x+1)).tgz"
|
||||
# done
|
||||
# tar -zcvpf ${hostBackupDir}/backup.1.tgz ${toString backupMountpoints}
|
||||
# '';
|
||||
# };
|
||||
# };
|
||||
|
||||
# [SECURITY]
|
||||
security.sudo.execWheelOnly = true;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
server = {
|
||||
DOMAIN = "githug.xyz";
|
||||
ROOT_URL = "https://githug.xyz/";
|
||||
# COOKIE_SECURE = true;
|
||||
COOKIE_SECURE = true;
|
||||
HTTP_PORT = 3001;
|
||||
OFFLINE_MODE = true;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user