wallabag / docker

Official docker-composer for wallabag.
572 stars 150 forks source link

Unable to use database_socket in docker #417

Open 0x152a opened 4 weeks ago

0x152a commented 4 weeks ago

I'm using an external mariadb and trying to mount its socket file into docker. I found there is a database_socket parameter in https://doc.wallabag.org/en/admin/parameters.html#database-parameters. But when I try to add environment: SYMFONYENVDATABASE_SOCKET=/var/run/mysqld/mysqld.sock, the container just stucks in Waiting for database ... which refers to https://github.com/wallabag/docker/blob/41430135535d5ee5a7fc1fbbda90323331827eb5/root/entrypoint.sh#L32-L34 and https://github.com/wallabag/docker/blob/41430135535d5ee5a7fc1fbbda90323331827eb5/root/entrypoint.sh#L10-L17. It seems that the container will always wait for DATABASE_HOST@DATABASE_PORT even if we provide a DATABASE_SOCKET? I tried to delete that wait_for_database, which results in SQLSTATE[HY000] [2002] Connection refused:

wallabag  | Starting wallabag ...
wallabag  | Installing dependencies from lock file
wallabag  | Verifying lock file contents can be installed on current platform.
wallabag  | Nothing to install, update or remove
wallabag  | Package guzzlehttp/ringphp is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package guzzlehttp/streams is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/compiler is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/consistency is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/event is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/exception is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/file is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/iterator is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/math is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/protocol is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/regex is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/ruler is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/stream is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/ustring is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/visitor is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package hoa/zformat is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package lexik/form-filter-bundle is abandoned, you should avoid using it. Use spiriitlabs/form-filter-bundle instead.
wallabag  | Package php-http/guzzle5-adapter is abandoned, you should avoid using it. Use php-http/guzzle7-adapter instead.
wallabag  | Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.
wallabag  | Package scheb/2fa-qr-code is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
wallabag  | Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
wallabag  | Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead.
wallabag  | Package true/punycode is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package wallabag/php-mobi is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package php-cs-fixer/diff is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Package symfony/web-server-bundle is abandoned, you should avoid using it. No replacement was suggested.
wallabag  | Generating optimized autoload files
wallabag  | Class SimpleHtmlDom\simple_html_dom_node located in ./vendor/mgargano/simplehtmldom/src/simple_html_dom.php does not comply with psr-0 autoloading standard. Skipping.
wallabag  | Class SimpleHtmlDom\simple_html_dom located in ./vendor/mgargano/simplehtmldom/src/simple_html_dom.php does not comply with psr-0 autoloading standard. Skipping.
wallabag  | 100 packages you are using are looking for funding.
wallabag  | Use the `composer fund` command to find out more!
wallabag  | > Incenteev\ParameterHandler\ScriptHandler::buildParameters
wallabag  | Updating the "app/config/parameters.yml" file
wallabag  | > bin/console cache:clear --no-warmup
wallabag  | 
wallabag  | In ExceptionConverter.php line 101:
wallabag  |                                                                                
wallabag  |   An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refu  
wallabag  |   sed                                                                          
wallabag  |                                                                                
wallabag  | 
wallabag  | In Exception.php line 28:
wallabag  |                                              
wallabag  |   SQLSTATE[HY000] [2002] Connection refused  
wallabag  |                                              
wallabag  | 
wallabag  | In Driver.php line 34:
wallabag  |                                              
wallabag  |   SQLSTATE[HY000] [2002] Connection refused  
wallabag  |                                              
wallabag  | 
wallabag  | Script bin/console cache:clear --no-warmup handling the post-cmd event returned with error code 255
wallabag  | Script @post-cmd was called via post-install-cmd
wallabag exited with code 0

Here's the socket file:

# ls -l /var/run/mysqld/mysqld.sock 
srwxrwxrwx 1 mysql mysql 0 Jun  7 15:41 /var/run/mysqld/mysqld.sock

I'm not familiar with php or pdo, how can I fix that?

I'm using docker compose with image ghcr.io/wallabag/docker:2.6.9:

services:
  wallabag:
    image: ghcr.io/wallabag/docker:latest
    environment:
      - SYMFONY__ENV__DATABASE_DRIVER=pdo_mysql
      - SYMFONY__ENV__DATABASE_NAME=wallabag
      - SYMFONY__ENV__DATABASE_USER=wallabag
      - SYMFONY__ENV__DATABASE_PASSWORD=...
      - SYMFONY__ENV__DATABASE_SOCKET=/var/run/mysqld/mysqld.sock
      - SYMFONY__ENV__DATABASE_CHARSET=utf8mb4
      - SYMFONY__ENV__DATABASE_TABLE_PREFIX="wallabag_"
    volumes:
      - /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock:rwx