diff --git a/Dockerfile b/Dockerfile index 6571c7c..c7c6645 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,7 @@ RUN echo "@community https://nl.alpinelinux.org/alpine/v3.7/community" >> /etc/a php7@community \ php7-fpm@community \ php7-imap@community \ + php7-pgsql@community \ php7-mysqli@community \ php7-session@community \ php7-mbstring@community \ diff --git a/README.md b/README.md index fe6cc0e..1d3cf8a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ PostfixAdmin is a web based interface used to manage mailboxes, virtual domains - Lightweight & secure image (no root process) - Based on Alpine Linux - Latest Postfixadmin version (3.1) -- MySQL/Mariadb driver +- MariaDB/PostgreSQL driver - With PHP7 ### Built-time variables @@ -30,10 +30,12 @@ PostfixAdmin is a web based interface used to manage mailboxes, virtual domains | -------- | ----------- | ---- | ------------- | | **UID** | postfixadmin user id | *optional* | 991 | **GID** | postfixadmin group id | *optional* | 991 -| **DBHOST** | MariaDB instance ip/hostname | *optional* | mariadb -| **DBUSER** | MariaDB database username | *optional* | postfix -| **DBNAME** | MariaDB database name | *optional* | postfix -| **DBPASS** | MariaDB database password or location of a file containing it | **required** | null +| **DBDRIVER** | Database type: mysql, pgsql | optional | mysql +| **DBHOST** | Database instance ip/hostname | *optional* | mariadb +| **DBPORT** | Database instance port **DOES NOT WORK ON MYSQL FOR NOW** | optional | 3306 +| **DBUSER** | Database database username | *optional* | postfix +| **DBNAME** | Database database name | *optional* | postfix +| **DBPASS** | Database database password or location of a file containing it | **required** | null | **SMTPHOST** | SMTP server ip/hostname | *optional* | mailserver | **DOMAIN** | Mail domain | *optional* | `domainname` value | **ENCRYPTION** | Passwords encryption method | *optional* | `dovecot:SHA512-CRYPT` @@ -56,7 +58,7 @@ postfixadmin: - DBPASS=xxxxxxx depends_on: - mailserver - - mariadb + - mariadb # postgres (adjust accordingly) ``` ### How to setup diff --git a/bin/run.sh b/bin/run.sh index 4eea6db..04e380a 100644 --- a/bin/run.sh +++ b/bin/run.sh @@ -3,7 +3,9 @@ GID=${GID:-991} UID=${UID:-991} DOMAIN=${DOMAIN:-$(hostname --domain)} +DBDRIVER=${DBDRIVER:-mysql} DBHOST=${DBHOST:-mariadb} +DBPORT=${DBPORT:-3306} DBUSER=${DBUSER:-postfix} DBNAME=${DBNAME:-postfix} DBPASS=$([ -f "$DBPASS" ] && cat "$DBPASS" || echo "${DBPASS:-}") @@ -15,7 +17,7 @@ PASSVAL_MIN_CHAR=${PASSVAL_MIN_CHAR:-3} PASSVAL_MIN_DIGIT=${PASSVAL_MIN_DIGIT:-2} if [ -z "$DBPASS" ]; then - echo "Mariadb database password must be set !" + echo "MariaDB/PostgreSQL database password must be set !" exit 1 fi @@ -25,16 +27,22 @@ mkdir -p /postfixadmin/templates_c # Set permissions chown -R $UID:$GID /postfixadmin +# MySQL/MariaDB should use mysqli driver +case "$DBDRIVER" in + mysql) DBDRIVER=mysqli; +esac + # Local postfixadmin configuration file cat > /postfixadmin/config.local.php <