In order for your players to be able to install plugins via plugin management GUI, we need to mount the plugins repository folder to each of your virtualised containers (servers).
Unfortunately, Pterodactyl doesn't provide an API for that at the moment (until v2 is out), so we will need to perform a quick modification on your Pterodactyl's code.
You will need to perform these modifications every time you update Pterodactyl.
Instructions
Navigate to your Pterodactyl folder, preferably via some kind of SFTP file manager, like WinSCP or CyberDuck. The directory is usually /var/www/pterodactyl.
Open up app/Http/Controllers/Api/Application/Servers/ServerManagementController.php preferably using some sort of text editor, like VSCode or Notepad++.
If you're a more advanced user, just making sure to merge this differences will be enough. For everyone else, please carefully follow the instructions below.
Below all imports, paste use Pterodactyl\Models\MountServer; Your imports should look like the following:
ServerManagementController.php
<?php
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
use Illuminate\Http\Response;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService;
use Pterodactyl\Services\Servers\ReinstallServerService;
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
use Pterodactyl\Models\MountServer; # This is the line we added
Below reinstall function, paste the following code block:
ServerManagementController.php
public function mount(ServerWriteRequest $request, Server $server): Response
{
$mountServer = (new MountServer())->forceFill([
'mount_id' => $request->input('mount_id'),
'server_id' => $server->id,
]);
$mountServer->saveOrFail();
return $this->returnNoContent();
}
The end result will be the following file (which you may as well just copy and replace your whole file contents with, but a more manual approach like in steps 1 and 2 is recommended):
ServerManagementController.php
<?php
namespace Pterodactyl\Http\Controllers\Api\Application\Servers;
use Illuminate\Http\Response;
use Pterodactyl\Models\Server;
use Pterodactyl\Services\Servers\SuspensionService;
use Pterodactyl\Services\Servers\ReinstallServerService;
use Pterodactyl\Http\Requests\Api\Application\Servers\ServerWriteRequest;
use Pterodactyl\Http\Controllers\Api\Application\ApplicationApiController;
use Pterodactyl\Models\MountServer; # This is the line we added
class ServerManagementController extends ApplicationApiController
{
/**
* ServerManagementController constructor.
*/
public function __construct(
private ReinstallServerService $reinstallServerService,
private SuspensionService $suspensionService
) {
parent::__construct();
}
/**
* Suspend a server on the Panel.
*
* @throws \Throwable
*/
public function suspend(ServerWriteRequest $request, Server $server): Response
{
$this->suspensionService->toggle($server);
return $this->returnNoContent();
}
/**
* Unsuspend a server on the Panel.
*
* @throws \Throwable
*/
public function unsuspend(ServerWriteRequest $request, Server $server): Response
{
$this->suspensionService->toggle($server, SuspensionService::ACTION_UNSUSPEND);
return $this->returnNoContent();
}
/**
* Mark a server as needing to be reinstalled.
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function reinstall(ServerWriteRequest $request, Server $server): Response
{
$this->reinstallServerService->handle($server);
return $this->returnNoContent();
}
# Our mount function
public function mount(ServerWriteRequest $request, Server $server): Response
{
$mountServer = (new MountServer())->forceFill([
'mount_id' => $request->input('mount_id'),
'server_id' => $server->id,
]);
$mountServer->saveOrFail();
return $this->returnNoContent();
}
}
Now navigate to app/routes/api-application.php and open it.
The end result should look like the following. You can also just use it to completely copy-paste the content to your api-application.php, but a more manual approach like in step 1 is preferred as Pterodactyl may do additional modifications to this file in the future.
After that's done, we can now create our mount. Go to the mounts tab on your Pterodactyl admin panel and click the Create New and fill the fields as in the following example. Make sure to name Target folder as /plugins-repo. Source folder should be set to the path of your plugins folder.