diff --git a/README.md b/README.md index f4a0711..cf0558a 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ By default, the image will use a local SQLite database for storing user account It'll be created inside the `/var/www/html` directory and can be backed up from there. Please note that this option should not be used for production environments. -### Connect to a MySQL Database +### Connect to a Database The recommended way to run Roundcube is connected to a MySQL database. Specify the following env variables to do so: @@ -40,6 +40,8 @@ The recommended way to run Roundcube is connected to a MySQL database. Specify t `ROUNDCUBEMAIL_DB_HOST` - Host (or Docker instance) name of the database service; defaults to `mysql` or `postgres` depending on linked containers. +`ROUNDCUBEMAIL_DB_PORT` - Port number of the database service; defaults to `3306` or `5432` depending on linked containers. + `ROUNDCUBEMAIL_DB_USER` - The database username for Roundcube; defaults to `root` on `mysql` `ROUNDCUBEMAIL_DB_PASSWORD` - The password for the database connection diff --git a/php-apache/docker-entrypoint.sh b/php-apache/docker-entrypoint.sh index 35fd40b..4262293 100755 --- a/php-apache/docker-entrypoint.sh +++ b/php-apache/docker-entrypoint.sh @@ -17,15 +17,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}" : "${ROUNDCUBEMAIL_DB_HOST:=postgres}" + : "${ROUNDCUBEMAIL_DB_PORT:=5432}" : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}" : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}" : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}" : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}" - /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:5432 -t 30 + /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30 elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}" : "${ROUNDCUBEMAIL_DB_HOST:=mysql}" + : "${ROUNDCUBEMAIL_DB_PORT:=3306}" : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}" if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}" @@ -35,7 +37,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}" : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}" - /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:3306 -t 30 + /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30 else # use local SQLite DB in /var/www/html/db : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}" diff --git a/php-fpm/docker-entrypoint.sh b/php-fpm/docker-entrypoint.sh index 5bc6378..8ff7788 100755 --- a/php-fpm/docker-entrypoint.sh +++ b/php-fpm/docker-entrypoint.sh @@ -17,15 +17,17 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then if [ ! -z "${!POSTGRES_ENV_POSTGRES_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "pgsql" ]; then : "${ROUNDCUBEMAIL_DB_TYPE:=pgsql}" : "${ROUNDCUBEMAIL_DB_HOST:=postgres}" + : "${ROUNDCUBEMAIL_DB_PORT:=5432}" : "${ROUNDCUBEMAIL_DB_USER:=${POSTGRES_ENV_POSTGRES_USER}}" : "${ROUNDCUBEMAIL_DB_PASSWORD:=${POSTGRES_ENV_POSTGRES_PASSWORD}}" : "${ROUNDCUBEMAIL_DB_NAME:=${POSTGRES_ENV_POSTGRES_DB:-roundcubemail}}" : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}" - /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:5432 -t 30 + /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30 elif [ ! -z "${!MYSQL_ENV_MYSQL_*}" ] || [ "$ROUNDCUBEMAIL_DB_TYPE" == "mysql" ]; then : "${ROUNDCUBEMAIL_DB_TYPE:=mysql}" : "${ROUNDCUBEMAIL_DB_HOST:=mysql}" + : "${ROUNDCUBEMAIL_DB_PORT:=3306}" : "${ROUNDCUBEMAIL_DB_USER:=${MYSQL_ENV_MYSQL_USER:-root}}" if [ "$ROUNDCUBEMAIL_DB_USER" = 'root' ]; then : "${ROUNDCUBEMAIL_DB_PASSWORD:=${MYSQL_ENV_MYSQL_ROOT_PASSWORD}}" @@ -35,7 +37,7 @@ if [[ "$1" == apache2* ]] || [ "$1" == php-fpm ]; then : "${ROUNDCUBEMAIL_DB_NAME:=${MYSQL_ENV_MYSQL_DATABASE:-roundcubemail}}" : "${ROUNDCUBEMAIL_DSNW:=${ROUNDCUBEMAIL_DB_TYPE}://${ROUNDCUBEMAIL_DB_USER}:${ROUNDCUBEMAIL_DB_PASSWORD}@${ROUNDCUBEMAIL_DB_HOST}/${ROUNDCUBEMAIL_DB_NAME}}" - /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:3306 -t 30 + /wait-for-it.sh ${ROUNDCUBEMAIL_DB_HOST}:${ROUNDCUBEMAIL_DB_PORT} -t 30 else # use local SQLite DB in /var/www/html/db : "${ROUNDCUBEMAIL_DB_TYPE:=sqlite}"