summary refs log tree commit diff
path: root/host
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-02-19 11:17:09 +0100
committerRory& <root@rory.gay>2024-06-05 17:25:16 +0200
commitc7730dde577da99d5532c9ca358d31f4ad42caf8 (patch)
treea9929914eb390f05d9d93a48b9c90aee1109d2c2 /host
parentSpacebar import - use variables (diff)
downloadSpacebar-Open-Infrastructure-c7730dde577da99d5532c9ca358d31f4ad42caf8.tar.xz
Switch dev/nix instance to master
Fix missing semicolon
Diffstat (limited to 'host')
-rwxr-xr-xhost/Spacebar-nginx/configuration.nix10
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix4
-rw-r--r--host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix2
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix19
-rwxr-xr-xhost/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix72
5 files changed, 53 insertions, 54 deletions
diff --git a/host/Spacebar-nginx/configuration.nix b/host/Spacebar-nginx/configuration.nix
index 15c8ffc..8148c3c 100755
--- a/host/Spacebar-nginx/configuration.nix
+++ b/host/Spacebar-nginx/configuration.nix
@@ -1,14 +1,14 @@
-{ config, pkgs, lib, secrets, spacebarchat-server-dev-nix, ... }:
+{ config, pkgs, lib, secrets, spacebarchat-server-master, ... }:
 
 {
   imports =
     [
       ../../modules/base.nix
-      (import ./containers/spacebar-server-dev-nix/import.nix { 
+      (import ./containers/spacebar-server/import.nix { 
         inherit config lib pkgs secrets;
-        spacebar-server = spacebarchat-server-dev-nix;
-        containerName = "spacebar-server-dev-nix";
-        rootDomain = "dev-nix.server.spacebar.chat";
+        spacebar-server = spacebarchat-server-master;
+        containerName = "spacebar-server-master";
+        rootDomain = "master.server.spacebar.chat";
       })
     ];
 
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
index 277a556..12dd2cc 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/container.nix
@@ -6,8 +6,8 @@
   specialArgs = {
     inherit spacebar-server;
   };  
-  config = { lib, pkgs, spacebar-server, ... }: {
-    imports = [ ./root.nix ];
+  config = { lib, pkgs, spacebar-server, rootDomain, ... }: {
+    imports = [ (import ./root.nix { inherit lib pkgs spacebar-server rootDomain; }) ];
     environment.etc."resolv.conf".text = ''
       nameserver 8.8.8.8
       nameserver 8.4.4.8
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
index 7cc8763..7be8e2d 100644
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/import.nix
@@ -11,7 +11,7 @@
 
 {
   containers."${containerName}" = import ./container.nix {
-    inherit pkgs lib spacebar-server;
+    inherit pkgs lib spacebar-server rootDomain;
   };
 
   security.acme.certs."${rootDomain}" = {
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
index 9cb8d92..675e861 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/nginx.nix
@@ -1,4 +1,4 @@
-{ config, pkgs, lib, spacebar-server, ... }:
+{ config, pkgs, lib, spacebar-server, rootDomain ... }:
 
 {
   services = {
@@ -25,18 +25,18 @@
         moreheaders
       ];
       virtualHosts = {
-        "dev-nix.server.spacebar.chat" = {
+        "${rootDomain}" = {
           locations."= /.well-known/spacebarchat/client".extraConfig = ''
             more_set_headers 'Content-Type application/json';
             more_set_headers 'Access-Control-Allow-Origin *';
             return 200 '${builtins.toJSON {
-              cdn = "cdn.dev-nix.server.spacebar.chat";
-              gateway = "gateway.dev-nix.server.spacebar.chat";
-              api = "api.dev-nix.server.spacebar.chat";
+              cdn = "cdn.${rootDomain}";
+              gateway = "gateway.${rootDomain}";
+              api = "api.${rootDomain}";
             }}';
           '';
         };
-        "api.dev-nix.server.spacebar.chat" = {
+        "api.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3001"; 
             extraConfig = ''
@@ -58,7 +58,7 @@
             '';
           };
         };
-        "cdn.dev-nix.server.spacebar.chat" = {
+        "cdn.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3003"; 
             extraConfig = ''
@@ -80,7 +80,7 @@
             '';
           };
         };
-        "gateway.dev-nix.server.spacebar.chat" = {
+        "gateway.${rootDomain}" = {
           locations."/" = {
             proxyPass = "http://127.0.0.1:3002"; 
             extraConfig = ''
@@ -105,11 +105,10 @@
       };
     };
   };
+  
   systemd.services.nginx.serviceConfig = {
     LimitNOFILE=5000000;
   };
-  security.acme.acceptTerms = true;
-  security.acme.defaults.email = "root@rory.gay";
 
   system.stateVersion = "22.11"; # DO NOT EDIT!
 }
diff --git a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
index 1debbbd..aaa1396 100755
--- a/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
+++ b/host/Spacebar-nginx/containers/spacebar-server-dev-nix/services/spacebar-server.nix
@@ -21,52 +21,52 @@
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-api
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-api
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
     "spacebar-server-gateway" = {
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" "spacebar-server-api.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-gateway
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-gateway
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
     "spacebar-server-cdn" = {
         wantedBy = [ "multi-user.target" ];
         after = [ "resolvconf.target" "postgresql.service" "rabbitmq.service" "spacebar-server-api.service" ];
         serviceConfig = {
-            ExecStart = ''
-              ${spacebar-server.packages.${pkgs.system}.default}/bin/start-cdn
-              '';
-            #Restart = "never";
-            User = "spacebar";
-            WorkingDirectory = "/var/lib/spacebar-server";
-            Environment = [
-              "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
-              "LOG_REQUESTS='-'"
-              #"DB_LOGGING='true'"
-            ];
-        };
+          ExecStart = ''
+            ${spacebar-server.packages.${pkgs.system}.default}/bin/start-cdn
+            '';
+          #Restart = "never";
+          User = "spacebar";
+          WorkingDirectory = "/var/lib/spacebar-server";
+          Environment = [
+            "DATABASE=postgres://spacebar:spacebar@127.0.0.1/spacebar"
+            "LOG_REQUESTS='-'"
+            #"DB_LOGGING='true'"
+          ];
+      };
     };
   };