diff options
author | Ben Sima <ben@bsima.me> | 2020-04-05 15:53:37 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-05 15:53:37 -0700 |
commit | e5dbfd32b52e35aecf961b8b80a5f70e76c3cb83 (patch) | |
tree | d450a29f3679e815a0c47b7f37d5969f2f80247b | |
parent | f0e5894c625a726b5364365298f144e862b23676 (diff) |
Deploy que.run without nginx
I still have to reimplement the SSL stuff but in the Haskell code. That
seems kinda hard or at least requires research that I don't wanna do
right now.
-rw-r--r-- | Com/Simatime/Prod/configuration.nix | 11 | ||||
-rwxr-xr-x | Com/Simatime/Prod/hardware.nix | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | Run/Que/Prod.nix (renamed from Com/Simatime/Prod/networking.nix) | 14 | ||||
-rw-r--r-- | Run/Que/Server.nix (renamed from Run/Que/service.nix) | 28 | ||||
-rw-r--r-- | default.nix | 15 |
5 files changed, 17 insertions, 57 deletions
diff --git a/Com/Simatime/Prod/configuration.nix b/Com/Simatime/Prod/configuration.nix deleted file mode 100644 index 0a1d4fc..0000000 --- a/Com/Simatime/Prod/configuration.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ config, pkgs, ... }: -{ - networking.firewall.allowedTCPPorts = [ 22 80 443 ]; - services.que-server = { - enable = true; - domain = "que.run"; - port = 3000; - package = pkgs.que-server; - }; - services.nginx.enable = true; -} diff --git a/Com/Simatime/Prod/hardware.nix b/Com/Simatime/Prod/hardware.nix deleted file mode 100755 index 8c88cb7..0000000 --- a/Com/Simatime/Prod/hardware.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ ... }: -{ - imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ]; - boot.loader.grub.device = "/dev/vda"; - fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; -} diff --git a/Com/Simatime/Prod/networking.nix b/Run/Que/Prod.nix index 6180dde..63e4be3 100755..100644 --- a/Com/Simatime/Prod/networking.nix +++ b/Run/Que/Prod.nix @@ -1,6 +1,14 @@ -{ lib, ... }: { - # This file was populated at runtime with the networking - # details gathered from the active system. +{ config, pkgs, lib, ... }: +{ + imports = [ <nixpkgs/nixos/modules/profiles/qemu-guest.nix> ]; + boot.loader.grub.device = "/dev/vda"; + fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; + networking.firewall.allowedTCPPorts = [ 22 80 443 ]; + services.que-server = { + enable = true; + port = 80; + package = pkgs.que-server; + }; networking = { nameservers = [ "67.207.67.2" diff --git a/Run/Que/service.nix b/Run/Que/Server.nix index aa68657..272ea6e 100644 --- a/Run/Que/service.nix +++ b/Run/Que/Server.nix @@ -11,14 +11,6 @@ in { options.services.que-server = { enable = lib.mkEnableOption "Enable the que-server service"; - domain = lib.mkOption { - type = lib.types.str; - default = "que.run"; - description = '' - Domain on which to host que-server. This is passed to - services.nginx.virtualHosts.<name> directly. - ''; - }; port = lib.mkOption { type = lib.types.int; default = 3000; @@ -49,25 +41,5 @@ in RestartSec = "1"; }; }; - services.nginx = { - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts = { - "${cfg.domain}" = { - forceSSL = true; - enableACME = true; - locations."/" = { - proxyPass = "http://localhost:${toString cfg.port}"; - extraConfig = '' - proxy_set_header X-Real-IP $realip_remote_addr; - proxy_set_header X-Forwarded-Host $remote_addr; - proxy_pass_request_headers on; - ''; - }; - }; - }; - }; }; } diff --git a/default.nix b/default.nix index ad1f750..ea20799 100644 --- a/default.nix +++ b/default.nix @@ -52,9 +52,9 @@ in rec { networking.domain = "dev.simatime.com"; }; }; - # The production server for apps + # The production server for que.run # - Com.Simatime.Prod = buildOS { + Run.Que.Prod = buildOS { deps = { que-server = Run.Que.Server; }; @@ -62,14 +62,11 @@ in rec { imports = [ ./Com/Simatime/packages.nix ./Com/Simatime/users.nix - ./Com/Simatime/Prod/hardware.nix - ./Com/Simatime/Prod/networking.nix - ./Com/Simatime/Prod/configuration.nix - ./Run/Que/service.nix + ./Run/Que/Server.nix + ./Run/Que/Prod.nix ]; - networking.hostName = "prod"; - networking.domain = "prod.simatime.com"; - boot.enableContainers = true; + networking.hostName = "prod.que.run"; + networking.domain = "que.run"; }; }; # Haskell targets |