wip: convert ekman to new cluster sturcture (not complete)
This commit is contained in:
180
ekman/fs-backup/default.nix
Normal file
180
ekman/fs-backup/default.nix
Normal file
@@ -0,0 +1,180 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
name = "fs-backup";
|
||||
address = "10.255.241.80";
|
||||
etcdCluster = import ../etcdCluster.nix;
|
||||
in {
|
||||
fs-backup = { config, pkgs, ... }: with pkgs; {
|
||||
deployment.tags = [ "fs" "fs-backup" ];
|
||||
deployment.targetHost = address;
|
||||
system.autoUpgrade.enable = lib.mkForce false;
|
||||
|
||||
systemd.targets = {
|
||||
sleep.enable = false;
|
||||
suspend.enable = false;
|
||||
hibernate.enable = false;
|
||||
hybrid-sleep.enable = false;
|
||||
};
|
||||
|
||||
# services.udev.extraRules = ''
|
||||
# KERNEL=="ibp65s0", SUBSYSTEM=="net", ATTR{create_child}:="0x7666"
|
||||
# '';
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
rdma-core
|
||||
hwloc
|
||||
xfsprogs
|
||||
];
|
||||
|
||||
boot.swraid = {
|
||||
enable = true;
|
||||
mdadmConf = ''
|
||||
DEVICE partitions
|
||||
ARRAY /dev/md/0 metadata=1.2 UUID=b743fdd4:5b339cc7:7c43f50f:3b81243e name=fs2:0
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.restart-md0 = {
|
||||
description = "restart /dev/md0";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "sys-devices-virtual-block-md0.device" "-.mount" ];
|
||||
before = [ "backup.mount" ];
|
||||
path = [ "/run/current-system/sw/" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
script = ''
|
||||
restart=0
|
||||
${util-linux}/bin/lsblk -o MAJ:MIN -n /dev/md0 | grep -q "254:" || restart=1
|
||||
if [ $restart = 1 ]; then
|
||||
${mdadm}/bin/mdadm --stop /dev/md0
|
||||
${mdadm}/bin/mdadm --assemble /dev/md0
|
||||
sleep 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
cluster = {
|
||||
k8sNode = true;
|
||||
slurm = false;
|
||||
mounts = {
|
||||
rdma.enable = false;
|
||||
automount.enable = true;
|
||||
home = false;
|
||||
opt = false;
|
||||
work = false;
|
||||
data = false;
|
||||
backup = false;
|
||||
ceph = false;
|
||||
};
|
||||
};
|
||||
|
||||
features.hpc.slurm.mungeUid = 996;
|
||||
|
||||
features = {
|
||||
host = {
|
||||
inherit address;
|
||||
inherit name;
|
||||
};
|
||||
|
||||
os = {
|
||||
externalInterface = "eno1";
|
||||
nfs.enable = true;
|
||||
nfs.exports = ''
|
||||
/exports 10.255.241.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
|
||||
/exports 10.255.243.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
|
||||
/exports 10.255.244.0/24(insecure,rw,async,no_subtree_check,crossmnt,fsid=0,no_root_squash)
|
||||
'';
|
||||
};
|
||||
|
||||
k8s = {
|
||||
enable = true;
|
||||
node.enable = true;
|
||||
master.enable = false;
|
||||
inherit etcdCluster;
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.rc-local = {
|
||||
description = "rc.local script";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
path = [ "/run/current-system/sw/" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
};
|
||||
script = ''
|
||||
# if [ -e /sys/block/md126 ]; then
|
||||
# echo "deadline" > /sys/block/md126/queue/scheduler
|
||||
# # echo "4096" > /sys/block/md126/queue/nr_requests
|
||||
# echo "4096" > /sys/block/md126/queue/read_ahead_kb
|
||||
# echo "always" > /sys/kernel/mm/transparent_hugepage/enabled
|
||||
# echo "always" > /sys/kernel/mm/transparent_hugepage/defrag
|
||||
# fi
|
||||
grep -q rdma /proc/fs/nfsd/portlist || echo "rdma 20049" > /proc/fs/nfsd/portlist
|
||||
grep -q tcp /proc/fs/nfsd/portlist || echo "tcp 2049" > /proc/fs/nfsd/portlist
|
||||
'';
|
||||
};
|
||||
|
||||
boot.kernel.sysctl = {
|
||||
"vm.dirty_background_ratio" = 5;
|
||||
"vm.dirty_ratio" = 10;
|
||||
"vm.vfs_cache_pressure" = 50;
|
||||
"vm.min_free_kbytes" = 262144;
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = name;
|
||||
interfaces.eno1 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [ {
|
||||
address = address;
|
||||
prefixLength = 24;
|
||||
} ];
|
||||
ipv4.routes = [
|
||||
{
|
||||
address = "10.255.244.0";
|
||||
prefixLength = 24;
|
||||
via = "10.255.241.99";
|
||||
}
|
||||
];
|
||||
};
|
||||
interfaces.ibp59s0 = {
|
||||
useDHCP = false;
|
||||
ipv4.addresses = [ {
|
||||
address = "10.255.243.80";
|
||||
prefixLength = 24;
|
||||
} ];
|
||||
};
|
||||
firewall = {
|
||||
allowedTCPPorts = [];
|
||||
allowedUDPPorts = [];
|
||||
extraCommands = ''
|
||||
iptables -t nat -A POSTROUTING -s 10.255.243.0/24 -j MASQUERADE
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
services.rpcbind.enable = true;
|
||||
|
||||
fileSystems = {
|
||||
"/exports/backup" = {
|
||||
device = "/backup";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
"/exports/ekman" = {
|
||||
device = "/backup/ekman-nfs";
|
||||
options = [ "bind" ];
|
||||
};
|
||||
};
|
||||
|
||||
programs.singularity.enable = true;
|
||||
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
../cluster.nix
|
||||
../mounts.nix
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
41
ekman/fs-backup/hardware-configuration.nix
Normal file
41
ekman/fs-backup/hardware-configuration.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "megaraid_sas" "mpt3sas" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/19b7e607-b138-442a-9026-3ae1092046c9";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/backup" =
|
||||
{ device = "/dev/vg1/data";
|
||||
fsType = "xfs";
|
||||
options = [ "ro" "noauto" ];
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno2.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno3.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno4.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||
}
|
||||
1
ekman/fs-backup/ssh_host_key.pub
Normal file
1
ekman/fs-backup/ssh_host_key.pub
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCb3/Z4YEFmeeaqQYzATkHgNaDWaT6MjiQsrIFYlZsvdXyE5QjGZMeRBMgJQyoyeCm9ig3sMbY8qiWLc/Kg+rFnEy+4xO7GYzCfqo1YsETiD0K+m/TbOsz9M2m+N8k+REWpKp9njTOYwsjWbrQ6FQPeQaKmig7P0PXJsSS/SAUr0Ns98QtBA9KtfRbDDCUlG4T/+kfu4Y970u0ABOF+zrE2mzfuaSn7n/jJAcAusIUQ9iiTrI6WHAok8lg9jC/+piW6ToEN7/ZX/RDggj5U5ZeN2IsjD1TZq57b/v7BAVx2CA38IYjuYizJFIlL8o7hEP22an1i44crsaR8pwJcfeMWzQxVIm9TPhSZZB9Ibq1R1syNb9vH/svmR8csWl0Uemk3gUGBJwzltmuXhLBg8mobypfBThAI/ZQKslvM9G9r4LoeLmxOOUTbCfXhi3ndIkEC2vGvo74h58BQj/DvMJ3a+V6gTha4837e2LK3Fm/8XWtU42jNbNlmblhLZby7uKWWb6orCnxscRs3cjP3BObSh6h9DO2aXMTnGYSGFdUKrRLFRmzFr+MPdhyORqp+GQgtHkzFG9W3/otQHdDCcD2OeFOxwEr3jOwUgtGIO1ZmJFDB9EIVHWyRk519foeZq/EHcSmIxgbwTgkpi/w8NQ1j++2nDxQOUeWo3U8xiQhONQ== root@fs2
|
||||
Reference in New Issue
Block a user