diff --git a/applications/pelican/Notes.md b/applications/pelican/Notes.md new file mode 100644 index 0000000..8516be7 --- /dev/null +++ b/applications/pelican/Notes.md @@ -0,0 +1,16 @@ +# Notes on Pelican + +## Panel + +* ``pelican-install`` is in env that can be used to isntall +* then go to ``panel-address.skynet.ie/installer`` to finish the setup + +## Wing + +In the config the ssl must be set as so: +```yaml + ssl: + enabled: true + cert: /var/lib/acme/skynet/fullchain.pem + key: /var/lib/acme/skynet/key.pem +``` \ No newline at end of file diff --git a/applications/pelican/pelican.nix b/applications/pelican/pelican.nix index 395f155..e0ecce1 100644 --- a/applications/pelican/pelican.nix +++ b/applications/pelican/pelican.nix @@ -44,6 +44,10 @@ in { wing = { enable = mkEnableOption "Pelican Wing"; + + node_name = mkOption { + type = types.str; + }; }; }; @@ -211,6 +215,26 @@ in { }) (mkIf cfg.wing.enable { + services.skynet.acme.domains = [ + "${cfg.wing.node_name}.${domain_panel}" + ]; + + # using https://nixos.org/manual/nixos/stable/index.html#module-services-gitlab as a guide + services.skynet.dns.records = [ + { + record = "${cfg.wing.node_name}.${cfg.panel.domain.sub}"; + r_type = "CNAME"; + value = config.services.skynet.host.name; + } + ]; + services.nginx.virtualHosts = { + "${cfg.wing.node_name}.${domain_panel}" = { + forceSSL = true; + useACMEHost = "skynet"; + locations."/".proxyPass = "http://127.0.0.1:8080"; + }; + }; + networking.firewall.allowedTCPPorts = [8080 8443]; virtualisation.docker.enable = true; @@ -219,6 +243,17 @@ in { (pkgs.callPackage ./pelican-wing-package.nix {}) ]; + users.groups.pelican = {}; + users.users.pelican = { + #createHome = true; + isSystemUser = true; + #home = "/etc/pelican"; + group = "pelican"; + extraGroups = ["docker" "acme"]; + # X11 is to ensure the directory can be traversed + #homeMode = "711"; + }; + systemd.services.pelican-wings = { description = "Wings Daemon"; after = ["docker.service"]; diff --git a/flake.nix b/flake.nix index bf876fe..6699f9e 100644 --- a/flake.nix +++ b/flake.nix @@ -149,9 +149,8 @@ # metrics ariia = import ./machines/ariia.nix; - - # games server - panel/host - optimus = import ./machines/optimus.nix; + # games server - panel/host + optimus = import ./machines/optimus.nix; }; }; } diff --git a/machines/optimus.nix b/machines/optimus.nix index e766795..dbc085a 100644 --- a/machines/optimus.nix +++ b/machines/optimus.nix @@ -40,6 +40,12 @@ in { services.skynet = { host = host; #backup.enable = true; - pelican.panel.enable = true; + pelican = { + panel.enable = true; + wing = { + enable = true; + node_name = "node01"; + }; + }; }; }