-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add installation guide for NixOS #711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
PadowYT2
wants to merge
1
commit into
pterodactyl:v2
Choose a base branch
from
PadowYT2:add-nixos
base: v2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+170
−2
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| "pages": [ | ||
| "debian", | ||
| "centos7", | ||
| "centos8" | ||
| "centos8", | ||
| "nixos" | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| --- | ||
| title: NixOS | ||
| --- | ||
|
|
||
|
|
||
|
|
||
| This guide provides instructions for installing Pterodactyl Panel on NixOS. | ||
|
|
||
| ## Generating secrets | ||
|
|
||
| Before configuring the service, we need to generate a new application encryption key. | ||
|
|
||
| ```bash | ||
| echo "base64:$(openssl rand -base64 32)" | ||
| ``` | ||
|
|
||
| <Callout type="error"> | ||
| 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. | ||
| </Callout> | ||
|
|
||
| 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 | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| "title": "Wings Installation", | ||
| "pages": [ | ||
| "centos7", | ||
| "centos8" | ||
| "centos8", | ||
| "nixos" | ||
| ] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| title: 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; } | ||
| ]; | ||
| }; | ||
| } | ||
| ``` |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps instead of copying the text from the main Pterodactyl Installation page, suggest having the configuration with secrets be available on GitHub as it is the recommended setup for NixOS configs...?