simjanos-dev / LinguaCafe

LinguaCafe is a self-hosted software that helps language learners read foreign languages.
https://simjanos-dev.github.io/LinguaCafeHome/
GNU General Public License v3.0
858 stars 29 forks source link

Problems setting up docker on synology NAS. Apache AH00072 #364

Closed unickq closed 1 week ago

unickq commented 1 week ago

Hey there,

I'm trying to launch your app on my NAS and facing with apache issues. It's a Synology 218+ nas with the latest DSM 8, which has docker 24 and 2Core Intel Celeron J3355 and 10gb ram

2024/10/09 01:20:04 | stderr | AH00015: Unable to open logs
2024/10/09 01:20:04 | stderr | no listening sockets available, shutting down
2024/10/09 01:20:04 | stderr | (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
2024/10/09 01:20:04 | stderr | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 192.168.48.2. Set the 'ServerName' directive globally to suppress this message
2024/10/09 01:20:03 | stdout | Database seeding completed successfully.
2024/10/09 01:20:03 | stdout | Seeded:  Database\Seeders\FontTypeSeeder (4.33ms)
2024/10/09 01:20:03 | stdout | Seeding: Database\Seeders\FontTypeSeeder
2024/10/09 01:20:03 | stdout | Seeded:  Database\Seeders\DictionarySeeder (1.52ms)
2024/10/09 01:20:03 | stdout | Seeding: Database\Seeders\DictionarySeeder
2024/10/09 01:20:03 | stdout | Seeded:  Database\Seeders\SettingsSeeder (38.33ms)
2024/10/09 01:20:03 | stdout | Seeding: Database\Seeders\SettingsSeeder
2024/10/09 01:20:03 | stdout | Nothing to migrate.
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/logs
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/framework/views
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/framework/testing
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/framework/sessions
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/framework/cache/data
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/app/temp/dictionaries
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/app/public
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/app/images/book_images
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/app/fonts
2024/10/09 01:20:03 | stdout | Folder already exists: ./storage/app/dictionaries

Config for YML - latest prod - https://github.com/simjanos-dev/LinguaCafe/blob/main/docker-compose.yml

.env:

DB_ROOT_PASSWORD=rootpwd

When I start without .env - MySQL doesn't start - container for service mysql is unhealthy

From what I found, it doesn't seem like 80 port. From this I found that I need to edit /etc/apache2/ports.conf. But I can't, your dockerfile is built with --no-install-recommends and seems like doesn't have any text editor for Debian GNU/Linux 12 (bookworm).

I can't install anything because no root access and sudo is not available. And setting it up with su - doesn't work because of adduser --ingroup laravel --disabled-password in dockerfile.

Container crashes immediately, but when stud down DB container - I'm able to log in and

laravel@b814c2f89607:/var/www/html$ service apache2 status                       
apache2 is not running ... failed!                                               
laravel@b814c2f89607:/var/www/html$ service apache2 start                        
Starting Apache httpd web server: apache2AH00558: apache2: Could not reliably det
ermine the server's fully qualified domain name, using 192.168.48.2. Set the 'Ser
verName' directive globally to suppress this message                             
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80  
no listening sockets available, shutting down                                    
AH00015: Unable to open logs                                                     
Action 'start' failed.                                                           
The Apache error log may have more information.                                  
.                                                     
When the http daemon starts, it tries to bind the 80 port, which is a port within the system assigned ports and as such it can only be accessed by root. 
In order to be able to run it as a non-root user you could change the port to a non-reserved one (higher than 1024), or use an account with enough privileges.

But I don't know how to debug it for now - I need to build it myself, using my own docker cloud, and then PR with port up.

However, everything is working on my Mac 😿

unickq commented 1 week ago

omg, after 4 hours of debugging

user: root added to main app worked

services:
  webserver:
    image: ghcr.io/simjanos-dev/linguacafe-webserver:${VERSION:-latest}
    user: root
simjanos-dev commented 1 week ago

Hi!

Im not sure why it does not work on your nas.

I think using root as a user will cause other permission problems, for example when trying to import a book.