Roundcube Community Forum

Release Support => Pending Issues => Topic started by: morsecode1965 on April 04, 2025, 08:15:44 AM

Title: Docker and PostgreSQL
Post by: morsecode1965 on April 04, 2025, 08:15:44 AM
I cannot get Roundcube to connect to PostgreSQL using the official roundcube container and docker compose files. I get the same behavior/error when I use docker-compose-fpm-alpine.yaml and a modified version of docker-compose-mysql.yaml (docker-compose-psql.yaml, see attached. Note the containers names are _2 so that both can run at once.).

I get the dreaded message when I connect to Roundcube web front-end:

   Oops... something went wrong!

   An internal error has occurred. Your request cannot be processed at this time.


I am seeing the following same errors in the roundcubemail logs for both compose files.

  wait-for-it.sh: waiting 30 seconds for roundcubedb:5432
  wait-for-it.sh: roundcubedb:5432 is available after 0 seconds
  Write Docker config to /var/www/html/config/config.docker.inc.php
  ERROR: SQLSTATE[HY000] [2002] No such file or directory
  ERROR: Failed to connect to database
  Failed to initialize/update the database. Please start with an empty database and restart the container.

Starting the roundcubemail container creates the www/config/config.docker.inc.php file:

<?php
  $config['db_dsnw'] = 'pgsql://roundcube:roundcube@roundcubedb:5432/roundcube';
  $config['db_dsnr'] = '';
  $config['imap_host'] = 'localhost:143';
  $config['smtp_host'] = 'localhost:587';
  $config['username_domain'] = '';
  $config['temp_dir'] = '/tmp/roundcube-temp';
  $config['skin'] = 'elastic';
  $config['request_path'] = '/';
  $config['plugins'] = array_filter(array_unique(array_merge($config['plugins'], ['archive', 'zipdownload'])));
 
(why isn't there a '?>' at the end of the file?)

I am able to connect to the PostgreSQL database running in roundcubedb after installing postgresql-client in roundcubemail and running
   psql -h roundcubedb -U roundcube -d roundcube

Any recommendations on how to resolve this? What am I missing?