Add production system and add on-failure service restart for Node applications

master
Sven Slootweg 7 years ago
parent 42b67c7378
commit aa85f35cb6

@ -44,6 +44,7 @@
ExecStart = "${application}/${mainBinaryPath}";
User = name;
PermissionsStartOnly = true;
Restart = "on-failure";
};
} // serviceConfig);
};

@ -0,0 +1,15 @@
{
imports = [
<nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
boot = {
initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "sd_mod" "sr_mod" ];
loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
};
}

@ -7,7 +7,7 @@
generateCaddyConfiguration = (import ../lib/generate/caddy-configuration.nix) args;
in let
proxiedApplications = [{
hostname = "pastebin-stream-dev.cryto.net";
hostname = config.systems.osmium.applications.pastebin-stream.hostname;
tls = true;
proxyTarget = "http://localhost:3000";
}];
@ -16,11 +16,12 @@
imports = [
(pastebinStream {
errorPath = "/var/lib/pastebin-stream/errors";
rev = "3b7f6ea4ad663b82e7cfd95ae3c65f1a32f0cb0a";
sha256 = "0w29rwgkjpd9cl42z0n2fy5is730db3mfsqvjmxa7x65nz34d3wj";
rev = "06ef0fa19aa05a755efcafd9be077d3dacd79ee8";
sha256 = "06ilz7g31lrwyn1lcx095a5nn305xfmg5whdqb4ghgc8whn765s8";
})
];
config = {
services.caddy = {
enable = true;
agree = true;
@ -52,4 +53,16 @@
htop
];
};
options.systems.osmium = with lib; {
applications.pastebin-stream = {
hostname = mkOption {
description = ''
The hostname to expose the pastebin-stream application on.
'';
type = types.str;
};
};
};
};
}

@ -11,6 +11,11 @@ in {
deployment.targetEnv = "digitalOcean";
deployment.digitalOcean.region = "ams2";
deployment.digitalOcean.size = "512mb";
#deployment.digitalOcean.authToken = removeNewlines (builtins.readFile ../credentials/digitalocean-auth-token);
systems.osmium = {
applications.pastebin-stream = {
hostname = "pastebin-stream-dev.cryto.net";
};
};
} // presetRootSsh // presetTools;
}

@ -0,0 +1,32 @@
let
removeNewlines = (import ../lib/util/remove-newlines.nix);
presetRootSsh = (import ../lib/presets/root-ssh.nix);
in {
osmium = {config, pkgs, ...}@args: let
presetTools = (import ../lib/presets/tools.nix) args;
presetQemuGuest = (import ../lib/presets/qemu-guest.nix);
in
{
deployment.targetHost = "80.255.0.137";
systems.osmium = {
applications.pastebin-stream = {
hostname = "pastebin-stream.cryto.net";
};
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/cf472470-0b3d-414b-93f8-b5e4298fad05";
fsType = "ext4";
};
networking = {
hostName = "osmium";
defaultGateway6 = "2a01:4a0:4a::1";
interfaces.enp0s3 = {
ipv6Address = "2a01:4a0:4a:5d::35c7";
ipv6PrefixLength = 48;
};
};
} // presetRootSsh // presetTools // presetQemuGuest;
}
Loading…
Cancel
Save