From 72846074d6496826c90bd92fa29e52b287779692 Mon Sep 17 00:00:00 2001 From: Felix Bartels Date: Tue, 5 Feb 2019 21:55:20 +0100 Subject: [PATCH] add docker-file to run webapp standalone tweak start.sh in webapp image so that it only gets the package list when there are actual packages to install Signed-off-by: Felix Bartels --- README.md | 8 +++++++- examples/webapp.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ webapp/start.sh | 6 +++--- 3 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 examples/webapp.yml diff --git a/README.md b/README.md index 1dc137c..0bc7fd4 100644 --- a/README.md +++ b/README.md @@ -82,10 +82,16 @@ This project includes a Docker container to easily inspect the data returned by To get a quick impression of Kopano this git repository bundles a locally build ldap image with some example users. When using the docker-compose.yml in a production environment make sure to: -- either remove `ldap-demo/bootstrap/ldif/demo-users.ldif` from the locally built ldap image or complety remove the local ldap from the compose file +- either remove `ldap-demo/bootstrap/ldif/demo-users.ldif` from the locally built ldap image or completely remove the local ldap from the compose file - adapt ldap queries in .env to match you actual ldap server and users - all additional configuration of the Kopano components should be specified in the compose file and **not within the running container** +#### Can I combine these Docker images with my existing environment? + +Yes, that is certainly a possibillity. Within the `examples/` directory you can find some ready to run examples that can be run in the following way: + +- `docker-compose -f examples/webapp.yml up -d` + ### Some more commands for those unfamilar with docker-compose - Start ``docker-compose-yml`` file in the background: `docker-compose up -d` diff --git a/examples/webapp.yml b/examples/webapp.yml new file mode 100644 index 0000000..cf79dbf --- /dev/null +++ b/examples/webapp.yml @@ -0,0 +1,42 @@ +version: "3.5" + +services: + web: + image: ${docker_repo:?err}/kopano_web + container_name: web + restart: always + ports: + - "2015:2015" + - "${HTTP}:8080" + - "${HTTPS}:8443" + environment: + - EMAIL=${EMAIL} + - FQDN=${FQDN} + command: wrapper.sh + volumes: + - web:/.kweb + networks: + - web-net + + kopano_webapp: + image: ${docker_repo:?err}/kopano_webapp:${WEBAPP_VERSION} + hostname: kopano_webapp + container_name: kopano_webapp + volumes: + - /etc/kopano/ssl:/kopano/ssl + - /run/kopano:/run/kopano + environment: + - TZ=${TZ} + # hostname of kopano system, leave empty for unix socket + - KCCONF_SERVERHOSTNAME= + # https port of kopano system + - KCCONF_SERVERPORT= + - ADDITIONAL_KOPANO_WEBAPP_PLUGINS=${ADDITIONAL_KOPANO_WEBAPP_PLUGINS} + networks: + - web-net + +volumes: + web: + +networks: + web-net: diff --git a/webapp/start.sh b/webapp/start.sh index 32b7a70..133e0de 100755 --- a/webapp/start.sh +++ b/webapp/start.sh @@ -2,7 +2,7 @@ # define default value for serverhostname and serverport if not passed into container KCCONF_SERVERHOSTNAME=${KCCONF_SERVERHOSTNAME:-127.0.0.1} -KCCONF_SERVERPORT=${KCCONF_SERVERPORT:-236} +KCCONF_SERVERPORT=${KCCONF_SERVERPORT:-237} ADDITIONAL_KOPANO_PACKAGES=${ADDITIONAL_KOPANO_PACKAGES:-""} ADDITIONAL_KOPANO_WEBAPP_PLUGINS=${ADDITIONAL_KOPANO_WEBAPP_PLUGINS:-""} @@ -10,8 +10,8 @@ set -eu # unset variables are errors & non-zero return values exit the whole scr ADDITIONAL_KOPANO_PACKAGES="$ADDITIONAL_KOPANO_PACKAGES $ADDITIONAL_KOPANO_WEBAPP_PLUGINS" -[ ! -z "$ADDITIONAL_KOPANO_PACKAGES" ] && apt update -[ ! -z "$ADDITIONAL_KOPANO_PACKAGES" ] && for installpkg in "$ADDITIONAL_KOPANO_PACKAGES"; do +[ ! -z ${ADDITIONAL_KOPANO_PACKAGES// } ] && apt update +[ ! -z ${ADDITIONAL_KOPANO_PACKAGES// } ] && for installpkg in "$ADDITIONAL_KOPANO_PACKAGES"; do if [ $(dpkg-query -W -f='${Status}' $installpkg 2>/dev/null | grep -c "ok installed") -eq 0 ]; then apt --assume-yes install $installpkg; fi