Add example docker-compose files
authorThomas Bruederli <redacted>
Mon, 5 Oct 2020 20:52:54 +0000 (22:52 +0200)
committerThomas Bruederli <redacted>
Mon, 5 Oct 2020 20:54:03 +0000 (22:54 +0200)
... for all variants of Roundcube images.

relates to issue #99

examples/README.md [new file with mode: 0644]
examples/docker-compose-fpm-alpine.yaml [new file with mode: 0644]
examples/docker-compose-fpm.yaml [new file with mode: 0644]
examples/docker-compose-mysql.yaml [new file with mode: 0644]
examples/docker-compose-simple.yaml [new file with mode: 0644]
examples/nginx/templates/default.conf.template [new file with mode: 0644]
fpm-alpine/docker-compose.yml [deleted file]
fpm/docker-compose.yml [deleted file]

diff --git a/examples/README.md b/examples/README.md
new file mode 100644 (file)
index 0000000..f9b6490
--- /dev/null
@@ -0,0 +1,37 @@
+# Roundcube Docker Examples
+
+This folder contains a few `docker-compose` files to spin up a Roundcube webmail webserver using the three different variants of images we provide.
+
+## Simple Roundcube with Apache and SQLite DB
+
+See [docker-compose-simple.yaml](./docker-compose-simple.yaml).
+
+Directly serves Roundcube webmail via HTTP.
+The Roundcube sources and the database file are stored on connected volumes.
+
+## Standalone Roundcube with Apache using a MySQL DB
+
+See [docker-compose-mysql.yaml](./docker-compose-mysql.yaml).
+
+Directly serves Roundcube webmail via HTTP and connects to a MySQL database container.
+The Roundcube sources and the database files are stored on connected volumes.
+
+## Roundcube served from PHP-FPM via Nginx using a Postrgres DB
+
+See [docker-compose-fpm.yaml](./docker-compose-fpm.yaml) or [docker-compose-fpm-alpine.yaml](./docker-compose-fpm-alpine.yaml).
+
+An Nginx webserver serves Roundcube from a PHP-FPM container via CGI and static files from the shared Roundcube sources.
+A Posrgres database container is used to store Roundcube's session and user data.
+The Roundcube sources and the database files are stored on connected volumes.
+
+## Installing Roundcube Plugins
+
+With the latest updates, the Roundcube images contain the [Composer](https://getcomposer.org) binary
+which is used to install plugins. You can add and activate plugins by executing `composer.phar require <package-name>` 
+inside a running Roundcube container:
+
+```
+$ docker exec -it roundcubemail composer.phar require johndoh/contextmenu --update-no-dev
+```
+
+If you have mounted the container's volume `/var/www/html` the plugins installed persist on your host system. Otherwise they need to be (re-)installed every time you update or restart the Roundcube container.
diff --git a/examples/docker-compose-fpm-alpine.yaml b/examples/docker-compose-fpm-alpine.yaml
new file mode 100644 (file)
index 0000000..23188ba
--- /dev/null
@@ -0,0 +1,67 @@
+version: '2'
+
+services:
+  roundcubemail:
+    image: roundcube/roundcubemail:latest-fpm-alpine
+    container_name: roundcubemail
+    # restart: unless-stopped
+    depends_on:
+      - roundcubedb
+    links:
+      - roundcubedb
+    ports:
+      - 9000:9000
+    volumes:
+      - ./www:/var/www/html
+    environment:
+      - ROUNDCUBEMAIL_DB_TYPE=pgsql
+      - ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name
+      - ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name
+      - ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name
+      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name
+      - ROUNDCUBEMAIL_SKIN=elastic
+      - ROUNDCUBEMAIL_DEFAULT_HOST=tls://mail.example.org
+      - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.example.org
+
+  roundcubedb:
+    image: postgres:alpine
+    container_name: roundcubedb
+    # restart: unless-stopped
+    ports:
+      - 5432:5432
+    volumes:
+      - ./db/postgres:/var/lib/postgresql/data
+    environment:
+      - POSTGRES_DB=roundcube
+      - POSTGRES_USER=roundcube
+      - POSTGRES_PASSWORD=roundcube
+
+  roundcubenginx:
+    image: nginx:alpine
+    container_name: roundcubenginx
+    # restart: unless-stopped
+    ports:
+      - 9008:80
+      # If you need SSL connection
+      # - '443:443'
+    depends_on:
+      - roundcubemail
+    links:
+      - roundcubemail
+    volumes:
+      - ./www:/var/www/html
+      - ./nginx/templates:/etc/nginx/templates
+      # Provide a custom nginx conf
+      # - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
+      # If you need SSL connection, you can provide your own certificates
+      # - ./certs:/etc/letsencrypt
+      # - ./certs-data:/data/letsencrypt
+    environment:
+      - NGINX_HOST=localhost # set your local domain or your live domain
+      - NGINX_PHP_CGI=roundcubemail:9000 # same as roundcubemail container name
+
+### Optional: add a full mail server stack to use with Roundcube like https://hub.docker.com/r/tvial/docker-mailserver
+#   mailserver:
+#     image: tvial/docker-mailserver:latest
+#     hostname: mail.example.org
+#     ...  # for more options see https://github.com/tomav/docker-mailserver#examples
diff --git a/examples/docker-compose-fpm.yaml b/examples/docker-compose-fpm.yaml
new file mode 100644 (file)
index 0000000..550a32d
--- /dev/null
@@ -0,0 +1,67 @@
+version: '2'
+
+services:
+  roundcubemail:
+    image: roundcube/roundcubemail:latest-fpm
+    container_name: roundcubemail
+    # restart: unless-stopped
+    depends_on:
+      - roundcubedb
+    links:
+      - roundcubedb
+    ports:
+      - 9000:9000
+    volumes:
+      - ./www:/var/www/html
+    environment:
+      - ROUNDCUBEMAIL_DB_TYPE=pgsql
+      - ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name
+      - ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name
+      - ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name
+      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name
+      - ROUNDCUBEMAIL_SKIN=elastic
+      - ROUNDCUBEMAIL_DEFAULT_HOST=tls://mail.example.org
+      - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.example.org
+
+  roundcubedb:
+    image: postgres:latest
+    container_name: roundcubedb
+    # restart: unless-stopped
+    ports:
+      - 5432:5432
+    volumes:
+      - ./db/postgres:/var/lib/postgresql/data
+    environment:
+      - POSTGRES_DB=roundcube
+      - POSTGRES_USER=roundcube
+      - POSTGRES_PASSWORD=roundcube
+
+  roundcubenginx:
+    image: nginx:latest
+    container_name: roundcubenginx
+    # restart: unless-stopped
+    ports:
+      - 9009:80
+      # If you need SSL connection
+      # - '443:443'
+    depends_on:
+      - roundcubemail
+    links:
+      - roundcubemail
+    volumes:
+      - ./www:/var/www/html
+      - ./nginx/templates:/etc/nginx/templates
+      # Provide a custom nginx conf
+      # - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
+      # If you need SSL connection, you can provide your own certificates
+      # - ./certs:/etc/letsencrypt
+      # - ./certs-data:/data/letsencrypt
+    environment:
+      - NGINX_HOST=localhost  # set your local domain or your live domain
+      - NGINX_PHP_CGI=roundcubemail:9000  # same as roundcubemail container name
+
+### Optional: add a full mail server stack to use with Roundcube like https://hub.docker.com/r/tvial/docker-mailserver
+#   mailserver:
+#     image: tvial/docker-mailserver:latest
+#     hostname: mail.example.org
+#     ...  # for more options see https://github.com/tomav/docker-mailserver#examples
diff --git a/examples/docker-compose-mysql.yaml b/examples/docker-compose-mysql.yaml
new file mode 100644 (file)
index 0000000..ae5fe0b
--- /dev/null
@@ -0,0 +1,41 @@
+version: '2'
+
+services:
+  roundcubedb:
+    image: mysql:5.7
+    container_name: roundcubedb
+#    restart: unless-stopped
+    volumes:
+      - ./db/mysql:/var/lib/mysql
+    ports:
+      - 34010:5432
+      - 33006:3306
+    environment:
+      - MYSQL_ROOT_PASSWORD=roundcube-mysql-pw
+      - MYSQL_DATABASE=roundcubemail
+
+  roundcubemail:
+    image: roundcube/roundcubemail:latest
+    container_name: roundcubemail
+#    restart: unless-stopped
+    depends_on:
+      - roundcubedb
+    links:
+      - roundcubedb
+    volumes:
+      - ./www:/var/www/html
+    ports:
+      - 9001:80
+    environment:
+      - ROUNDCUBEMAIL_DB_TYPE=mysql
+      - ROUNDCUBEMAIL_DB_HOST=roundcubedb
+      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube-mysql-pw
+      - ROUNDCUBEMAIL_SKIN=elastic
+      - ROUNDCUBEMAIL_DEFAULT_HOST=tls://mail.example.org
+      - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.example.org
+
+### Optional: add a full mail server stack to use with Roundcube like https://hub.docker.com/r/tvial/docker-mailserver
+#   mailserver:
+#     image: tvial/docker-mailserver:latest
+#     hostname: mail.example.org
+#     ...  # for more options see https://github.com/tomav/docker-mailserver#examples
diff --git a/examples/docker-compose-simple.yaml b/examples/docker-compose-simple.yaml
new file mode 100644 (file)
index 0000000..e267f39
--- /dev/null
@@ -0,0 +1,23 @@
+version: '2'
+
+services:
+  roundcubemail:
+    image: roundcube/roundcubemail:latest
+    container_name: roundcubemail
+#    restart: unless-stopped
+    volumes:
+      - ./www:/var/www/html
+      - ./db/sqlite:/var/roundcube/db
+    ports:
+      - 9002:80
+    environment:
+      - ROUNDCUBEMAIL_DB_TYPE=sqlite
+      - ROUNDCUBEMAIL_SKIN=elastic
+      - ROUNDCUBEMAIL_DEFAULT_HOST=tls://mail.example.org
+      - ROUNDCUBEMAIL_SMTP_SERVER=tls://mail.example.org
+
+### Optional: add a full mail server stack to use with Roundcube like https://hub.docker.com/r/tvial/docker-mailserver
+#   mailserver:
+#     image: tvial/docker-mailserver:latest
+#     hostname: mail.example.org
+#     ...  # for more options see https://github.com/tomav/docker-mailserver#examples
diff --git a/examples/nginx/templates/default.conf.template b/examples/nginx/templates/default.conf.template
new file mode 100644 (file)
index 0000000..ae7ee20
--- /dev/null
@@ -0,0 +1,17 @@
+server {
+    index index.php index.html;
+    server_name php-docker.local;
+    error_log  /var/log/nginx/error.log;
+    access_log /var/log/nginx/access.log;
+    root /var/www/html;
+
+    location ~ \.php$ {
+        try_files $uri =404;
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass ${NGINX_PHP_CGI};
+        fastcgi_index index.php;
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        fastcgi_param PATH_INFO $fastcgi_path_info;
+    }
+}
diff --git a/fpm-alpine/docker-compose.yml b/fpm-alpine/docker-compose.yml
deleted file mode 100644 (file)
index dac7526..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-version: "2"
-
-services:
-  roundcube:
-    build: ./
-    container_name: roundcube
-    #restart: always
-    depends_on:
-      - roundcubedb
-    links:
-      - roundcubedb
-    ports:
-      - 9000:9000
-    volumes:
-      - /srv/roundcube/html:/var/www/html
-    environment:
-      - ROUNDCUBEMAIL_DB_TYPE=pgsql
-      - ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name
-      - ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name
-      - ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name
-      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name
-
-  roundcubedb:
-    image: postgres:latest
-    container_name: roundcubedb
-    restart: always
-    ports:
-      - 5432:5432
-    volumes:
-      - /srv/roundcube/db:/var/lib/postgresql/data
-    environment:
-      - POSTGRES_DB=roundcube
-      - POSTGRES_USER=roundcube
-      - POSTGRES_PASSWORD=roundcube
-
-  roundcubenginx:
-    image: nginx:latest
-    container_name: roundcubenginx
-    restart: always
-    ports:
-      - 80:80
-      # If you need SSL connection
-      # - '443:443'
-    depends_on:
-      - roundcube
-    links:
-      - roundcube
-    volumes:
-      - /srv/roundcube/html:/var/www/html
-      # TODO Provide a custom nginx conf
-      #- ./nginx.conf:/etc/nginx/nginx.conf:ro
-      # If you need SSL connection, you can provide your own certificates
-      # - ./certs:/etc/letsencrypt
-      # - ./certs-data:/data/letsencrypt
-    environment:
-      - NGINX_HOST=localhost # set your local domain or your live domain
-      # - NGINX_CGI=roundcube:9000 # same as roundcube container name
-
-  # Sample mail server to use with RoundCube: https://github.com/tomav/docker-mailserver
-#  mailserver:
-#    image: tvial/docker-mailserver:latest
-#    hostname: mail
-#    domainname: <YOUR.DOMAIN.NAME>
-#    container_name: mail
-#    restart: always
-#    ports:
-#      # receiving email from other mailservers
-#      - "25:25"
-#      # SSL & TLS Client email submission (SMTP)
-#      - "465:465"
-#      - "587:587"
-#      # StartTLS & TLS/SSL IMAP client
-#      - "143:143"
-#      - "993:993"
-#      # POP3 & TLS/SSL POP3 client
-#      - "110:110"
-#      - "995:995"
-#      # Manage Sieve port
-#      - "4190:4190"
-#    environment:
-#      - DMS_DEBUG=0
-#      - ONE_DIR=1
-#      - ENABLE_CLAMAV=1
-#      - ENABLE_FAIL2BAN=1
-#      - ENABLE_POSTGREY=1
-#      - ENABLE_MANAGESIEVE=1
-#      # If you need SSL connection, you can provide your own certificates
-#      #- SSL_TYPE=manual
-#      #- SSL_CERT_PATH=/etc/letsencrypt/fullchain.pem
-#      #- SSL_KEY_PATH=/etc/letsencrypt/privkey.pem
-#    cap_add:
-#      - NET_ADMIN
-#      - SYS_PTRACE
-#    volumes:
-#      - /srv/mail/data:/var/mail
-#      - /srv/mail/state:/var/mail-state
-#      # For proper delivery, generate DKIM keys in /srv/mail/setup
-#      - /srv/mail/setup:/tmp/docker-mailserver
-#      - /etc/localtime:/etc/localtime:ro
-#      - /etc/timezone:/etc/timezone:ro
-#      # If you need SSL connection, you can provide your own certificates
-#      # - ./certs:/etc/letsencrypt
diff --git a/fpm/docker-compose.yml b/fpm/docker-compose.yml
deleted file mode 100644 (file)
index dac7526..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-version: "2"
-
-services:
-  roundcube:
-    build: ./
-    container_name: roundcube
-    #restart: always
-    depends_on:
-      - roundcubedb
-    links:
-      - roundcubedb
-    ports:
-      - 9000:9000
-    volumes:
-      - /srv/roundcube/html:/var/www/html
-    environment:
-      - ROUNDCUBEMAIL_DB_TYPE=pgsql
-      - ROUNDCUBEMAIL_DB_HOST=roundcubedb # same as pgsql container name
-      - ROUNDCUBEMAIL_DB_NAME=roundcube # same as pgsql POSTGRES_DB env name
-      - ROUNDCUBEMAIL_DB_USER=roundcube # same as pgsql POSTGRES_USER env name
-      - ROUNDCUBEMAIL_DB_PASSWORD=roundcube # same as pgsql POSTGRES_PASSWORD env name
-
-  roundcubedb:
-    image: postgres:latest
-    container_name: roundcubedb
-    restart: always
-    ports:
-      - 5432:5432
-    volumes:
-      - /srv/roundcube/db:/var/lib/postgresql/data
-    environment:
-      - POSTGRES_DB=roundcube
-      - POSTGRES_USER=roundcube
-      - POSTGRES_PASSWORD=roundcube
-
-  roundcubenginx:
-    image: nginx:latest
-    container_name: roundcubenginx
-    restart: always
-    ports:
-      - 80:80
-      # If you need SSL connection
-      # - '443:443'
-    depends_on:
-      - roundcube
-    links:
-      - roundcube
-    volumes:
-      - /srv/roundcube/html:/var/www/html
-      # TODO Provide a custom nginx conf
-      #- ./nginx.conf:/etc/nginx/nginx.conf:ro
-      # If you need SSL connection, you can provide your own certificates
-      # - ./certs:/etc/letsencrypt
-      # - ./certs-data:/data/letsencrypt
-    environment:
-      - NGINX_HOST=localhost # set your local domain or your live domain
-      # - NGINX_CGI=roundcube:9000 # same as roundcube container name
-
-  # Sample mail server to use with RoundCube: https://github.com/tomav/docker-mailserver
-#  mailserver:
-#    image: tvial/docker-mailserver:latest
-#    hostname: mail
-#    domainname: <YOUR.DOMAIN.NAME>
-#    container_name: mail
-#    restart: always
-#    ports:
-#      # receiving email from other mailservers
-#      - "25:25"
-#      # SSL & TLS Client email submission (SMTP)
-#      - "465:465"
-#      - "587:587"
-#      # StartTLS & TLS/SSL IMAP client
-#      - "143:143"
-#      - "993:993"
-#      # POP3 & TLS/SSL POP3 client
-#      - "110:110"
-#      - "995:995"
-#      # Manage Sieve port
-#      - "4190:4190"
-#    environment:
-#      - DMS_DEBUG=0
-#      - ONE_DIR=1
-#      - ENABLE_CLAMAV=1
-#      - ENABLE_FAIL2BAN=1
-#      - ENABLE_POSTGREY=1
-#      - ENABLE_MANAGESIEVE=1
-#      # If you need SSL connection, you can provide your own certificates
-#      #- SSL_TYPE=manual
-#      #- SSL_CERT_PATH=/etc/letsencrypt/fullchain.pem
-#      #- SSL_KEY_PATH=/etc/letsencrypt/privkey.pem
-#    cap_add:
-#      - NET_ADMIN
-#      - SYS_PTRACE
-#    volumes:
-#      - /srv/mail/data:/var/mail
-#      - /srv/mail/state:/var/mail-state
-#      # For proper delivery, generate DKIM keys in /srv/mail/setup
-#      - /srv/mail/setup:/tmp/docker-mailserver
-#      - /etc/localtime:/etc/localtime:ro
-#      - /etc/timezone:/etc/timezone:ro
-#      # If you need SSL connection, you can provide your own certificates
-#      # - ./certs:/etc/letsencrypt
git clone https://git.99rst.org/PROJECT