-
Notifications
You must be signed in to change notification settings - Fork 13
new NFS server: kobudai #77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b2506a9
add disko to `nix develop`
dotlambda a38dd31
add dotlambda's SSH key for deployment
dotlambda 1196589
move NFS exports from dataloss to kobudai
dotlambda 8168111
add kobudai host key and secrets
dotlambda 2b80315
kobudai: remove redundant hostname config
24apricots 3686d46
kobudai: improve accuracy of bind mount comment
24apricots File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| { | ||
| networking.hostName = "kobudai"; | ||
|
|
||
| ocf.network = { | ||
| enable = true; | ||
| bond.enable = true; | ||
|
24apricots marked this conversation as resolved.
|
||
| lastOctet = 6; | ||
| }; | ||
|
|
||
| ocf.nfs-export = { | ||
| enable = true; | ||
| # https://github.com/ocf/puppet/blob/a081b2210691bd46d585accc8548c985188486a0/modules/ocf_filehost/manifests/init.pp#L10-L16 | ||
| exports."/opt/homes" = [ | ||
| { | ||
| hosts = [ | ||
| "admin" | ||
| "www" | ||
| "ssh" | ||
| "apphost" | ||
| "adenine" | ||
| "guanine" | ||
| "cytosine" | ||
| "thymine" | ||
| "tsunami" | ||
| "supernova" | ||
| ]; | ||
| options = [ | ||
| "rw" | ||
| "fsid=0" | ||
| "no_subtree_check" | ||
| "no_root_squash" | ||
| ]; | ||
| } | ||
| { | ||
| hosts = [ "*.ocf.berkeley.edu" ]; | ||
| options = [ | ||
| "rw" | ||
| "fsid=0" | ||
| "no_subtree_check" | ||
| "root_squash" | ||
| "sec=krb5p" | ||
| ]; | ||
| } | ||
| ]; | ||
| }; | ||
|
|
||
| # FIXME remove and make sure it still boots | ||
| hardware.enableAllHardware = true; | ||
|
24apricots marked this conversation as resolved.
|
||
|
|
||
| disko.devices = { | ||
| disk = { | ||
| main = { | ||
| device = "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_1TB_S252NXAGA05227F"; | ||
| type = "disk"; | ||
| content = { | ||
| type = "gpt"; | ||
| partitions = { | ||
| ESP = { | ||
| size = "1G"; | ||
| type = "EF00"; | ||
| content = { | ||
| type = "filesystem"; | ||
| format = "vfat"; | ||
| mountpoint = "/boot"; | ||
| mountOptions = [ "umask=0077" ]; | ||
| }; | ||
| }; | ||
| root = { | ||
| size = "100%"; | ||
| content = { | ||
| type = "filesystem"; | ||
| format = "ext4"; | ||
| mountpoint = "/"; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
| }; | ||
|
|
||
| boot.swraid = { | ||
| enable = true; | ||
| mdadmConf = '' | ||
| MAILADDR root@ocf.berkeley.edu | ||
| ARRAY /dev/md/nfs metadata=1.2 UUID=46b10914:9f84099b:dd54304a:917d7898 | ||
| ''; | ||
| }; | ||
|
|
||
| fileSystems = { | ||
| "/opt/homes" = { | ||
| device = "/dev/md/nfs"; | ||
| fsType = "ext4"; | ||
| options = [ | ||
| "noatime" | ||
| "nodev" | ||
| "usrquota" | ||
| ]; | ||
| }; | ||
|
|
||
| # Bind mount /opt/homes/home to /home. This allows running | ||
| # mount kobudai:/home /home | ||
|
24apricots marked this conversation as resolved.
|
||
| # In fact, since home is CNAMEd to filehost is CNAMEd to kobudai, even | ||
|
24apricots marked this conversation as resolved.
Outdated
|
||
| # mount homes:/home /home | ||
| # works and that's what the Puppet config in modules/ocf/manifests/nfs.pp does. | ||
| "/home" = { | ||
| device = "/opt/homes/home"; | ||
| fsType = "none"; | ||
| options = [ "bind" ]; | ||
| }; | ||
| "/services" = { | ||
| device = "/opt/homes/services"; | ||
| fsType = "none"; | ||
| options = [ "bind" ]; | ||
| }; | ||
| }; | ||
|
|
||
| nixpkgs.hostPlatform = "x86_64-linux"; | ||
|
24apricots marked this conversation as resolved.
|
||
|
|
||
| system.stateVersion = "25.11"; | ||
|
24apricots marked this conversation as resolved.
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| { config, lib, ... }: | ||
|
|
||
| let | ||
| inherit (lib) | ||
| concatMapAttrsStringSep | ||
| concatMapStringsSep | ||
| concatStringsSep | ||
| mkEnableOption | ||
| mkIf | ||
| mkOption | ||
| types | ||
| ; | ||
| cfg = config.ocf.nfs-export; | ||
| in | ||
| { | ||
| options.ocf.nfs-export = { | ||
| enable = mkEnableOption "NFS exports"; | ||
| exports = mkOption { | ||
| type = types.attrsOf ( | ||
| types.nonEmptyListOf ( | ||
| types.submodule { | ||
| options = { | ||
| hosts = mkOption { | ||
| description = "Hosts with which the export is shared"; | ||
| example = [ | ||
| "192.168.0.0/28" | ||
| "*.ocf.io" | ||
| ]; | ||
| type = with types; nonEmptyListOf str; | ||
| }; | ||
| options = mkOption { | ||
| default = [ ]; | ||
| description = "NFS options applied to the hosts"; | ||
| example = [ "rw" ]; | ||
| type = with types; listOf str; | ||
| }; | ||
| }; | ||
| } | ||
| ) | ||
| ); | ||
| }; | ||
| }; | ||
|
|
||
| config = mkIf cfg.enable { | ||
| # nfs server should not be mounting nfs from itself | ||
| ocf.nfs.enable = lib.mkForce false; | ||
|
|
||
| services.nfs.server = { | ||
| enable = true; | ||
| # https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/5/html/deployment_guide/s1-nfs-server-config-exports | ||
| exports = concatMapAttrsStringSep "" (directory: hostsAndOptions: '' | ||
| ${directory} \ | ||
| ${concatMapStringsSep " \\\n " ( | ||
| { hosts, options }: | ||
| concatMapStringsSep " \\\n " (host: "${host}(${concatStringsSep "," options})") hosts | ||
| ) hostsAndOptions} | ||
| '') cfg.exports; | ||
| }; | ||
|
|
||
| networking.firewall.allowedTCPPorts = [ | ||
| # sufficient for NFSv4 | ||
| 2049 | ||
| ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM/0C6BKkMeuHKXXA4ZEWHmXxvTRYx09dCCRMsVr+rHc |
Binary file not shown.
Binary file added
BIN
+373 Bytes
secrets/rekeyed/kobudai/06d592eee1f9b5c35dde568860ef51ef-root-password-hash.age
Binary file not shown.
Binary file added
BIN
+458 Bytes
secrets/rekeyed/kobudai/37440bfa0771d33bd2dcd216d9cb8806-tsig-secret.age
Binary file not shown.
Binary file added
BIN
+480 Bytes
secrets/rekeyed/kobudai/d02317674a844c0fee3f3e901ca46352-krb5-keytab.age
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.