ccarney16 / pterodactyl-containers

Pterodactyl Panel within a docker container
230 stars 78 forks source link

Error 500 when accessing the web interface #127

Closed argetlam-coder closed 2 years ago

argetlam-coder commented 2 years ago

When I call the web interface in the browser, I get error 500.

In the laravel log I see the following error:

[2021-12-19 21:03:10] production.ERROR: php_network_getaddresses: getaddrinfo failed: Try again [tcp://cache:6379] {"exception":"[object] (Predis\\Connection\\ConnectionException(code: 0): php_network_getaddresses: getaddrinfo failed: Try again [tcp://cache:6379] at /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php:155)
[stacktrace]
#0 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(128): Predis\\Connection\\AbstractConnection->onConnectionError()
#1 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(178): Predis\\Connection\\StreamConnection->createStreamSocket()
#2 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(100): Predis\\Connection\\StreamConnection->tcpStreamInitializer()
#3 /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php(81): Predis\\Connection\\StreamConnection->createResource()
#4 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(258): Predis\\Connection\\AbstractConnection->connect()
#5 /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php(180): Predis\\Connection\\StreamConnection->connect()
#6 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(288): Predis\\Connection\\AbstractConnection->getResource()
#7 /var/www/html/vendor/predis/predis/src/Connection/StreamConnection.php(394): Predis\\Connection\\StreamConnection->write()
#8 /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php(110): Predis\\Connection\\StreamConnection->writeRequest()
#9 /var/www/html/vendor/predis/predis/src/Client.php(331): Predis\\Connection\\AbstractConnection->executeCommand()
#10 /var/www/html/vendor/predis/predis/src/Client.php(314): Predis\\Client->executeCommand()
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(116): Predis\\Client->__call()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(220): Illuminate\\Redis\\Connections\\Connection->command()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(62): Illuminate\\Redis\\Connections\\Connection->__call()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(97): Illuminate\\Cache\\RedisStore->get()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(376): Illuminate\\Cache\\Repository->get()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(418): Illuminate\\Cache\\Repository->remember()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Illuminate\\Cache\\CacheManager->__call()
#18 /var/www/html/app/Providers/AppServiceProvider.php(80): Illuminate\\Support\\Facades\\Facade::__callStatic()
#19 /var/www/html/app/Providers/AppServiceProvider.php(31): Pterodactyl\\Providers\\AppServiceProvider->versionData()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Pterodactyl\\Providers\\AppServiceProvider->boot()
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\\Container\\BoundMethod::call()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(914): Illuminate\\Container\\Container->call()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(895): Illuminate\\Foundation\\Application->bootProvider()
#27 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(896): array_walk()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(237): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(152): Illuminate\\Foundation\\Application->bootstrapWith()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(136): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter()
#34 /var/www/html/public/index.php(68): Illuminate\\Foundation\\Http\\Kernel->handle()
#35 {main}
"} 

I took a closer look at this error and it looks like in one of the PHP libraries the DNS name resolution is not working properly. This problem concerns the connection to the database and to redis.

I have run ping cache from inside the panel container and it has worked. It seems that only php or one of the libraries is not able to resolve the name.

As a workaround I created an additional network in the docker-compose file, added all services to this network and then gave the cache and the mysql service a fixed ip. Then I configured the corresponding ip addresses for the services in the panel.env. Now I can access the web interface.

ccarney16 commented 2 years ago

I havent ran into an issue like that. Ill see about creating a new environment with a fresh install. Can I get the base OS and docker version your using?

argetlam-coder commented 2 years ago

My docker and docker-compose versions are: Docker version 20.10.12, build e91ed57 docker-compose version 1.29.2, build 5becea4c

My base OS is Kali Linux Version 2021.4. It's based on Debian and uses the following kernel: 5.14.0-kali4-amd64. This is a virtual machine, which I use to test all sorts of things. I have not yet tested it on my productive system.

argetlam-coder commented 2 years ago

I have now also tested it in my production system (Debian). There are problems with the name resolution here as well. I have created the following php script for testing:

<?php
$ip = gethostbyname("node.example.com");
echo $ip;
?> 

The command gethostbyname is used by Pterodactyl, when creating a new node. This fails for me at the moment, because it cannot resolve the FQDN.

If I execute this script in the console inside the container, it works without problems. If the webserver executes this command when creating a node, then it fails.

ccarney16 commented 2 years ago

Hm, I haven't encountered this issue yet when deploying this, and I've recently setup a fresh installation on an EL based host. Have you made any changes to the image or docker compose file? It should just work with the stock configuration of the repo.

argetlam-coder commented 2 years ago

Yes I have made changes to the image and to the docker compose file. I must have an error in my changes then . I just thought it was a general problem. In the meantime I got pterodactyl running with the official images on my server. Thanks a lot for your help.