aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configuration.nix48
1 files changed, 44 insertions, 4 deletions
diff --git a/configuration.nix b/configuration.nix
index f25efc7..6dcf30e 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -2,8 +2,11 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
-{ config, pkgs, ... }:
+{ config, pkgs, ... } @ args:
+# Configuration local for this cluster node (hostname, IP, etc)
+let node_config = import ./node.nix args;
+in
{
imports =
[ # Include the results of the hardware scan.
@@ -115,16 +118,53 @@
# };
# List services that you want to enable:
-
+
# Enable network time
services.ntp.enable = true;
# Enable the OpenSSH daemon.
services.openssh.enable = true;
+ # Enable Hashicorp Consul & Nomad
+ services.consul.enable = true;
+ services.consul.extraConfig =
+ let public_ip = (builtins.head node_config.networking.interfaces.eno1.ipv4.addresses).address;
+ in
+ {
+ datacenter = "neptune";
+ bootstrap_expect = 3;
+ server = true;
+ ui = true;
+ bind_addr = public_ip;
+ addresses.http = "0.0.0.0";
+ retry_join = [ "192.168.1.21" "192.168.1.22" "192.168.1.23" ];
+ };
+
+ services.nomad.enable = true;
+ services.nomad.settings =
+ let public_ip = (builtins.head node_config.networking.interfaces.eno1.ipv4.addresses).address;
+ in
+ {
+ datacenter = "neptune";
+ server = {
+ enabled = true;
+ bootstrap_expect = 3;
+ };
+ advertise = {
+ rpc = public_ip;
+ http = public_ip;
+ serf = public_ip;
+ };
+ consul.address = "127.0.0.1:8500";
+ client = {
+ enabled = true;
+ network_interface = "eno1";
+ };
+ };
+
# Open ports in the firewall.
- networking.firewall.allowedTCPPorts = [ 22 ];
- # networking.firewall.allowedUDPPorts = [ ... ];
+ networking.firewall.allowedTCPPorts = [ 22 4646 4647 4648 8500 8300 8301 8302 ];
+ networking.firewall.allowedUDPPorts = [ 4648 8301 8302 ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;