Skip to content
This repository was archived by the owner on Nov 1, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`
Expand All @@ -56,7 +58,7 @@ postfixadmin:
- DBPASS=xxxxxxx
depends_on:
- mailserver
- mariadb
- mariadb # postgres (adjust accordingly)
```

### How to setup
Expand Down
12 changes: 10 additions & 2 deletions bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}")
Expand All @@ -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

Expand All @@ -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 <<EOF
<?php
\$CONF['configured'] = true;

\$CONF['database_type'] = 'mysqli';
\$CONF['database_type'] = '${DBDRIVER}';
\$CONF['database_host'] = '${DBHOST}';
\$CONF['database_user'] = '${DBUSER}';
\$CONF['database_password'] = '${DBPASS}';
\$CONF['database_name'] = '${DBNAME}';
\$CONF['database_port'] = '${DBPORT}';

\$CONF['encrypt'] = '${ENCRYPTION}';
\$CONF['dovecotpw'] = "/usr/bin/doveadm pw";
Expand Down