docker-ispconfig

Archived! I’ve now moved to Proxmox, meaning I’m using ISPConfig in a VM with a standard install. This now makes this project redundant


ispconfig-docker

This is a fork of Unimock’s excellent work on implementing a containerized version of the ISPConfig web-hosting suite.

Caveats

Changes from the base project

How to install (rough guide)

version: '3.9'

services:

  ispconfig:
    extends:
      file: docker-compose.build.yml
      service: ispconfig
    build:
      args:
        BUILD_CERTBOT: "no"
        BUILD_HOSTNAME: "ispconfig"
        BUILD_ISPCONFIG_USE_SSL: "no"
        ... etc

Persistent data

volumes:
  - /docker/appdata/ispconfig/etc:/etc
  - /docker/appdata/ispconfig/ftp:/var/ftp
  - /docker/appdata/ispconfig/lib:/var/lib
  - /docker/appdata/ispconfig/log:/var/log
  - /docker/appdata/ispconfig/log/roundcube:/opt/roundcube/logs
  - /docker/appdata/ispconfig/mail:/var/mail
  - /docker/appdata/ispconfig/spool:/var/spool
  - /docker/appdata/ispconfig/supplementary:/etc/apache2/supplementary:ro
  - /docker/appdata/ispconfig/vmail:/var/vmail
  - /docker/appdata/ispconfig/www:/var/www
  # Roundcube
  - /docker/appdata/ispconfig/roundcube/config.inc.php:/opt/roundcube/config/config.inc.php
  - /docker/appdata/ispconfig/roundcube/plugins:/opt/roundcube/plugins
  # Overlays
  - /docker/services/ISPConfig/build/supervisor:/etc/supervisor
  - /docker/appdata/ispconfig/config/database.config.inc.php:/usr/local/ispconfig/server/lib/mysql_clientdb.conf
  - /docker/appdata/ispconfig/config/interface.config.inc.php:/usr/local/ispconfig/interface/lib/config.inc.php
  - /docker/appdata/ispconfig/config/server.config.inc.php:/usr/local/ispconfig/server/lib/config.inc.php
  # System
  - /etc/letsencrypt:/etc/letsencrypt:ro
  - /etc/localtime:/etc/localtime:ro

Build Options

The following are particular important for your customization

Argument Default Comments
BUILD_HOSTNAME myhost.test.com The hostname to use for the build, including ISPConfig
BUILD_ISPCONFIG_USE_SSL yes Should ISPConfig use SSL? Note: this will be a self-signed certificate. See Reverse Proxy section
BUILD_PHPMYADMIN yes Include PHPMyAdmin
BUILD_CERTBOT yes Include/exclude Let’s Encrypt
BUILD_REDIS yes Install Redis? Required for Rspamd, but can be configured to another host with REDIS_HOST environmental variable
BUILD_TZ Europe/London Timezone for the container
BUILD_LOCALE en_GB POSIX (ISO 15897) locale code for the container. UTF-8 is required and will automatically be appended

Less-essential options

Argument Default Comments
BUILD_ROUNDCUBE_DB roundcube Roundcube database name
BUILD_ROUNDCUBE_USER roundcube Roundcube database username
BUILD_ROUNDCUBE_PW secretpassword Roundcube database password
BUILD_PHPMYADMIN_USER phpmyadmin PHPMyAdmin database username
BUILD_PHPMYADMIN_PW phpmyadmin PHPMyAdmin database password
BUILD_PHPMYADMIN_VERSION 4.9.0.1 Version of PHPMyAdmin to install
BUILD_MYSQL_PW pass Root password for MariaDB local server, if installed
BUILD_ISPCONFIG_MYSQL_DATABASE dbispconfig ISPConfig database name
BUILD_ISPCONFIG_PORT 8080 ISPConfig web app port number (control panel, PHPMyAdmin, Roundcube)

Using a remote SQL server

It is possible to connect to a remote SQL server during the build. This would require using the compose file extra_hosts option. However, this is problematic; in particular ISPConfig expects its database not to exist at installation. For myself, I followed the following manual strategy:

Argument Default Comments
BUILD_MYSQL_HOST localhost Hostname of the SQL server. When localhost, this will build MariaDB Server
BUILD_MYSQL_REMOTE_ACCESS_HOST 172.%.%.% When BUILD_MYSQL_HOST != localhost, this will configure database users to allow connections from this host pattern.
BUILD_ISPCONFIG_DROP_EXISTING no DANGER: If existing ISPConfig tables are found in the database, they will be dropped before installation! Without this, the installation fails. Of course data will be lost!
Argument Default Comments
BUILD_ISPCONFIG_VERSION Dockerfile Version of ISPConfig to install
BUILD_ROUNDCUBE_VERSION Dockerfile Version of Roundcube to install
BUILD_ROUNDCUBE_DIR /opt/roundcube Path where Roundcube will be installed. Don’t change!

Currently non-functional

Argument Default Comments
BUILD_PRINTING no Install print support

Environmental Variables (runtime options)

Argument Default / Example Comments
SSL_CERT none Path to a custom SSL certificate (must be mounted to the container)
SSL_CHAIN none Path to a custom SSL certificate chain (must be mounted to the container)
SSL_KEY none Path to a custom SSL private key (must be mounted to the container)
APACHE_SUPPLEMENTARY_VHOSTS /etc/apache2/supplementary/*.vhost Adds an include statement to the Apache config to add supplementary vhosts
APACHE_ENABLE_MODS macro,proxy_balancer,proxy_http Apache standard modules to enable. Note this won’t install any non-standard mods
MYSQL_HOST host Reconfigure services to point to this SQL server
HOSTNAME myhost.test.com Runtime hostname
HOSTNAME_EMAIL mail.myhost.test.com Runtime hostname for email
DISABLED_SERVICES unbound Space-separated list of installed services to disable at runtime. Complete list in the Dockerfile
POSTGREY_DELAY 300 Postgrey delay time
POSTGREY_MAX_AGE 35 Postgrey maximum age
POSTGREY_TEXT "Delayed by postgrey" Postgrey delay message
REDIS_HOST localhost Hostname for Redis. If localhost, requires BUILD_REDIS = "yes"
APACHE_DISABLE_DEFAULT_SITE no If yes, disables Apache’s default site

Non-functional

Argument Default Comments
MAILMAN_EMAIL_HOST test.com Mailman host
MAILMAN_EMAIL email@test.com Mailman address
MAILMAN_PASS pass Mailman password
LANGUAGE en Mailman language

Recommendations

Use installed Apache as a reverse proxy

Disable SSL for ISPConfig and use Apache as a reverse proxy to access ISPConfig and associated installed apps (Roundcube, PHPMyAdmin)

<Macro Subdomain $host $target>
  <VirtualHost *:443>
    ServerName $host.myhostname.blah
    ProxyPass "/" "$target"
    ProxyPassReverse "/" "$target"
  </VirtualHost>
</Macro>

Use Subdomain ispconfig https://localhost:8080/
Use Subdomain webmail http://localhost:8080/webmail/
Use Subdomain phpmyadmin http://localhost:8080/phpmyadmin/

UndefMacro Subdomain