From 95ff5f88c3ccfc564ebd5ecf368576be1dedb029 Mon Sep 17 00:00:00 2001 From: Jelco <53396500+Jelcoo@users.noreply.github.com> Date: Wed, 12 Jan 2022 22:53:36 +0100 Subject: [PATCH 01/10] update required versions (#3881) --- BUILDING.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index df60f70a8..d8b703338 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -5,9 +5,9 @@ Release versions of Pterodactyl will include pre-compiled, minified, and hashed However, if you are interested in running custom themes or making modifications to the React files you'll need a build system in place to generate these compiled assets. To get your environment setup you'll need at minimum: -* Node.js 12 -* [Yarn](https://classic.yarnpkg.com/lang/en/) v1 -* [Go](https://golang.org/) 1.15. +* [Node.js](https://nodejs.org/en/) v14.x.x +* [Yarn](https://classic.yarnpkg.com/lang/en/) v1.x.x +* [Go](https://golang.org/) 1.17.x ### Install Dependencies ```bash From 04656f8da84ca43e39869a4571976497889aa0cd Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Sat, 15 Jan 2022 17:10:01 +0100 Subject: [PATCH 02/10] Fix anchor in link to docker docs (#3793) The former version does not "scroll" to the section --- resources/views/admin/servers/new.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/admin/servers/new.blade.php b/resources/views/admin/servers/new.blade.php index 78333cb19..325e61e8e 100644 --- a/resources/views/admin/servers/new.blade.php +++ b/resources/views/admin/servers/new.blade.php @@ -212,7 +212,7 @@ -

Advanced: The IO performance of this server relative to other running containers on the system. Value should be between 10 and 1000. Please see this documentation for more information about it.

+

Advanced: The IO performance of this server relative to other running containers on the system. Value should be between 10 and 1000. Please see this documentation for more information about it.

From 49dd719117a319543c24a91dc032854a53eb4e98 Mon Sep 17 00:00:00 2001 From: Wuzado <23276409+Wuzado@users.noreply.github.com> Date: Sat, 15 Jan 2022 17:10:19 +0100 Subject: [PATCH 03/10] fix(docker): handle cases where DB_PORT is not defined (#3808) Co-authored-by: Alex --- .github/docker/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/docker/entrypoint.sh b/.github/docker/entrypoint.sh index b2460cde9..d3df9c150 100644 --- a/.github/docker/entrypoint.sh +++ b/.github/docker/entrypoint.sh @@ -55,6 +55,11 @@ else rm -rf /etc/nginx/http.d/default.conf fi +if [[ -z $DB_PORT ]]; then + echo -e "DB_PORT not specified, defaulting to 3306" + DB_PORT=3306 +fi + ## check for DB up before starting the panel echo "Checking database status." until nc -z -v -w30 $DB_HOST $DB_PORT From 28f7a809a5fb7382ea88bfa48af74a3554da56a1 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 15 Jan 2022 18:10:37 +0200 Subject: [PATCH 04/10] fix: exception localization (#3850) resolves #3849 --- app/Http/Controllers/Admin/UserController.php | 2 +- app/Services/Nodes/NodeDeletionService.php | 3 ++- app/Services/Users/UserDeletionService.php | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 60a2529b9..b13ee62bf 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -127,7 +127,7 @@ class UserController extends Controller public function delete(Request $request, User $user) { if ($request->user()->id === $user->id) { - throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers')); + throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); } $this->deletionService->handle($user); diff --git a/app/Services/Nodes/NodeDeletionService.php b/app/Services/Nodes/NodeDeletionService.php index 30483a826..e77104e09 100644 --- a/app/Services/Nodes/NodeDeletionService.php +++ b/app/Services/Nodes/NodeDeletionService.php @@ -1,4 +1,5 @@ . @@ -62,7 +63,7 @@ class NodeDeletionService $servers = $this->serverRepository->setColumns('id')->findCountWhere([['node_id', '=', $node]]); if ($servers > 0) { - throw new HasActiveServersException($this->translator->trans('exceptions.node.servers_attached')); + throw new HasActiveServersException($this->translator->get('exceptions.node.servers_attached')); } return $this->repository->delete($node); diff --git a/app/Services/Users/UserDeletionService.php b/app/Services/Users/UserDeletionService.php index 87459773e..fe02bc72c 100644 --- a/app/Services/Users/UserDeletionService.php +++ b/app/Services/Users/UserDeletionService.php @@ -1,4 +1,5 @@ . @@ -62,7 +63,7 @@ class UserDeletionService $servers = $this->serverRepository->setColumns('id')->findCountWhere([['owner_id', '=', $user]]); if ($servers > 0) { - throw new DisplayException($this->translator->trans('admin/user.exceptions.user_has_servers')); + throw new DisplayException($this->translator->get('admin/user.exceptions.user_has_servers')); } return $this->repository->delete($user); From 1eaf411cb4d52518f9023f29979213847a00394a Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 17 Jan 2022 19:56:57 -0700 Subject: [PATCH 05/10] node: lowercase fqdn in letsencrypt path (#3890) --- app/Models/Node.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Models/Node.php b/app/Models/Node.php index a41689c1c..bb7783466 100644 --- a/app/Models/Node.php +++ b/app/Models/Node.php @@ -2,6 +2,7 @@ namespace Pterodactyl\Models; +use Illuminate\Support\Str; use Symfony\Component\Yaml\Yaml; use Illuminate\Container\Container; use Illuminate\Notifications\Notifiable; @@ -155,8 +156,8 @@ class Node extends Model 'port' => $this->daemonListen, 'ssl' => [ 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), - 'cert' => '/etc/letsencrypt/live/' . $this->fqdn . '/fullchain.pem', - 'key' => '/etc/letsencrypt/live/' . $this->fqdn . '/privkey.pem', + 'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem', + 'key' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/privkey.pem', ], 'upload_limit' => $this->upload_size, ], From aed9f85bce50f62dfd3526623a8d6ab26c076947 Mon Sep 17 00:00:00 2001 From: Charles Morgan Date: Mon, 17 Jan 2022 22:02:10 -0500 Subject: [PATCH 06/10] Add PID Modal (#3845) --- .../eggs/minecraft/egg-bungeecord.json | 3 +- .../eggs/minecraft/egg-forge-minecraft.json | 3 +- .../Seeders/eggs/minecraft/egg-paper.json | 3 +- .../minecraft/egg-sponge--sponge-vanilla.json | 3 +- .../eggs/minecraft/egg-vanilla-minecraft.json | 3 +- .../components/server/ServerConsole.tsx | 3 +- .../server/features/PIDLimitModalFeature.tsx | 86 +++++++++++++++++++ .../components/server/features/index.ts | 3 +- 8 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 resources/scripts/components/server/features/PIDLimitModalFeature.tsx diff --git a/database/Seeders/eggs/minecraft/egg-bungeecord.json b/database/Seeders/eggs/minecraft/egg-bungeecord.json index 9a538a8e1..ac3749c8c 100644 --- a/database/Seeders/eggs/minecraft/egg-bungeecord.json +++ b/database/Seeders/eggs/minecraft/egg-bungeecord.json @@ -10,7 +10,8 @@ "description": "For a long time, Minecraft server owners have had a dream that encompasses a free, easy, and reliable way to connect multiple Minecraft servers together. BungeeCord is the answer to said dream. Whether you are a small server wishing to string multiple game-modes together, or the owner of the ShotBow Network, BungeeCord is the ideal solution for you. With the help of BungeeCord, you will be able to unlock your community's full potential.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-forge-minecraft.json b/database/Seeders/eggs/minecraft/egg-forge-minecraft.json index 7f889f1a9..a077df6d1 100644 --- a/database/Seeders/eggs/minecraft/egg-forge-minecraft.json +++ b/database/Seeders/eggs/minecraft/egg-forge-minecraft.json @@ -10,7 +10,8 @@ "description": "Minecraft Forge Server. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_17", diff --git a/database/Seeders/eggs/minecraft/egg-paper.json b/database/Seeders/eggs/minecraft/egg-paper.json index 284ee97fb..afd3715d8 100644 --- a/database/Seeders/eggs/minecraft/egg-paper.json +++ b/database/Seeders/eggs/minecraft/egg-paper.json @@ -10,7 +10,8 @@ "description": "High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json index 9c502f747..908c1f4e5 100644 --- a/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json +++ b/database/Seeders/eggs/minecraft/egg-sponge--sponge-vanilla.json @@ -10,7 +10,8 @@ "description": "SpongeVanilla is the SpongeAPI implementation for Vanilla Minecraft.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json b/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json index 9106d1a72..2361a2974 100644 --- a/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json +++ b/database/Seeders/eggs/minecraft/egg-vanilla-minecraft.json @@ -10,7 +10,8 @@ "description": "Minecraft is a game about placing blocks and going on adventures. Explore randomly generated worlds and build amazing things from the simplest of homes to the grandest of castles. Play in Creative Mode with unlimited resources or mine deep in Survival Mode, crafting weapons and armor to fend off dangerous mobs. Do all this alone or with friends.", "features": [ "eula", - "java_version" + "java_version", + "pid_limit" ], "images": [ "ghcr.io\/pterodactyl\/yolks:java_8", diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx index 73b06676e..276a64a38 100644 --- a/resources/scripts/components/server/ServerConsole.tsx +++ b/resources/scripts/components/server/ServerConsole.tsx @@ -7,7 +7,7 @@ import ServerContentBlock from '@/components/elements/ServerContentBlock'; import ServerDetailsBlock from '@/components/server/ServerDetailsBlock'; import isEqual from 'react-fast-compare'; import PowerControls from '@/components/server/PowerControls'; -import { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature } from '@feature/index'; +import { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature } from '@feature/index'; import ErrorBoundary from '@/components/elements/ErrorBoundary'; import Spinner from '@/components/elements/Spinner'; @@ -61,6 +61,7 @@ const ServerConsole = () => { {eggFeatures.includes('eula') && } {eggFeatures.includes('java_version') && } {eggFeatures.includes('gsl_token') && } + {eggFeatures.includes('pid_limit') && }
diff --git a/resources/scripts/components/server/features/PIDLimitModalFeature.tsx b/resources/scripts/components/server/features/PIDLimitModalFeature.tsx new file mode 100644 index 000000000..821a31068 --- /dev/null +++ b/resources/scripts/components/server/features/PIDLimitModalFeature.tsx @@ -0,0 +1,86 @@ +import React, { useEffect, useState } from 'react'; +import { ServerContext } from '@/state/server'; +import Modal from '@/components/elements/Modal'; +import tw from 'twin.macro'; +import Button from '@/components/elements/Button'; +import FlashMessageRender from '@/components/FlashMessageRender'; +import useFlash from '@/plugins/useFlash'; +import { SocketEvent } from '@/components/server/events'; +import { useStoreState } from 'easy-peasy'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; + +const PIDLimitModalFeature = () => { + const [ visible, setVisible ] = useState(false); + const [ loading ] = useState(false); + + const status = ServerContext.useStoreState(state => state.status.value); + const { clearFlashes } = useFlash(); + const { connected, instance } = ServerContext.useStoreState(state => state.socket); + const isAdmin = useStoreState(state => state.user.data!.rootAdmin); + + useEffect(() => { + if (!connected || !instance || status === 'running') return; + + const errors = [ + 'pthread_create failed', + 'Exception in thread "Craft Async Scheduler Management Thread"', + 'unable to create new native thread', + 'unable to create native thread', + ]; + + const listener = (line: string) => { + if (errors.some(p => line.toLowerCase().includes(p))) { + setVisible(true); + } + }; + + instance.addListener(SocketEvent.CONSOLE_OUTPUT, listener); + + return () => { + instance.removeListener(SocketEvent.CONSOLE_OUTPUT, listener); + }; + }, [ connected, instance, status ]); + + useEffect(() => { + clearFlashes('feature:pidLimit'); + }, []); + + return ( + setVisible(false)} closeOnBackground={false} showSpinnerOverlay={loading}> + + {isAdmin ? + <> +
+ +

Memory or process limit reached...

+
+

This server has reached the maximum process or memory limit.

+

Increasing container_pid_limit in the wings configuration, config.yml, might help resolve this issue.

+

Note: Wings must be restarted for the configuration file changes to take effect

+
+ +
+ + : + <> +
+ +

Possible resource limit reached...

+
+

This server is attempting to use more resources than allocated. Please contact the administrator and give them the error below.

+

pthread_create failed, Possibly out of memory or process/resource limits reached

+
+ +
+ + } +
+ ); +}; + +export default PIDLimitModalFeature; diff --git a/resources/scripts/components/server/features/index.ts b/resources/scripts/components/server/features/index.ts index c84d57183..087e329dc 100644 --- a/resources/scripts/components/server/features/index.ts +++ b/resources/scripts/components/server/features/index.ts @@ -9,5 +9,6 @@ import { lazy } from 'react'; const EulaModalFeature = lazy(() => import(/* webpackChunkName: "feature.eula" */'@feature/eula/EulaModalFeature')); const JavaVersionModalFeature = lazy(() => import(/* webpackChunkName: "feature.java_version" */'@feature/JavaVersionModalFeature')); const GSLTokenModalFeature = lazy(() => import(/* webpackChunkName: "feature.gsl_token" */'@feature/GSLTokenModalFeature')); +const PIDLimitModalFeature = lazy(() => import(/* webpackChunkName: "feature.pid_limit" */'@feature/PIDLimitModalFeature')); -export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature }; +export { EulaModalFeature, JavaVersionModalFeature, GSLTokenModalFeature, PIDLimitModalFeature }; From e7884e4f0bc8311c9406ad5fc4a024e3b309afa9 Mon Sep 17 00:00:00 2001 From: Paperboypaddy16 <35149493+Paperboypaddy@users.noreply.github.com> Date: Mon, 17 Jan 2022 19:05:04 -0800 Subject: [PATCH 07/10] Fixed link for docker-compose.yml under Setup (#3829) --- .github/docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/docker/README.md b/.github/docker/README.md index d8e9f9c14..b195b8300 100644 --- a/.github/docker/README.md +++ b/.github/docker/README.md @@ -12,7 +12,7 @@ You can provide additional settings using a custom `.env` file or by setting the ## Setup -Start the docker container and the required dependencies (either provide existing ones or start containers as well, see the [docker-compose.yml](docker-compose.yml) file as an example). +Start the docker container and the required dependencies (either provide existing ones or start containers as well, see the [docker-compose.yml](https://github.com/pterodactyl/panel/blob/develop/docker-compose.example.yml) file as an example. After the startup is complete you'll need to create a user. If you are running the docker container without docker-compose, use: From 7d0d71baec8ccaeba5e9d63de203564d39d731b4 Mon Sep 17 00:00:00 2001 From: Boy132 Date: Tue, 18 Jan 2022 04:08:53 +0100 Subject: [PATCH 08/10] Checkbox & Dropdown for Startup Variables (#3769) --- .../scripts/components/elements/Switch.tsx | 4 +- .../components/server/startup/VariableBox.tsx | 60 +++++++++++++++---- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/resources/scripts/components/elements/Switch.tsx b/resources/scripts/components/elements/Switch.tsx index 5c4b1e9b3..6420bccfa 100644 --- a/resources/scripts/components/elements/Switch.tsx +++ b/resources/scripts/components/elements/Switch.tsx @@ -41,11 +41,12 @@ export interface SwitchProps { label?: string; description?: string; defaultChecked?: boolean; + readOnly?: boolean; onChange?: (e: React.ChangeEvent) => void; children?: React.ReactNode; } -const Switch = ({ name, label, description, defaultChecked, onChange, children }: SwitchProps) => { +const Switch = ({ name, label, description, defaultChecked, readOnly, onChange, children }: SwitchProps) => { const uuid = useMemo(() => v4(), []); return ( @@ -58,6 +59,7 @@ const Switch = ({ name, label, description, defaultChecked, onChange, children } type={'checkbox'} onChange={e => onChange && onChange(e)} defaultChecked={defaultChecked} + disabled={readOnly} /> }