From f82c64cd477e65a9622c75e79e591f3ec99d3dc4 Mon Sep 17 00:00:00 2001 From: mlan Date: Wed, 30 Dec 2020 10:09:10 +0100 Subject: [PATCH] =?UTF-8?q?-=20[docker](src/docker/bin/docker-config.sh)?= =?UTF-8?q?=20Allow=20the=20crontab=20support=20to=20work=20also=20when=20?= =?UTF-8?q?the=20file=20`/etc/kopano/docker-crontab`=C2=A0is=20missing.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 6 +++++- README.md | 14 ++++++++------ demo/Makefile | 2 +- src/docker/bin/docker-config.sh | 2 +- src/docker/config/docker-crontab | 6 +++--- test/Makefile | 6 ++++++ 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f242106..64e6122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.2.6 + +- [docker](src/docker/bin/docker-config.sh) Allow the crontab support to work also when the file `/etc/kopano/docker-crontab` is missing. + # 1.2.5 - [docker](Dockerfile) Install the [kopano archiver](https://documentation.kopano.io/kopano_archiver_manual/) in target `core`. @@ -92,7 +96,7 @@ - Added support of the environment variable `LMTP_LISTEN=*:2003`, due to misconfiguration of `kopano-dagent` in recent releases (8.7.84). - Simplified the health check. - Changed repository directory structure to a more general one. -- Renamed some build variables, e.g., `DOCKER_RUNSV_DIR` (was `docker_build_runit_root`). +- Renamed some build variables, e.g., `DOCKER_RUNSV_DIR` (was `docker_build_runit_root`). - Cleaning up `Makefile` - Added more debug functionality in `demo/Makefile` diff --git a/README.md b/README.md index df9bd33..2ffd494 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Hopefully this repository can be retired once the Kopano community make official - Configuration using environment variables - Log directed to docker daemon with configurable level - Built in utility script [run](src/docker/bin/run) helping configuring Kopano components, WebApp and Z-Push -- [crontab](https://en.wikipedia.org/wiki/Cron) support. +- [Crontab](https://en.wikipedia.org/wiki/Cron) support. - Health check - Hook for theming - Demo based on `docker-compose.yml` and `Makefile` files @@ -308,7 +308,7 @@ Hint: Use the `kopanoAccount` attribute in the filter to differentiate between n #### `LDAP_BIND_USER`, `LDAP_BIND_PASSWD` -The defaults for these environment variables are empty. If you cannot bind anonymously, do it with this distinguished name and password. Example: LDAP_BIND_USER=uid=admin,dc=example,dc=com, LDAP_BIND_PASSWD=secret. +The defaults for these environment variables are empty. If you cannot bind anonymously, do it with this distinguished name and password. Example: LDAP_BIND_USER=cn=admin,dc=example,dc=com, LDAP_BIND_PASSWD=secret. ### Kopano LDAP attributes `LDAP_PROPMAP` @@ -438,12 +438,14 @@ make app-create_smime The [Mobile Device Management](https://documentation.kopano.io/webapp_mdm_manual/) WebApp plugin comes pre-installed. With it you can resync, remove, refresh and even wipe your devices, connected via [Exchange ActiveSync (EAS)](https://en.wikipedia.org/wiki/Exchange_ActiveSync). -## Cron +## Crontab -The `mlan/kopano` has a [cron](https://en.wikipedia.org/wiki/Cron) service activated. You can use environment variables to set up _crontab_ entries. Any environment variable name staring with `CRONTAB_ENTRY` will be use to add entries to cron. +The `mlan/kopano` has a [cron](https://en.wikipedia.org/wiki/Cron) service activated. You can use environment variables to set up [crontab](https://man7.org/linux/man-pages/man5/crontab.5.html) entries. Any environment variable name staring with `CRONTAB_ENTRY` will be use to add entries to cron. One trivial example is `CRONTAB_ENTRY_TEST=* * * * * root logger -t cron -p user.notice "SHELL=$$SHELL, PATH=$$PATH"`. +During the initial configuration procedure any `CRONTAB_ENTRY` will add crontab entries to the file `/etc/kopano/docker-crontab`, all the while previously present entries are deleted. This file defines the `PATH` variable so that you don't need to give full path names to commands in the crontab entry. This is, you need to provide the full path names to commands if this `PATH` definition is missing in the `/etc/kopano/docker-crontab` file. + ## Mail transfer agent interaction Environment variables can be used to configure where Kopano find the Mail Transfer Agent, such as Postfix. Likewise the Mail Transfer Agent need to know where to forward emails to. @@ -485,9 +487,9 @@ Sometimes a new version of Kopano breaks compatibility with old configurations. Prior to Kopano WebApp version 5.0.0 the parameter was `define("INSECURE_COOKIES", true);` was used to allow HTTP access. Now [`define("SECURE_COOKIES", false);`](https://documentation.kopano.io/webapp_admin_manual/config.html#secure-cookies) is used instead. This fix tries to update the configuration accordingly. -### `MIGRATE_CONFIG=2` Make sure WebApp plugins have configuration files in place +### `MIGRATE_CONFIG=2` Make sure WebApp plugins have configuration files in place -The WebApp plugins S/MIME and MDM has recently been added to the `mlan/kopano` image. Old deployments might not have the related configuration files in place, preventing these plugins from running. This fix places default copies of configuration files in the configuration directory should they be missing. +The WebApp plugins S/MIME and MDM has recently been added to the `mlan/kopano` image. Old deployments might not have the related configuration files in place, preventing these plugins from running. This fix places default copies of configuration files in the configuration directory should they be missing. # Knowledge base diff --git a/demo/Makefile b/demo/Makefile index 4079724..c11a604 100644 --- a/demo/Makefile +++ b/demo/Makefile @@ -257,7 +257,7 @@ app-init: #wait_21 app-public_store app-debugtools: docker-compose exec app apt-get update docker-compose exec app apt-get install --yes \ - less nano ldap-utils htop net-tools lsof iputils-ping strace + less nano ldap-utils htop net-tools lsof iputils-ping dnsutils strace app-htop: app-debugtools docker-compose exec app htop diff --git a/src/docker/bin/docker-config.sh b/src/docker/bin/docker-config.sh index 860aea5..367b890 100644 --- a/src/docker/bin/docker-config.sh +++ b/src/docker/bin/docker-config.sh @@ -240,7 +240,7 @@ dc_prune_pidfiles() { dc_crontab_entries() { local entries="$(eval echo \${!$DOCKER_CRONTAB_ENV*})" for entry in $entries; do - [ -z "${changed+x}" ] && local changed= && sed -i '/^#$/q' $DOCKER_CRONTAB_FILE + [ -z "${changed+x}" ] && local changed= && sed -i '/^\s*[0-9*]/d' $DOCKER_CRONTAB_FILE echo "${!entry}" >> $DOCKER_CRONTAB_FILE dc_log 5 "Added entry ${!entry} in $DOCKER_CRONTAB_FILE" done diff --git a/src/docker/config/docker-crontab b/src/docker/config/docker-crontab index 2d30738..d0423c0 100644 --- a/src/docker/config/docker-crontab +++ b/src/docker/config/docker-crontab @@ -2,6 +2,6 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin -# During initialization CRONTAB_ENTRY envvars will overwrite everything after -# the first line with a single #. Don't change the next line. -# +# During initialization CRONTAB_ENTRY envvars will overwrite all cron commands +# in this file. Cron commands start with * or digits with optional white space. + diff --git a/test/Makefile b/test/Makefile index d3093ad..bd9dc62 100644 --- a/test/Makefile +++ b/test/Makefile @@ -125,6 +125,7 @@ test-pull: $(addprefix docker pull ,$(CURL_IMG); $(AUT_IMG); $(DB_IMG)) test-up_0: test-up-net + # # # # test (0) run without envvars (is there smoke?) @@ -147,8 +148,10 @@ test-up_0: test-up-net # test (0) successful # # + # test-up_1: test-up-net test-up-auth_1 + # # # # test (1) ldap auth, sql db, and mail send recv @@ -163,6 +166,7 @@ test-up_1: test-up-net test-up-auth_1 docker run -d $(APP_ENV) $(APP_VOL) $(IMG_REPO):$(call _ver,$(IMG_VER),core) test-up_2: test-up-net test-up-auth_2 $(TST_CERT) + # # # # test (2) ldap auth, sql db, mail send recv secure using pem cert files @@ -177,6 +181,7 @@ test-up_2: test-up-net test-up-auth_2 $(TST_CERT) docker run -d $(APPF_ENV) $(APP_VOL) $(IMG_REPO):$(call _ver,$(IMG_VER),core) test-up_3: test-up-net test-up-auth_3 $(TST_ACME) + # # # # test (3) ldap auth, sql db, mail send recv secure using acme cert @@ -201,6 +206,7 @@ test-service_%: test-pop3_% test-imap_% test-http_% # test ($*) successful # # + # test-logs_%: -docker ps -a