aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-04 17:38:54 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-04 17:38:54 +0200
commit3df47c8440a3b5645733184f72cc4c2f1a46587f (patch)
tree1bcb53842e26f117dce7339afb8999bc49b8e0a3
parent72ed2517a9a49352ff97473010892fc54490cd60 (diff)
downloadnixcfg-3df47c8440a3b5645733184f72cc4c2f1a46587f.tar.gz
nixcfg-3df47c8440a3b5645733184f72cc4c2f1a46587f.zip
Configuration for prod to run on Wesher & other new stuff
-rw-r--r--app/frontend/deploy/frontend-tricot-prod.hcl84
-rw-r--r--cluster/prod/cluster.nix78
-rw-r--r--cluster/prod/node/celeri.nix14
-rw-r--r--cluster/prod/node/concombre.nix14
-rw-r--r--cluster/prod/node/courgette.nix14
-rw-r--r--cluster/prod/site/neptune.nix3
-rw-r--r--cluster/staging/cluster.nix1
-rw-r--r--ssh_known_hosts3
8 files changed, 125 insertions, 86 deletions
diff --git a/app/frontend/deploy/frontend-tricot-prod.hcl b/app/frontend/deploy/frontend-tricot-prod.hcl
new file mode 100644
index 0000000..9906709
--- /dev/null
+++ b/app/frontend/deploy/frontend-tricot-prod.hcl
@@ -0,0 +1,84 @@
+job "frontend" {
+ datacenters = ["neptune"]
+ type = "service"
+ priority = 90
+
+ group "tricot" {
+ network {
+ port "http_port" { static = 80 }
+ port "https_port" { static = 443 }
+ }
+
+ task "server" {
+ driver = "docker"
+
+ config {
+ image = "lxpz/amd64_tricot:37"
+ network_mode = "host"
+ readonly_rootfs = true
+ ports = [ "http_port", "https_port" ]
+ volumes = [
+ "secrets:/etc/tricot",
+ ]
+ }
+
+ resources {
+ cpu = 2000
+ memory = 200
+ }
+
+ restart {
+ interval = "30m"
+ attempts = 2
+ delay = "15s"
+ mode = "delay"
+ }
+
+ template {
+ data = "{{ key \"secrets/consul/consul-ca.crt\" }}"
+ destination = "secrets/consul-ca.crt"
+ }
+
+ template {
+ data = "{{ key \"secrets/consul/consul-client.crt\" }}"
+ destination = "secrets/consul-client.crt"
+ }
+
+ template {
+ data = "{{ key \"secrets/consul/consul-client.key\" }}"
+ destination = "secrets/consul-client.key"
+ }
+
+ template {
+ data = <<EOH
+TRICOT_NODE_NAME={{ env "attr.unique.consul.name" }}
+TRICOT_LETSENCRYPT_EMAIL=alex@adnab.me
+TRICOT_ENABLE_COMPRESSION=true
+TRICOT_CONSUL_HOST=https://localhost:8501
+TRICOT_CONSUL_CA_CERT=/etc/tricot/consul-ca.crt
+TRICOT_CONSUL_CLIENT_CERT=/etc/tricot/consul-client.crt
+TRICOT_CONSUL_CLIENT_KEY=/etc/tricot/consul-client.key
+TRICOT_HTTP_BIND_ADDR=[::]:80
+TRICOT_HTTPS_BIND_ADDR=[::]:443
+RUST_LOG=tricot=debug
+EOH
+ destination = "secrets/env"
+ env = true
+ }
+
+ service {
+ name = "tricot-http"
+ port = "http_port"
+ tags = [ "(diplonat (tcp_port 80))" ]
+ address_mode = "host"
+ }
+
+ service {
+ name = "tricot-https"
+ port = "https_port"
+ tags = [ "(diplonat (tcp_port 443))" ]
+ address_mode = "host"
+ }
+ }
+ }
+}
diff --git a/cluster/prod/cluster.nix b/cluster/prod/cluster.nix
index d131db7..ece401e 100644
--- a/cluster/prod/cluster.nix
+++ b/cluster/prod/cluster.nix
@@ -2,64 +2,42 @@
{
deuxfleurs.cluster_name = "prod";
- deuxfleurs.cluster_nodes = [
- {
- hostname = "concombre";
- site_name = "neptune";
- publicKey = "VvXT0fPDfWsHxumZqVShpS33dJQAdpJ1E79ZbCBJP34=";
- IP = "10.42.1.31";
- endpoint = "82.66.112.151:33731";
- lan_endpoint = "192.168.1.31:33731";
- }
- {
- hostname = "courgette";
- site_name = "neptune";
- publicKey = "goTkBJGmzrGDOAjUcdH9G0JekipqSMoaYQdB6IHnzi0=";
- IP = "10.42.1.32";
- endpoint = "82.66.112.151:33732";
- lan_endpoint = "192.168.1.32:33732";
- }
- {
- hostname = "celeri";
- site_name = "neptune";
- publicKey = "oZDAb8LoLW87ktUHyFFec0VaIar97bqq47mGbdVqJ0U=";
- IP = "10.42.1.33";
- endpoint = "82.66.112.151:33733";
- lan_endpoint = "192.168.1.33:33733";
- }
+
+ # Bootstrap nodes for Wesher overlay network
+ services.wesher.join = [
+ "2a01:e0a:c:a720::31" # concombre
+ "2a01:e0a:c:a720::32" # courgette
+ "2a01:e0a:c:a720::33" # celeri
];
- deuxfleurs.admin_nodes = [
- {
- hostname = "hammerhead";
- publicKey = "b5hF+GSTgg3oM6wnjL7jRbfyf1jtsWdVptPPbAh3Qic=";
- IP = "10.42.0.1";
- endpoint = "5.135.179.11:51349";
- }
- {
- hostname = "robinson";
- publicKey = "ETaZFil3mFXlJ0LaJZyWqJVLV2IZUF5PB/8M7WbQSTg=";
- IP = "10.42.0.42";
- endpoint = "77.141.67.109:33742";
- }
- {
- hostname = "shiki";
- publicKey = "QUiUNMk70TEQ75Ut7Uqikr5uGVSXmx8EGNkGM6tANlg=";
- IP = "10.42.0.206";
- endpoint = "37.187.118.206:51820";
- }
- {
- hostname = "lindy";
- publicKey = "wen9GnZy2iLT6RyHfn7ydS/wvdvow1XPmhZxIkrDbks=";
- IP = "10.42.0.66";
- endpoint = "82.66.112.151:33766";
- }
+
+ # The IP range to use for the Wesher overlay of this cluster
+ deuxfleurs.wesher_cluster_prefix = "10.83.0.0";
+ deuxfleurs.wesher_cluster_prefix_length = 16;
+
+ # Bootstrap IPs for Consul cluster,
+ # these are IPs on the Wesher overlay
+ services.consul.extraConfig.retry_join = [
+ "10.83.101.43" # concombre
+ "10.83.66.14" # courgette
+ "10.83.12.147" # celeri
];
+
deuxfleurs.admin_accounts = {
lx = [
# Keys for accessing nodes from outside
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJpaBZdYxHqMxhv2RExAOa7nkKhPBOHupMP3mYaZ73w9 lx@lindy"
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIDdVbA9fEdqSr5U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twr7PIdv22PnJkh6iR5kx7eTRxkNZdN quentin@deuxfleurs.fr"
+ ];
+ adrien = [
+ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBfVX+iQSHl3V0el3/y2Rtl9Q/nrmLoTE3oXnR+16yX7g8HvzU871q89jbE/UWvNRvO4hirTcKF8yojuq8ZRCoUcQO+6/YlPrY/2G8kFhPTlUGDQ+mLT+ancZsom4mkg3I9oQjKZ9qxMD1GuU8Ydz4eXjhJ8OGFZhBpEgnrLmdA53Y5d2fCbaZN5EYD4sWEFYN7xBLxTGNwv0gygiPs967Z4/ZfHngTvqVoS9wnQThSCIoXPTWFAJCkN8dC5tPZwnbOT1bGcYUF0VTrcaD6cU6Q1ZRrtyqXxnnyxpQCAoe2hgdIm+LnDsBx9trfPauqi0dXi36X8pLmudW1f1RmKWT adrien@bacigalupi"
+ ];
+ maximilien = [
+ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHMMR6zNzz8NQU80wFquhUCeiXJuGphjP+zNouKbn228GyESu8sfNBwnuZq86vblR11Lz8l2rtCM73GfAKg29qmUWUHRKWvRIYWv2vaUJcCdy0bAxIzcvCvjZX0SpnIKxe9y3Rp0LGO5WLYfw0ZFaavwFZP0Z8w1Kj9/zBmL2X2avbhkaYHi/C1yXhbvESYQysmqLa48EX/TS616MBrgR9zbI9AoTQ9NOHnR14Tve/AP/khcZoBJdm4hTttMbNkEc0wonzdylTDew263SPRs/uoqnQIpUtErdPHqU10Yup8HjXjEyFJsSwcZcM5sZOw5JKckKJwmcd0yjO/x/4/Mk5"
+ ];
};
# For Garage external communication
diff --git a/cluster/prod/node/celeri.nix b/cluster/prod/node/celeri.nix
index 02a33c9..9317de4 100644
--- a/cluster/prod/node/celeri.nix
+++ b/cluster/prod/node/celeri.nix
@@ -12,18 +12,8 @@
deuxfleurs.network_interface = "eno1";
deuxfleurs.lan_ip = "192.168.1.33";
+ deuxfleurs.ipv6 = "2a01:e0a:c:a720::33";
- networking.interfaces.eno1.ipv6.addresses = [
- {
- address = "2a01:e0a:c:a720::33";
- prefixLength = 64;
- }
- ];
-
- deuxfleurs.vpn_ip = "10.42.1.33";
- deuxfleurs.vpn_listen_port = 33733;
+ deuxfleurs.cluster_ip = "10.83.12.147";
deuxfleurs.is_raft_server = true;
-
- # Enable netdata monitoring
- services.netdata.enable = true;
}
diff --git a/cluster/prod/node/concombre.nix b/cluster/prod/node/concombre.nix
index 517dcf8..c38e89d 100644
--- a/cluster/prod/node/concombre.nix
+++ b/cluster/prod/node/concombre.nix
@@ -12,18 +12,8 @@
deuxfleurs.network_interface = "eno1";
deuxfleurs.lan_ip = "192.168.1.31";
+ deuxfleurs.ipv6 = "2a01:e0a:c:a720::31";
- networking.interfaces.eno1.ipv6.addresses = [
- {
- address = "2a01:e0a:c:a720::31";
- prefixLength = 64;
- }
- ];
-
- deuxfleurs.vpn_ip = "10.42.1.31";
- deuxfleurs.vpn_listen_port = 33731;
+ deuxfleurs.cluster_ip = "10.83.101.43";
deuxfleurs.is_raft_server = true;
-
- # Enable netdata monitoring
- services.netdata.enable = true;
}
diff --git a/cluster/prod/node/courgette.nix b/cluster/prod/node/courgette.nix
index d34e7a5..d31af77 100644
--- a/cluster/prod/node/courgette.nix
+++ b/cluster/prod/node/courgette.nix
@@ -12,18 +12,8 @@
deuxfleurs.network_interface = "eno1";
deuxfleurs.lan_ip = "192.168.1.32";
+ deuxfleurs.ipv6 = "2a01:e0a:c:a720::32";
- networking.interfaces.eno1.ipv6.addresses = [
- {
- address = "2a01:e0a:c:a720::32";
- prefixLength = 64;
- }
- ];
-
- deuxfleurs.vpn_ip = "10.42.1.32";
- deuxfleurs.vpn_listen_port = 33732;
+ deuxfleurs.cluster_ip = "10.83.66.147";
deuxfleurs.is_raft_server = true;
-
- # Enable netdata monitoring
- services.netdata.enable = true;
}
diff --git a/cluster/prod/site/neptune.nix b/cluster/prod/site/neptune.nix
index 900ddf0..6e69b18 100644
--- a/cluster/prod/site/neptune.nix
+++ b/cluster/prod/site/neptune.nix
@@ -4,6 +4,9 @@
deuxfleurs.site_name = "neptune";
deuxfleurs.lan_default_gateway = "192.168.1.254";
deuxfleurs.lan_ip_prefix_length = 24;
+ deuxfleurs.ipv6_prefix_length = 64;
networking.nameservers = [ "192.168.1.254" ];
+
+ networking.firewall.allowedTCPPorts = [ 80 443 ];
}
diff --git a/cluster/staging/cluster.nix b/cluster/staging/cluster.nix
index fbacbc5..2ad79bf 100644
--- a/cluster/staging/cluster.nix
+++ b/cluster/staging/cluster.nix
@@ -22,6 +22,7 @@
"10.14.252.121" # carcajou
];
+ # Add wesher hosts to /etc/hosts, needed for elasticsearch
networking.extraHosts = ''
10.14.181.82 caribou
10.14.179.56 cariacou
diff --git a/ssh_known_hosts b/ssh_known_hosts
index e3181cf..6d003c9 100644
--- a/ssh_known_hosts
+++ b/ssh_known_hosts
@@ -9,3 +9,6 @@
2a01:e0a:c:a720::22 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMf/ioVSSb19Slu+HZLgKt4f1/XsL+K9uMxazSWb/+nQ
2a01:e0a:c:a720::21 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPXTUrXRFhudJBESCqjHCOttzqYPyIzpPOMkI8+SwLRx
2a01:e0a:c:a720::23 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDsYD1gNmGyb6c9wjGR6tC69fHP6+FpPHTBT6laPTHeD
+2a01:e0a:c:a720::33 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOuY1CvhxBP9BtKkTlmOUu6Hhy8OQTB3R8OCFXbHA/RA
+2a01:e0a:c:a720::31 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL3N0QOFNGkCpVLuOHFdpnBaxIFH925KpdIHV/3F9+BR
+2a01:e0a:c:a720::32 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPCXJeo6yeQeTN7D7OZwLd8zbyU1jWywlhQ29yyk7x+G