Kovah / LinkAce

LinkAce is a self-hosted archive to collect links of your favorite websites.
https://www.linkace.org
GNU General Public License v3.0
2.63k stars 163 forks source link

No connection to MariaDB Docker #661

Closed julianmueller closed 1 year ago

julianmueller commented 1 year ago

Bug Description

Hi, I want to use Linkace alongside an existing MariaDB docker. I set up the DB, with the correct user and password in the .env file, but I still receive the error "500 - Server Error: An internal server error occurred. If you are the administrator, consult the application logs for details.". I am using Unraid as an OS, but I dont use a reverse proxy etc.

The logs dont show anything suspicious:

[22-Jun-2023 13:03:22] NOTICE: fpm is running, pid 13
[22-Jun-2023 13:03:22] NOTICE: ready to handle connections
127.0.0.1 -  22/Jun/2023:13:03:26 +0200 "GET /index.php" 500
2023-06-22 13:03:21,202 INFO Set uid to user 0 succeeded
2023-06-22 13:03:21,203 INFO supervisord started with pid 1
2023-06-22 13:03:22,205 INFO spawned: 'php-fpm' with pid 13
2023-06-22 13:03:22,206 INFO spawned: 'nginx' with pid 14
2023-06-22 13:03:23,220 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2023-06-22 13:03:23,220 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
192.168.178.20 - - [22/Jun/2023:13:03:26 +0200] "GET / HTTP/1.1" 500 5332 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0" "-"
127.0.0.1 -  22/Jun/2023:13:04:55 +0200 "GET /index.php" 500
192.168.178.20 - - [22/Jun/2023:13:04:55 +0200] "GET / HTTP/1.1" 500 5332 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0" "-"

And I can see, that the db has nothing written to it. But the command php artisan key:generate in the containers CLI works fine and puts a base64 KEY into the .env file. Therefore, I assume, the permissions to write the file are set up correctly. The -env looks like the following:

## Basic app configuration
COMPOSE_PROJECT_NAME=linkace
# The app key is generated later, please leave it like that
APP_KEY=base64:XXX

## Configuration of the database connection
## Attention: Those settings are configured during the web setup, please do not modify them now.
# Set the database driver (mysql, pgsql, sqlsrv, sqlite)
DB_CONNECTION=mysql
# Set the host of your database here
DB_HOST=192.168.178.2
# Set the port of your database here
DB_PORT=3306
# Set the database name here
DB_DATABASE=linkace
# Set both username and password of the user accessing the database
DB_USERNAME=linkace
# Wrap your password into quotes (") if it contains special characters
DB_PASSWORD=XXX

My processor type is x86_64 12th Gen Intel(R) Core(TM) i5-12400 GenuineIntel GNU/Linux so, I havent looked into the ARMv7 problem with libseccomp2.

Do you have any suggestions, whats wrong?

How to reproduce

I'm not sure how to reproduce this.

Expected behavior

I setup everything according to the docs. Also followed this reddit post, as Im also using Unraid.

Logs

No response

Screenshots

No response

LinkAce version

linkace/linkace:simple

Setup Method

Docker

Operating System

Linux (Ubuntu, CentOS,...)

Client details

No response

Kovah commented 1 year ago

Are you sure that MariaDB is available via the IP address 192.168.178.2? You can enable the debug mode to get more details about a possible issue. Change or add APP_DEBUG=true to the .env file and restart the container.

julianmueller commented 1 year ago

When I CLI into the running container, I can ping 192.168.178:3306 as weell as mariadb, because its in the same docker-network. I have also several other containers accessing this mariadb with their own databases.

When I enable debugging I get this on the webpage:

The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/app/storage/logs/laravel-2023-06-23.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'linkace.settings' doesn't exist (SQL: select * from `settings` where `user_id` is null)
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}
Context: {"exception":{}}

Which seems to me, that there are permission issues with the /logs/ folder. Therefore I tried to chmod +x .../logs/ it on the main system. Is this correct? Furthermore, I see, that it cannot access the database? Do I need to set some environment-variables for the docker? Or is the mounted .env sufficient?

julianmueller commented 1 year ago

Okay, I fixed it by giving the permissions to the logs folder. I did this via the unraid file managers gui. Do you know if these changes persist after a reboot? If not, how can I permanently give the permission to docker?

Kovah commented 1 year ago

Great to hear that this fixed it. Folder permissions are always such crap to deal with.