Ctrlpanel-gg / panel

CtrlPanel offers an easy-to-use and free billing solution for all starting and experienced hosting providers that seamlessly integrates with the Pterodactyl panel.
https://ctrlpanel.gg/
MIT License
411 stars 149 forks source link

[Feature] auto allocation of more than one port for e.g. source games #841

Open AleXburnA opened 1 year ago

AleXburnA commented 1 year ago

Feature Description

Certain pterodactyl eggs needs more than one port to function properly (e.g. ARK needs four: main, main+1, rcon and query port).

While its possible to add more than one port allocation to a product, the user still needs to do several steps by hand, after the server is deployed:

as this breaks the automated deployment of such eggs, it would be nice to have a solution for that.

Solution Idea

it would be great if there would be a way to customize egg parameters at the product setup. There should be a way to auto-allocate additional ports and map it to specified variables of the eggs.

A feasible way could be: 1.) POST to https://{{HOST}}/api/client/servers/{{SERVER_ID}}/network/allocations to assign the allocations to the server. 2.) PATCH to https://{{HOST}}/api/application/servers/{{SERVER_APPID}}/startup to update the servers variables with the learned port numbers.

There are also games which also need Gameport + 1 to function, for example Valheim or ARK. So it would be nice to handle those cases as well. <-- I've learned that those ports are optional and not really required, and there are also limitations on the pterodactyl side, so this part is not that important.

Additional Info

We had a discussion in Discord about this feature: https://discord.com/channels/787829714483019826/1108138041790431435

AGuyNamedJens commented 1 year ago

I don't think we can easily implement this considering the fact https://github.com/pterodactyl/panel/issues/1653 it's actually not even implemented in pterodactyl themselves?

However, there's always a way to firstly create the product then later on update it via code..

AleXburnA commented 1 year ago

Yeah I recently saw this feature request. I've also just learned that gameport+1 is optional, so this wouldn't be a big showstopper.

But the other feature (update specified servers variables, e.g. RCON and Query Port, with the actual allocations) is pretty important IMO as it currently prevents ctrlpanel from being usable for games with more than one port.

This can be done with the API, I just tried it myself with postman:

1.) POST to https://{{HOST}}/api/client/servers/{{SERVER_ID}}/network/allocations to assign the allocations to the server. 2.) PATCH to https://{{HOST}}/api/application/servers/{{SERVER_APPID}}/startup to update the servers variables with the learned port numbers.

Maybe this has to be done after the server has finished installing. I am not too sure how hard it is to implement a "watcher" in ctrlpanel which waits until the server has finished installing before it does the reconfiguration.

I've updated the feature request to reflect the current state of knowledge. :)