diff --git a/.vuepress/config.js b/.vuepress/config.js index 319b226b7..26c3a4f78 100644 --- a/.vuepress/config.js +++ b/.vuepress/config.js @@ -75,6 +75,7 @@ module.exports = { '/community/installation-guides/panel/centos7.md', '/community/installation-guides/panel/centos8.md', '/community/installation-guides/panel/debian.md', + '/community/installation-guides/panel/nixos.md', ] }, { @@ -83,6 +84,7 @@ module.exports = { children: [ '/community/installation-guides/wings/centos7.md', '/community/installation-guides/wings/centos8.md', + '/community/installation-guides/wings/nixos.md', ] }, { diff --git a/community/installation-guides/panel/nixos.md b/community/installation-guides/panel/nixos.md new file mode 100644 index 000000000..ec77c51c4 --- /dev/null +++ b/community/installation-guides/panel/nixos.md @@ -0,0 +1,106 @@ +# NixOS + +This guide provides instructions for installing Pterodactyl Panel on NixOS. + +[[toc]] + +## Generating secrets + +Before configuring the service, we need to generate a new application encryption key. + +```bash +echo "base64:$(openssl rand -base64 32)" +``` + +::: danger +Back up the encryption key. It is used as an encryption key for all data that needs to be stored securely (e.g. API keys). +Store it somewhere safe - not just on your server. If you lose it, all encrypted data is irrecoverable, even with database backups. + +Copy the key generated and save it somewhere secure: +- A password manager +- An encrypted file on your local machine +- A secure USB drive +- A trusted cloud vault + +Do not keep it only on the server. If you lose this key, your encrypted data is permanently unrecoverable. +::: + +You would also need to generate a salt key, which is used for providing additional security to encrypted data as a way to make it fully random each time. It can be anything from a randomly generated string to an UUID. + +```bash +openssl rand -hex 16 +``` + +## Configuration + +Now we can enable the service, add the following code to your `configuration.nix`: + +```nix +{ + services.pterodactyl.panel = { + enable = true; + app = { + url = "https://panel.example.com"; + # Using agenix, sops-nix or something else + keyFile = "/path/to/app_key"; + # Direct (not recommended) + # key = ""; + }; + + hashids = { + saltFile = "/path/to/hashids_salt"; + # salt = ""; + }; + }; +} +``` + +If you want the panel to be accessible to the public, make sure to open Nginx's port by adding this in your `configuration.nix`: + +```nix +{ + networking.firewall.allowedTCPPorts = [80 443]; +} +``` + +### Using Caddy with FrankenPHP + +Using Caddy with FrankenPHP is much performant and better than Nginx and PHP-FPM. Here is an example configuration to put in your `configuration.nix`: + +```nix +{ + services.caddy = { + enable = true; + package = pkgs.frankenphp.override { + php = config.services.pterodactyl.panel.phpPackage; + }; + + virtualHosts = { + "panel.example.com".extraConfig = '' + root * ${config.services.pterodactyl.panel.package}/public + php_server + ''; + }; + }; + + services.pterodactyl.panel = { + enable = true; + enableNginx = false; + user = "caddy"; + group = "caddy"; + database.user = "caddy"; + app.url = "https://panel.example.com"; + }; + + users.users.caddy.extraGroups = ["redis"]; +} +``` + +## Add The First User + +You'll then need to create an administrative user so that you can log into the panel. To do so, run the command below. +At this time passwords **must** meet the following requirements: 8 characters, mixed case, at least one number. + +``` bash +pterodactyl-cli p:user:make +``` diff --git a/community/installation-guides/wings/nixos.md b/community/installation-guides/wings/nixos.md new file mode 100644 index 000000000..b47283adb --- /dev/null +++ b/community/installation-guides/wings/nixos.md @@ -0,0 +1,54 @@ +# NixOS + +This guide provides instructions for installing Pterodactyl Wings on NixOS. + +## Configuration + +Make sure to firstly create the node on the panel in order to configure wings. To enable the service, add the following code to your `configuration.nix`: + +```nix +{ + services.pterodactyl.wings = { + enable = true; + uuid = "your-node-uuid"; + remote = "https://panel.example.com"; + # Using agenix, sops-nix or something else + tokenIdFile = "/path/to/token_id"; + # Direct (not recommended) + # tokenId = ""; + tokenFile = "/path/to/token"; + # tokenFile = ""; + }; +} +``` + +If you want wings to be accessible to the public, make sure to open the API and SFTP ports by adding this in your `configuration.nix`: + +```nix +{ + services.pterodactyl.wings = { + openFirewall = true; + }; +} +``` + +### Opening container ports + +Unfortunately this cannot be done automatically. If you have made a lot of ports as a range, +you can open them with `networking.firewall.allowedTCPPortRanges` and `networking.firewall.allowedUDPPortRanges` in your `configuration.nix`: + +```nix +{ + networking.firewall = { + enable = true; + allowedTCPPortRanges = [ + { from = 25565; to = 25600; } + { from = 3000; to = 3100; } + ]; + allowedUDPPortRanges = [ + { from = 25565; to = 25600; } + { from = 3000; to = 3100; } + ]; + }; +} +```