ccarney16 / pterodactyl-containers

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

Issue with initial user creation & mariaDB #143

Open NaokiNXN opened 2 years ago

NaokiNXN commented 2 years ago

Hi,

I am setting this up again trying to proxy through traefik this time on a fresh install but having issues with mariaDB and making a user.

The panel is up and I can reach it but when running ./bin/artisan p:user:make I get the following error: -e Warning! This command is intended for interactive sessions only. Please use docker-compose directly for use in scripts. ./bin/artisan: 13: [[: not found Docker Compose service "panel" does not exist! Exiting...

Secondly it looks like none of the containers can reach mariadb, this shows in the logs for mariadb: 2022-09-02 10:54:12 0 [Note] mariadbd: ready for connections. Version: '10.8.4-MariaDB-1:10.8.4+maria~ubu2204' socket: '/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution 2022-09-02 10:54:12 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.2' (This connection closed normally without authentication) 2022-09-02 10:54:12 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.6' (This connection closed normally without authentication) 2022-09-02 10:54:12 5 [Warning] Aborted connection 5 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.7' (This connection closed normally without authentication) 2022-09-02 10:54:13 6 [Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.6' (This connection closed normally without authentication) 2022-09-02 10:56:54 10 [Warning] Aborted connection 10 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.7' (This connection closed normally without authentication) 2022-09-02 10:58:32 14 [Warning] Aborted connection 14 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.2' (This connection closed normally without authentication) 2022-09-02 10:58:33 15 [Warning] Aborted connection 15 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.6' (This connection closed normally without authentication) 2022-09-02 10:58:33 16 [Warning] Aborted connection 16 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.7' (This connection closed normally without authentication) 2022-09-02 11:11:40 32 [Warning] Aborted connection 32 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.2' (This connection closed normally without authentication) 2022-09-02 11:11:40 33 [Warning] Aborted connection 33 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.7' (This connection closed normally without authentication) 2022-09-02 11:11:41 35 [Warning] Aborted connection 35 to db: 'unconnected' user: 'unauthenticated' host: '172.18.0.6' (This connection closed normally without authentication)

Apart from changing panel.env to timezone Europe/London & enabling the trusted proxies section no other changes have been made to panel.env. (also tried both mariadb (default out of the box option) and mysql as DB_HOST under mysql settings but neither works)

Any help would be really appreciated, thanks in advance.

ccarney16 commented 2 years ago

What Linux distribution are you using? It might be an issue with the shell that is being used. I mainly use RHEL based distros however my setup has been confirmed to work with newer ubuntu releases.

Id also like to see logs generated by laravel, those should be within data/panel/storage/logs/. That would give better insight as to what might be happening.

NaokiNXN commented 2 years ago

I am using Ubuntu 22.04 as for the logs, have access.log & access.error.log in that folder but the later error log file is completely empty.

Attached the access.log file but replaced my public ip with ###.##.##.### just so you are aware. As mentioned the other log file was completely empty so not included. access.log

ccarney16 commented 2 years ago

access.log and error.log are nginx logs, I need the logs prefixed as laravel to identify why mariadb was not configured.Also a side note, have you configured mariadb.env's user password?

NaokiNXN commented 2 years ago

That is odd, in the folder you asked me to check data/panel/storage/logs/ the only files present are access.error.log & access.log. Any ideas where the log files might be if not here? or is their something needed to enable the logs your looking for?

As for mariadb.env's user password I have left everything as the default passwords, I did try to configure it previously to my own details but since that had the same issue I decided to keep everything with its default values until it worked.

To be specific at the moment its setup as so in mariadb.env: Database and user information for pterodactyl MARIADB_DATABASE=pterodactyl MARIADB_USER=ptero MARIADB_PASSWORD=pterodbpass

Randomly generate root password and set to localhost only. MARIADB_RANDOM_ROOT_PASSWORD=yes MARIADB_ROOT_HOST=localhost

And panel.env is setup like so: Cache/Session Settings CACHE_DRIVER=redis SESSION_DRIVER=redis QUEUE_CONNECTION=redis

Redis Settings REDIS_HOST=redis REDIS_PORT=6379

MySQL Settings DB_HOST=mysql DB_PORT=3306 DB_DATABASE=pterodactyl DB_USERNAME=ptero DB_PASSWORD=pterodbpass

grimsi commented 2 years ago

I'm having the same issue, although I'm using Nginx Proxy Manager instead of Traefik (but I'm fairly sure that this problem has nothing to do with my reverse proxy setup). I did not change any settings related to the DB (I wanted to first test the setup). The laravel log folder (./data/panel/storage/logs) does't even exist, but here are the logs of the panel container:

[init] Waiting for database connection...
Operation timed out
[init] Database connection timeout
Operation timed out
[init] Database connection timeout
Operation timed out
[init] Database connection timeout
Operation timed out
[init] Database connection timeout

And here are the logs of the mariadb container:

pterodactyl-mariadb-1  | 2022-09-05 12:36:15+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.4+maria~ubu2204 started.
pterodactyl-mariadb-1  | 2022-09-05 12:36:16+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
pterodactyl-mariadb-1  | 2022-09-05 12:36:16+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.8.4+maria~ubu2204 started.
pterodactyl-mariadb-1  | 2022-09-05 12:36:16+00:00 [Note] [Entrypoint]: Initializing database files
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
pterodactyl-mariadb-1  | To do so, start the server, then issue the following command:
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | '/usr/bin/mysql_secure_installation'
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | which will also give you the option of removing the test
pterodactyl-mariadb-1  | databases and anonymous user created by default.  This is
pterodactyl-mariadb-1  | strongly recommended for production servers.
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | See the MariaDB Knowledgebase at https://mariadb.com/kb
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | Please report any problems at https://mariadb.org/jira
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | The latest information about MariaDB is available at https://mariadb.org/.
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | Consider joining MariaDB's strong and vibrant community:
pterodactyl-mariadb-1  | https://mariadb.org/get-involved/
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | 2022-09-05 12:36:17+00:00 [Note] [Entrypoint]: Database files initialized
pterodactyl-mariadb-1  | 2022-09-05 12:36:17+00:00 [Note] [Entrypoint]: Starting temporary server
pterodactyl-mariadb-1  | 2022-09-05 12:36:17+00:00 [Note] [Entrypoint]: Waiting for server startup
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] mariadbd (server 10.8.4-MariaDB-1:10.8.4+maria~ubu2204) starting as process 99 ...
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Number of transaction pools: 1
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Completed initialization of buffer pool
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: 128 rollback segments are active.
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] InnoDB: log sequence number 45479; transaction id 14
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] Plugin 'FEEDBACK' is disabled.
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Warning] 'user' entry 'root@0bd5e70373e2' ignored in --skip-name-resolve mode.
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Warning] 'proxies_priv' entry '@% root@0bd5e70373e2' ignored in --skip-name-resolve mode.
pterodactyl-mariadb-1  | 2022-09-05 12:36:17 0 [Note] mariadbd: ready for connections.
pterodactyl-mariadb-1  | Version: '10.8.4-MariaDB-1:10.8.4+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
pterodactyl-mariadb-1  | 2022-09-05 12:36:18+00:00 [Note] [Entrypoint]: Temporary server started.
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: GENERATED ROOT PASSWORD: "-l(c}mti}~s:F%BI/,8j%aut/ADR5P0
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: Securing system users (equivalent to running mysql_secure_installation)
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: Creating database pterodactyl
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: Creating user ptero
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: Giving user ptero access to schema pterodactyl
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | 2022-09-05 12:36:19+00:00 [Note] [Entrypoint]: Stopping temporary server
pterodactyl-mariadb-1  | 2022-09-05 12:36:19 0 [Note] mariadbd (initiated by: root[root] @ localhost []): Normal shutdown
pterodactyl-mariadb-1  | 2022-09-05 12:36:19 0 [Note] InnoDB: FTS optimize thread exiting.
pterodactyl-mariadb-1  | 2022-09-05 12:36:19 0 [Note] InnoDB: Starting shutdown...
pterodactyl-mariadb-1  | 2022-09-05 12:36:19 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
pterodactyl-mariadb-1  | 2022-09-05 12:36:19 0 [Note] InnoDB: Buffer pool(s) dump completed at 220905 12:36:19
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Shutdown completed; log sequence number 46729; transaction id 15
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] mariadbd: Shutdown complete
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | 2022-09-05 12:36:20+00:00 [Note] [Entrypoint]: Temporary server stopped
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | 2022-09-05 12:36:20+00:00 [Note] [Entrypoint]: MariaDB init process done. Ready for start up.
pterodactyl-mariadb-1  |
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] mariadbd (server 10.8.4-MariaDB-1:10.8.4+maria~ubu2204) starting as process 1 ...
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Number of transaction pools: 1
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Completed initialization of buffer pool
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: File system buffers for log disabled (block size=512 bytes)
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: 128 rollback segments are active.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Setting file './ibtmp1' size to 12.000MiB. Physically writing the file full; Please wait ...
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: File './ibtmp1' size is now 12.000MiB.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: log sequence number 46729; transaction id 14
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] Plugin 'FEEDBACK' is disabled.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] InnoDB: Buffer pool(s) load completed at 220905 12:36:20
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] Server socket created on IP: '0.0.0.0'.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] Server socket created on IP: '::'.
pterodactyl-mariadb-1  | 2022-09-05 12:36:20 0 [Note] mariadbd: ready for connections.
pterodactyl-mariadb-1  | Version: '10.8.4-MariaDB-1:10.8.4+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
pterodactyl-mariadb-1  | 2022-09-05 12:36:21 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.4' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:21 4 [Warning] Aborted connection 4 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:22 5 [Warning] Aborted connection 5 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:23 6 [Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:24 7 [Warning] Aborted connection 7 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:25 8 [Warning] Aborted connection 8 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:27 9 [Warning] Aborted connection 9 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:31 10 [Warning] Aborted connection 10 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:37 11 [Warning] Aborted connection 11 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
pterodactyl-mariadb-1  | 2022-09-05 12:36:51 12 [Warning] Aborted connection 12 to db: 'unconnected' user: 'unauthenticated' host: '172.27.0.2' (This connection closed normally without authentication)
grimsi commented 2 years ago

Regarding this error:

The panel is up and I can reach it but when running ./bin/artisan p:user:make I get the following error: -e Warning! This command is intended for interactive sessions only. Please use docker-compose directly for use in scripts. ./bin/artisan: 13: [[: not found Docker Compose service "panel" does not exist! Exiting...

I needed to change #!/bin/sh to #!/bin/bash for it to not throw this error (see https://stackoverflow.com/a/12230723/11325479).

NaokiNXN commented 2 years ago

I can confirm that changing from #!/bin/sh to #!/bin/bash did allow me to create a user for the panel and does allow me to log in to the panel.

The issues with mariadb do remain however and when creating a user using the above whilst as mentioned it does allow me to log into the panel I now get the following in the worker: [init] Waiting for database connection... [2022-09-05 15:43:57][FlpstwyIVo1uRE9PmhqDAMeng9qGHSpf] Processing: Pterodactyl\Notifications\AccountCreated [2022-09-05 15:43:59][FlpstwyIVo1uRE9PmhqDAMeng9qGHSpf] Processing: Pterodactyl\Notifications\AccountCreated [2022-09-05 15:44:00][FlpstwyIVo1uRE9PmhqDAMeng9qGHSpf] Processing: Pterodactyl\Notifications\AccountCreated [2022-09-05 15:44:01][FlpstwyIVo1uRE9PmhqDAMeng9qGHSpf] Failed: Pterodactyl\Notifications\AccountCreated

Which I am assuming is due to not being able to connect to the mariadb instance.

NaokiNXN commented 2 years ago

To add to the above after creating a user and logging into the panel laravel logs were created in the location data/panel/storage/logs/. attached generated log below. laravel-2022-09-05.log

ccarney16 commented 2 years ago

the error generated is in regards to SMTP. this is normal. You need to configure your email options or you can ignore it.

NaokiNXN commented 2 years ago

Thought that was the case looking at them, its not something I need so thats fine just need to narrow down the cause of the mariadb issue any ideas? (will try setting up and connecting to the daemon see if I can get anything else that might help find the cause)

NaokiNXN commented 2 years ago

Okay to provide further update to this if its any help after trying to setup the daemon side of things and create a node I get the config but after placing it in the right place I then start to get the following error on the daemon:

daemon-error.txt

following this setup I can no longer access the panel at all I get gateway timeout

My assumption would be the above is due to my traefik setup which if thats the case I can address that later but thought i should include in case related to this issue or in case any recommendations to fix if it is my traefik setup.

I also had some additional logs in portainer the following shows up in the panel (disapeared after a restart): [setup] Migrating/Seeding database... In Connection.php line 712: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_s
chema.tables where table_schema = pterodactyl and table_name = migrations a
nd table_type = 'BASE TABLE')
In Exception.php line 18: SQLSTATE[HY000] [2002] Connection refused
In PDOConnection.php line 40: SQLSTATE[HY000] [2002] Connection refused

In the worker I now get this: [init] Waiting for database connection... [init] Waiting for database connection... In AbstractConnection.php line 155: Error while reading line from the server. [tcp://redis:6379]
[init] Waiting for database connection... [init] Waiting for database connection...

Finally the laravel logs have a bit more info now although the errors shown appear to be in relation to redis rather than mariadb but I am still seeing the same connection refused issue on mariadb as before:

laravel-2022-09-05.log