Skip to content

Backup Errors & No "Stats" #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
giuseppebaldi opened this issue Apr 13, 2025 · 22 comments
Open

Backup Errors & No "Stats" #419

giuseppebaldi opened this issue Apr 13, 2025 · 22 comments

Comments

@giuseppebaldi
Copy link

I was having this issue so I deleted the application and did a fresh install with new database, etc. Unfortunately, I am still having the exact same issues. When attempting to do a backup, I get an error: "An error has occurred while exporting your database."

Image

On top of that, I am not seeing any statistics on book chapters (Total words, unique words, etc); I just get a perpetual "loading" animation across those fields.

Image

I am not seeing any errors in horizon.log, below is from laravel.log:

[2025-04-13 19:25:19] production.ERROR: League\Flysystem\Filesystem::delete(): Argument #1 ($location) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 513 {"userId":1,"exception":"[object] (TypeError(code: 0): League\Flysystem\Filesystem::delete(): Argument #1 ($location) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php on line 513 at /var/www/html/vendor/league/flysystem/src/Filesystem.php:84)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(513): League\Flysystem\Filesystem->delete(NULL)
#1 /var/www/html/app/Services/BackupService.php(41): Illuminate\Filesystem\FilesystemAdapter->delete(Array)
#2 /var/www/html/app/Services/BackupService.php(24): App\Services\BackupService->deleteOldBackups('linguacafe_')
#3 /var/www/html/app/Console/Commands/CreateBackup.php(32): App\Services\BackupService->createBackup()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\CreateBackup->handle()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\Container\Container->call(Array)
#10 /var/www/html/vendor/symfony/console/Command/Command.php(279): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\StringInput), Object(Illuminate\Console\OutputStyle))
#11 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\StringInput), Object(Illuminate\Console\OutputStyle))
#12 /var/www/html/vendor/symfony/console/Application.php(1047): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\StringInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#13 /var/www/html/vendor/symfony/console/Application.php(316): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Commands\CreateBackup), Object(Symfony\Component\Console\Input\StringInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#14 /var/www/html/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\StringInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(162): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\StringInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(423): Illuminate\Console\Application->call('app:create-back...', Array, NULL)
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(357): Illuminate\Foundation\Console\Kernel->call('app:create-back...')
#18 /var/www/html/app/Http/Controllers/BackupController.php(12): Illuminate\Support\Facades\Facade::__callStatic('call', Array)
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(46): App\Http\Controllers\BackupController->createBackup()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\BackupController), 'createBackup')
#21 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Route.php(206): Illuminate\Routing\Route->runController()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(808): Illuminate\Routing\Route->run()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/html/app/Http/Middleware/AdminMiddleware.php(24): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): App\Http\Middleware\AdminMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/AuthenticateSession.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\AuthenticateSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(64): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(88): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(75): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#44 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(807): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(786): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(750): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#47 /var/www/html/vendor/laravel/framework/src/Illuminate/Routing/Router.php(739): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#48 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(200): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#49 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#50 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#51 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ConvertEmptyStringsToNull.php(31): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#52 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#54 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TrimStrings.php(51): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#55 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\TrimStrings->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#57 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#58 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(110): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#59 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#60 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/HandleCors.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#61 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#62 /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Middleware/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#63 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(183): Illuminate\Http\Middleware\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#64 /var/www/html/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#65 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(175): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#66 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(144): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#67 /var/www/html/public/index.php(51): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#68 {main}
"}
192.168.86.78 - - [13/Apr/2025:14:25:19 -0500] "GET /backups/create HTTP/1.1" 500 1284 "http://192.168.86.29:9191/admin" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36"
127.0.0.1 - - [13/Apr/2025:14:25:24 -0500] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.4.62 (Debian) PHP/8.2.28 (internal dummy connection)"

@TheNomad11
Copy link

I just wanted to post this issue, I am encountered the same issue with lacking statistics, upgrading to the beta version did not help. I even have an "importing" message

Image

@giuseppebaldi
Copy link
Author

I just wanted to post this issue, I am encountered the same issue with lacking statistics, upgrading to the beta version did not help. I even have an "importing" message

Image

Are you having the same issues with backups?

@TheNomad11
Copy link

Are you having the same issues with backups?

Just tested it, backups are working fine

@giuseppebaldi
Copy link
Author

Great...so I have 2 problems I guess. Thanks!

@simjanos-dev
Copy link
Owner

Hi!

@TheNomad11 @giuseppebaldi

I could recreate the database iissue by removing MAX_SAVED_BACKUPS: 14 from the docker compose file.

Did you replace the docker-compose.yml file with the new version when you updated to v0.14? If you didn't, this could cause the other issues as well, because 6001 port was added for websockets, which is used to "stream" word counts for chapters.

@giuseppebaldi
Copy link
Author

I just updated again with the new docker-compose.yml file and that did fix the backup issue. I was able to create a backup and verified that it was in the backups folder. Perhaps adding MAX_SAVED_BACKUPS: 14 fixed that? Still no stats though. If I go to IP:6001 I get a page that says "Not found." I am not sure if that's normal or not.

One note, I did have to change the port for redis in my docker compose file, I had another redis container on that port and it seemed to be causing some issues. I changed this to - "6377:6379" but did not change REDIS_PORT: 6379. Could that cause an issue? In the redis logs I see the below, so it seems to be working fine.

1:M 14 Apr 2025 00:21:59.005 * 100 changes in 300 seconds. Saving...

1:M 14 Apr 2025 00:21:59.005 * Background saving started by pid 22

22:C 14 Apr 2025 00:21:59.488 * DB saved on disk

22:C 14 Apr 2025 00:21:59.489 * Fork CoW for RDB: current 0 MB, peak 0 MB, average 0 MB

1:M 14 Apr 2025 00:21:59.507 * Background saving terminated with success

In my webserver log I see this, which I assume means websockets is running correctly:

2025-04-14 00:13:12,302 INFO supervisord started with pid 1

2025-04-14 00:13:13,304 INFO spawned: 'apache2' with pid 13

2025-04-14 00:13:13,305 INFO spawned: 'backup' with pid 14

2025-04-14 00:13:13,306 INFO spawned: 'horizon' with pid 15

2025-04-14 00:13:13,307 INFO spawned: 'websockets' with pid 16

2025-04-14 00:13:14,745 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

2025-04-14 00:13:14,745 INFO success: backup entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

2025-04-14 00:13:14,745 INFO success: horizon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

2025-04-14 00:13:14,745 INFO success: websockets entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

@TheNomad11
Copy link

TheNomad11 commented Apr 14, 2025

No change after using the new docker compose file. Maybe there is a nginx issue? Could you provide a nginx reverse proxy example? I could not find anything in the documentation

EDIT: The statistics for the whole book seem to work fine, but not for the chapters

Image

@TheNomad11
Copy link

It seems to be a websocket issue. From the logs:

INFO  Starting server on 0.0.0.0:6001.  


   INFO  Starting server on 0.0.0.0:6001.  


In Connection.php line 813:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *  
   from `cache` where `key` = linguacafe_cache_laravel:reverb:restart limit 1  
  )                                                                            
                                                                               

In Connector.php line 65:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             


   INFO  Starting server on 0.0.0.0:6001. 

@giuseppebaldi
Copy link
Author

@TheNomad11 Any luck fixing this?

@TheNomad11
Copy link

I have no idea, is it a nginx issue? Do you have the same error or any idea how to fix it @giuseppebaldi ?

@giuseppebaldi
Copy link
Author

It looks like we have the same problem but potentially different causes, I don't know. I am not having the same websocket error you're having, in fact, I don't seem to have any errors in my container logs. I tried recreating the whole stack from scratch because I didn't have this problem when I first installed it, but immediately had the same issue. I've tried the new compose file and, like you, that didn't seem to have any effect. Not sure what to do next honestly.

@simjanos-dev
Copy link
Owner

One note, I did have to change the port for redis in my docker compose file, I had another redis container on that port and it seemed to be causing some issues. I changed this to - "6377:6379" but did not change REDIS_PORT: 6379. Could that cause an issue?

Yes, you should add REDIS_PORT=6379 to your .env file.

Maybe there is a nginx issue? Could you provide a nginx reverse proxy example? I could not find anything in the documentation

I don't think I use nginx or other revers proxy anywhere.

If I go to IP:6001 I get a page that says "Not found." I am not sure if that's normal or not.

It is normal. 6001 port is used for websockets. It sends data to your browser without needing to refresh the pages. I think it is used at 2 places: loading data for chapters in an opened book, and importing a dictionary. You can test if it works the easiest if you try to import a larger dictionary. If you see the progress bar going, it is working.

I have an idea what could have happened for both of you. Importing happens in the background, and the import jobs are stored in redis. If you start an import, but the redis server does not work, then the importing never starts. In this case if you fixed the redis server, it will be empty, but the chapters are still marked as "importing" in the database, and they are stuck. There is already a ticket for it: #404.

If this is the case, and you can confirm that your redis server and websockets are working, you can fix this by changing chapter statuses in the database from unprocessed to failed, then clicking on the ... button on the opened book page, and clicking Retry failed imports.

This would only fix this very specific issue, where the chapters have the yellow/orange importing state next to them. On the images where chapters are not being imported, but still not getting their data streamed in I don't know what causes the issue, but it will be redis/websockets.

@giuseppebaldi
Copy link
Author

giuseppebaldi commented Apr 19, 2025

After a reinstallation, I think it may have something to do with this, some sort of permission error in redis: 174:C 19 Apr 2025 21:18:54.054 # Failed opening the temp RDB file temp-174.rdb (in server root dir /data) for saving: Permission denied 1:M 19 Apr 2025 21:18:54.155 # Background saving error

My linguacafe directory has folder with different owners & groups. Some are owned by a "docker-user" I created and some are owned by user 999, they are all in group 999. I changed them all to 999:999 but I am not sure that fixed it, I still get hung up on importing new chapters. What's a better fix for this? What should the folder permissions be?

@giuseppebaldi
Copy link
Author

Ok, I finally fixed this. I did a fresh install, after containers were created but not started yet I did CHMOD -R 777 on the entire directory, made sure there was not a single error in any log, then started up the containers. It appears I am good now. Just for good measure, I made sure I could create a backup.

@TheNomad11
Copy link

TheNomad11 commented Apr 23, 2025

I now get

In Connection.php line 813:
                                                                               
  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select *  
   from `cache` where `key` = linguacafe_cache_laravel:reverb:restart limit 1  
  )                                                                            
                                                                               

In Connector.php line 65:
                                             
  SQLSTATE[HY000] [2002] Connection refused 

Maybe I also need to make a clean installl

EDIT: Same issue with new install, the errior messages disappeard though, maybe I should try another server or go back to v13 which worked fine...

@simjanos-dev
Copy link
Owner

simjanos-dev commented Apr 24, 2025

@TheNomad11

Are you using the default docker setup, or something custom? Can you please post your docker-compose.yml file?

Sorry for the late responses, been busy last few weeks.

@TheNomad11
Copy link

Hi @simjanos-dev thanks and sorry for the trouble, you have enough things to do, and it might anyway boil down to my own stupidity....

I use the standard compose file, but maybe i messed something up, I also tried using an .env file without luck

name: linguacafe

networks:
    linguacafe:
        driver: bridge

services:
    webserver:
        image: ghcr.io/simjanos-dev/linguacafe-webserver:${VERSION:-latest}
        container_name: linguacafe-webserver
        restart: unless-stopped
        depends_on:
            mysql:
                condition: service_healthy
        volumes:
            - ./storage:/var/www/html/storage
            - ./docker/supervisor-horizon.conf:/etc/supervisor/conf.d/horizon.conf
            - ./docker/supervisor-websockets.conf:/etc/supervisor/conf.d/websockets.conf
        environment:
            DB_DATABASE: ${DB_DATABASE:-linguacafe}
            DB_USERNAME: ${DB_USERNAME:-linguacafe}
            DB_PASSWORD: ${DB_PASSWORD:-linguacafe}
            DB_HOST: ${DB_HOST:-linguacafe-database}
            DB_PORT: ${DB_PORT:-3306}
            BACKUP_INTERVAL: "59 23 * * *"
            MAX_SAVED_BACKUPS: 14
        ports:
            - "6001:6001"
            - "${PORT:-9191}:80"
        networks:
            - linguacafe
        extra_hosts:
            - "host.docker.internal:host-gateway"
    mysql:
        image: mysql:8.0
        container_name: linguacafe-database
        restart: unless-stopped
        tty: true
        healthcheck:
            test: ["CMD", 'mysqladmin', 'ping', '-h', 'localhost', '-u', 'root', '-p$MYSQL_ROOT_PASSWORD']
            interval: 10s
            timeout: 5s
            retries: 10
        volumes:
            - ./database:/var/lib/mysql
        environment:
            MYSQL_DATABASE: ${DB_DATABASE:-linguacafe}
            MYSQL_USER: ${DB_USERNAME:-linguacafe}
            MYSQL_PASSWORD: ${DB_PASSWORD:-linguacafe}
            MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-linguacafe}
            SERVICE_NAME: linguacafe-database
        command: mysqld --general-log=1 --general-log-file=/var/lib/mysql/general-log.log
        networks:
            - linguacafe
    redis:
        image: redis:7.2-alpine
        container_name: linguacafe-redis
        restart: unless-stopped
        volumes:
            - ./cache:/data
        ports:
            - "6379:6379"
        environment:
            REDIS_PASSWORD: linguacafe
            REDIS_PORT: 6379
            REDIS_DATABASES: 16
        networks:
            - linguacafe
    python:
        container_name: linguacafe-python-service
        command: "python3 /app/tokenizer.py"
        restart: unless-stopped
        tty: true
        image: ghcr.io/simjanos-dev/linguacafe-python-service:${VERSION:-latest}
        environment:
            PYTHONPATH: "/var/www/html/storage/app/model"
        volumes:
            - ./storage:/var/www/html/storage
        networks:
            - linguacafe
        platform: ${PLATFORM:-}

Out of curiosity i sometimes used the .emv file

#VERSION=
DB_CONNECTION=mysql
DB_HOST=linguacafe-database
DB_PORT=3306
DB_DATABASE=linguacafe
DB_USERNAME=linguacafe
DB_PASSWORD=linguacafe
#DB_ROOT_PASSWORD=linguacafe

@giuseppebaldi
Copy link
Author

One note I would like to make: when accessing the application from the local ip and port the book/chapter stats show up just fine but when trying to access through a custom domain it shows the screen where it looks like the stats are constantly loading. No big deal but thought I would mention in case there's an easy fix to address that behavior (not sure why it would be different but it is).

@TheNomad11
Copy link

yeah, same for me @giuseppebaldi that means probably that's a reverse proxy issue. something must be changed related to websockets maybe?

@TheNomad11
Copy link

With help from Chatgpt I found the solution. If you use a nginx reverse proxy you have to add this in the server block:

location /app {
     proxy_pass http://127.0.0.1:6001;
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto $scheme;
 }

and maybe also

location /socket.io/ {
    proxy_pass http://127.0.0.1:6001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

restart nginx and problem solved (at least for stuff you will add and edit from now on)!

@giuseppebaldi
Copy link
Author

Glad you got that fixed. I am not using nginx so your solution won't help me. I am just accessing through a cloudflare tunnel. I am seeing websocket errors in the browser console so I know that's the issue but I have no idea how to fix this via cloudflare.

@TheNomad11
Copy link

Not sure that it won't help you. The thing is that /app (and not /ws as in other applications) is relevant and port 6001.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants