@cryptotaxi247 / infra / commits / 6ae1bcd4

bastion: add swap on the machine

it's better to have a slow bastion than no bastion at all

Eelco Dolstra committed Mar 16, 2019 at 17:45 UTC 6ae1bcd44bb597da1ad388ee637f53eb9e5c66e7
1 file changed +7 -1
bastion/network.nix
+7 -1
@@ -90,7 +90,7 @@ in
90 };
91
92 bastion =
93 - { config, pkgs, resources, ... }:
93 + { config, lib, pkgs, resources, ... }:
94
95 { deployment.targetEnv = "ec2";
96 deployment.ec2.tags.Name = "NixOS.org Infrastructure Deployment Server";
@@ -148,6 +148,12 @@ in
148 ec2.disk = resources.ebsVolumes.scratch;
149 };
150
151 + # work around releases taking too much memory
152 + swapDevices = [{device = "/scratch/swapfile"; size = 32 * 1024; }];
153 +
154 + # avoid swap as much as possible
155 + boot.kernel.sysctl."vm.swappiness" = lib.mkDefault 0;
156 +
157 systemd.tmpfiles.rules = [ "d /scratch/hydra-mirror 0755 hydra-mirror users 10d" ];
158 };
159 }