QUICK PTERODACTYL TUTORIAL for Cosmos Server
You can also check out this Video Guide, if you prefer video guides instead of written tutorials:
https://youtu.be/hvuTzvX5XKw
It might differ slightly in its approach, but it's roughly the same.
Tutorial Time!
Part 01: Installing the Panel and Wings
- For this tutorial, you should use this Compose Example:
https://paste.ec/paste/UnFQOCNQ#vBOh7QB4l1NpYetOslTD+eoTHq-4Em8Y8oq09YXcWsv
This includes all the necessary parts for Pterodactyl to work.
You should obviously change the passwords, to something that suits you. They should be clearly marked with "change me!"
- For it to work properly, in my experience, you should NOT use the Import Compose File function in Cosmos.
Rather, you should use it as a regular Docker Compose file, and then let Cosmos handle it from there. - Save the docker compose example, from Step 1, to somewhere on your server.
In my case, I named itdocker-compose.pt.yml
and placed it in my/opt/docker-all
folder that I created. - Launch it with this command:
docker compose -f /opt/docker-all/docker-compose.pt.yml up -d
GIF: https://i.imgur.com/WTQw2ki.gif
Part 02: Managing the containers in Cosmos
- Now, go into your Cosmos Server, and all the newly created containers should show up.
5.1) You can select "Stop" on the pt-wings
, since it'll just keep restarting, since it needs a config.yml
file. We'll create that later.
https://i.imgur.com/1EYaruN.png
- In your Cosmos, you should now have:
- pt-panel (this is the WEB UI)
- pt-wings (this is the backend of Pterodactyl, that creates game servers)
- pt-database (a mariadb needed for the Panel)
- pt-redis (a redis cache server needed for the Panel)
- You should select "Isolate Container Network" the following containers:
- pt-panel
- pt-database
- pt-redis
- For safety, you should restart the
pt-panel
, after the Isolate Container Network has been marked on all the mentioned containers in Step 4.
GIF: https://i.imgur.com/6VmxRS9.gif
Part 03: Disabling the default Docker networks
- Since we created the Pterodactyl Panel, Wings and dependencies out of Cosmos, they've all been created with the default Docker network, named
docker-all_default
.
This should be disabled.
9.1) Head into the "Details" menu of all pt-*
containers.
Go to the sub-menu "Network" and remove each container from the docker-all_default
network.
GIF: https://i.imgur.com/6tzZnCp.gif
9.2) For the pt-wings
specifically, you should head into the "Details" of that container, and do some slight fiddling:
9.2.1) Go to the sub-menu "Docker", and find the cosmos-force-network-mode
under Labels and Delete the label
9.2.2) Select "Update Container" at the Bottom
9.2.3) Afterwards, go to the "Network", make sure it's not connected to the docker-all_default
network and change the Network Mode
to bridge
instead of docker-all_default
9.2.4) Now that we're in here, you should also add the ports 2022
for both Host and Container port, since we need that for SFTP servers that pt-wings
creates for each Game Server.
GIF: https://i.imgur.com/asWUvqO.gif
Part 04: Connecting the containers
- We also need the
pt-redis
andpt-database
connected to thept-panel
network. In my case, they need to be connect to the network namedcosmos-network-JS8nF0g2q
:
10.1) Remember to restart yourpt-panel
afterwards, so it can properly connect to both thept-database
andpt-redis
GIF: https://i.imgur.com/FZivjSB.gif
Part 05: Creating Reverse Proxied URLs
- Now, create a reverse proxied URL for the Panel. It should be named the same, as the variable you set in the Docker Compose example, we imported in Step 2. The one named
APP_URL
. In my case, it'll behttps://pterodactyl.domain.eu
(obviously replace thedomain.eu
part with your domain..). - If you don't know how, find the
pt-panel
container in the ServApps menu in your Cosmos Server. - Select the "New (+)" button, under "URLs"
- Create a URL for your Panel, e.g.:
https://i.imgur.com/MZDLDlz.png - You should be able to access your Panel through your newly created Pterodactyl Panel domain:
https://i.imgur.com/XQooRb6.png
15.1) You should also create a reverse proxied URL for the pt-wings
. You should name it pterodactyl.domain.eu
(obviously replace the domain.eu
part with your domain..)
15.2) Do the exact same steps as the one above (Step 13-14), but remember to set your pt-wings
URL to use 443 as the Container port, when setting up its URL:
https://i.imgur.com/fxamPYp.png
Part 06: Creating a new user for the Pterodactyl Panel
- We should create an admin user for Pterodactyl. Head to your favorite SSH Terminal, and enter the following command:
<docker exec -it pt-panel php artisan p:user:make>
16.1) Follow the instructions for creating a user:
GIF: https://i.imgur.com/gjdtTjh.gif
- Now you can login with your new user! Yay.
https://i.imgur.com/iAiW3MQ.png
Part 07: Initial Panel setup
- Now that you're in the Pterodactyl Panel, you need to set up a few things. Head to the Settings tab.
18.1) Head to "Locations" and select "Create New"
18.2) Create a Location, you can choose whatever name you want.
- You should head into "Nodes" and select "Create New".
GIF: https://i.imgur.com/5m2At9d.gif
This is how my setup looks:
https://i.imgur.com/OGQYN9C.png
19.1) Make sure the Behind Proxy is enabled, and that you change the daemon port from 8080 to 443.
19.2) For the FQDN you should use the reverse proxied URL for PT Wings, in my case "pterodactylnode.domain.com" (without https://)
- Select "Create", and you'll get forwarded to the Allocation page. For your IP, you should use your server's Public IPv4.
For the ports, just select a range that you know you don't use. E.g.:
https://i.imgur.com/M6OUlzx.png
Part 08: The infamous config.yml setup
- Afterwards, there'll be no connection, since PT Wings is waiting for you to create a "config.yml" file in "/etc/pterodactyl" (as root).
21.1) Head into the Nodes "Configuration" menu, and copy that entire thing. That's your "config.yml".
21.2) Here's how my initial config.yml setup looks:
https://i.imgur.com/mMTsgvq.png
- We should also add a little section to our
config.yml
, since we need Pterodactyl Wings (pt-wings
) to create a separate network for us, that the Game servers will use.
This part should be added underneath theremote:
part in the config.yml:
It creates a set of internal Docker ip's that usually not used by anything else. The default ones the Wings tries to create are usually taken up by something else.
- My final config.yml that I put inside
/etc/pterodactyl
(as root):
https://i.imgur.com/fJCS19X.png - Now I can restart the Wings container (
pt-wings
), and it should post succesful logs:
https://i.imgur.com/IbEdPk4.png
24.1) Now, to check if the reverse proxied url, https://pterodactylnode.domain.eu
actually loads.
It should give a message, saying: error: "The required authorization heads were not present in the request."
- This means that it works :).
Part 09: Setting up CORS for the Wings
Now it's just a question of getting CORS working, so that the Panel can connect to/with the reverse proxied URL, that I used in the Node setup.
- Head to your Cosmos Server, and find the PT Wings. Go into the URL settings, and find "Security".
26.1) Unfortunately, PT Wings doesn't currently, as of this date, work very well with Smart Shield. So you'll need to Disable it. You can also try using the Lenient setting, but that might also "break" the connection.
26.2) Go to the bottom of "Security" where it says "Custom CORS Origin" and just put a "*" (without the quotes) and press Save:
https://i.imgur.com/bLt5Bb0.png
GIF: https://i.imgur.com/H1Szjm0.gif
- Head back to your PT Panel, and when you go to "Nodes", it should now light up Green. You got your reverse proxy working! Yay!
https://i.imgur.com/Eu7Die1.png
Part 10: Connect the Wings to the newly created network
- In Cosmos, remember to attach the
pt-wings
to the "pterodactyl_nw" that we created above:
GIF: https://i.imgur.com/euQTzfK.gif - It should look like this:
https://i.imgur.com/9Zo2kbY.png - Now, you can go and create Game Servers :)
And that should be it!
More Information...
If you need more help on using Pterodactyl, you should probably visit their official website / docs:
https://pterodactyl.io/
If you need some "eggs" (game server templates for Pterodactyl), you can use this GitHub repository:
https://github.com/parkervcp/eggs