Skip to content
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

Unable to use database_socket in docker #417

Open
0x152a opened this issue Jun 9, 2024 · 0 comments
Open

Unable to use database_socket in docker #417

0x152a opened this issue Jun 9, 2024 · 0 comments

Comments

@0x152a
Copy link

0x152a commented Jun 9, 2024

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: SYMFONY__ENV__DATABASE_SOCKET=/var/run/mysqld/mysqld.sock, the container just stucks in Waiting for database ... which refers to

# Wait for external database
if [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_mysql" ] || [ "$SYMFONY__ENV__DATABASE_DRIVER" = "pdo_pgsql" ] ; then
wait_for_database
and
wait_for_database() {
timeout 60s /bin/sh -c "$(cat << EOF
until echo 'Waiting for database ...' \
&& nc -z ${SYMFONY__ENV__DATABASE_HOST} ${SYMFONY__ENV__DATABASE_PORT} < /dev/null > /dev/null 2>&1 ; \
do sleep 1 ; done
EOF
)"
}
.
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
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

1 participant