diff --git a/core/Dockerfile b/core/Dockerfile index 2afed06..75b57fb 100644 --- a/core/Dockerfile +++ b/core/Dockerfile @@ -47,7 +47,7 @@ RUN --mount=type=secret,id=repocred,target=/etc/apt/auth.conf.d/kopano.conf \ apt-get update && \ set -x && \ apt-get -o Debug::pkgProblemResolver=true install --no-install-recommends -y \ - kopano-server-packages \ + kopano-server-packages kopano-spamd \ ${ADDITIONAL_KOPANO_PACKAGES} \ && \ coreversion=$(dpkg-query --showformat='${Version}' --show kopano-server) && \ diff --git a/core/defaultconfigs/spamd.py b/core/defaultconfigs/spamd.py new file mode 100755 index 0000000..413b7e6 --- /dev/null +++ b/core/defaultconfigs/spamd.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import os +import kcconf + +# Component specific configurations +kcconf.configkopano({ + r"/tmp/kopano/spamd.cfg": + { + # Certain configuration can be pre-defined at startup: + #'log_level': "3" + } +}) + +# Override configs from environment variables +kcconf.configkopano(kcconf.parseenvironmentvariables(r"/tmp/kopano/")) \ No newline at end of file diff --git a/core/goss/spamd/goss.yaml b/core/goss/spamd/goss.yaml new file mode 100644 index 0000000..c03e70f --- /dev/null +++ b/core/goss/spamd/goss.yaml @@ -0,0 +1,3 @@ +process: + kopano-spamd: + running: true \ No newline at end of file diff --git a/core/goss/spamd/goss_wait.yaml b/core/goss/spamd/goss_wait.yaml new file mode 100644 index 0000000..c03e70f --- /dev/null +++ b/core/goss/spamd/goss_wait.yaml @@ -0,0 +1,3 @@ +process: + kopano-spamd: + running: true \ No newline at end of file diff --git a/core/start-service.sh b/core/start-service.sh index b216802..d8a771a 100755 --- a/core/start-service.sh +++ b/core/start-service.sh @@ -104,6 +104,9 @@ search) server) EXE="${EXE:-$(command -v kopano-server)}" ;; +spamd) + EXE="${EXE:-$(command -v kopano-spamd)}" + ;; spooler) EXE="${EXE:-$(command -v kopano-spooler)}" KOPANO_CON="$KCCONF_SPOOLER_SERVER_SOCKET" @@ -246,6 +249,14 @@ search) exec /usr/bin/python3 "$EXE" --config /tmp/kopano/search.cfg -F fi ;; +spamd) + dockerize \ + -wait "$KOPANO_CON" \ + -timeout 360s + # cleaning up env variables + unset "${!KCCONF_@}" + exec "$EXE" --config /tmp/kopano/spamd.cfg -F + ;; spooler) dockerize \ -wait "$KOPANO_CON" \ diff --git a/docker-compose.yml b/docker-compose.yml index fe29596..49d761a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -524,6 +524,30 @@ services: tmpfs: - /tmp + kopano_spamd: + image: ${docker_repo:-zokradonh}/kopano_core:${CORE_VERSION:-latest} + read_only: true + restart: unless-stopped + container_name: ${COMPOSE_PROJECT_NAME}_spamd + depends_on: + - kopano_server + volumes: + - /etc/machine-id:/etc/machine-id + - /var/lib/dbus/machine-id:/var/lib/dbus/machine-id + - kopanosocket/:/run/kopano + - kopanossl/:/kopano/ssl + - kopanospamd/:/var/lib/kopano/spamd + environment: + - SERVICE_TO_START=spamd + - TZ=${TZ} + env_file: + - kopano_spamd.env + networks: + - kopano-net + tmpfs: + - /tmp + + volumes: kdavstates: kopanodata: @@ -534,6 +558,7 @@ volumes: kopanowebapp: web: zpushstates: + kopanospamd: networks: kopano-net: diff --git a/setup.sh b/setup.sh index ea43a5a..05ce146 100755 --- a/setup.sh +++ b/setup.sh @@ -41,7 +41,7 @@ if [ ! -e /etc/machine-id ]; then fi echo "Creating individual env files for containers (if they do not exist already)" -for dockerenv in ldap password-self-service mail db kopano_ssl kopano_server kopano_webapp kopano_zpush kopano_grapi kopano_kapi kopano_dagent kopano_spooler kopano_gateway kopano_ical kopano_monitor kopano_scheduler kopano_search kopano_konnect kopano_kwmbridge kopano_kwmserver kopano_meet kopano_kapps; do +for dockerenv in ldap password-self-service mail db kopano_ssl kopano_server kopano_webapp kopano_zpush kopano_grapi kopano_kapi kopano_dagent kopano_spooler kopano_gateway kopano_ical kopano_monitor kopano_scheduler kopano_search kopano_konnect kopano_kwmbridge kopano_kwmserver kopano_meet kopano_kapps kopano_spamd; do touch ./"$dockerenv".env done diff --git a/version.sh b/version.sh index fd7eac9..db7126f 100755 --- a/version.sh +++ b/version.sh @@ -41,7 +41,7 @@ case $component in core) KOPANO_CORE_REPOSITORY_URL=${KOPANO_CORE_REPOSITORY_URL:-""} if [[ $KOPANO_CORE_REPOSITORY_URL == http* ]]; then - version=$(curl -m 1 -s -S -L "$KOPANO_CORE_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-server-packages") + version=$(curl --netrc-file ./apt_auth.conf --netrc-optional -m 1 -s -S -L "$KOPANO_CORE_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-server-packages") echo "${version##* }" exit fi @@ -49,7 +49,7 @@ core) webapp) KOPANO_WEBAPP_REPOSITORY_URL=${KOPANO_WEBAPP_REPOSITORY_URL:-""} if [[ $KOPANO_WEBAPP_REPOSITORY_URL == http* ]]; then - version=$(curl -m 1 -s -S -L "$KOPANO_WEBAPP_REPOSITORY_URL"/Packages | grep -m1 -A1 "Package: kopano-webapp") + version=$(curl --netrc-file ./apt_auth.conf --netrc-optional -m 1 -s -S -L "$KOPANO_WEBAPP_REPOSITORY_URL"/Packages | grep -m1 -A1 "Package: kopano-webapp") echo "${version##* }" exit fi @@ -65,7 +65,7 @@ zpush) meet) KOPANO_MEET_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then - version=$(curl -m 1 -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") + version=$(curl --netrc-file ./apt_auth.conf --netrc-optional -m 1 -s -S -L "$KOPANO_MEET_REPOSITORY_URL"/Packages | grep -A2 "Package: kopano-meet-packages") echo "${version##* }" exit fi @@ -87,4 +87,4 @@ if [ ${#versiontemp} -lt 2 ]; then exit 1 fi -echo "$currentVersion" \ No newline at end of file +echo "$currentVersion" diff --git a/zpush/Dockerfile b/zpush/Dockerfile index 61a37e0..3c1ef82 100644 --- a/zpush/Dockerfile +++ b/zpush/Dockerfile @@ -34,7 +34,9 @@ VOLUME /var/lib/z-push/ SHELL ["/bin/bash", "-o", "pipefail", "-c"] # install Z-Push -RUN \ +# hadolint currently does not understand the extended buildkit syntax https://github.com/hadolint/hadolint/issues/347 +# hadolint ignore=SC2215,DL3015 +RUN --mount=type=secret,id=repocred,target=/etc/apt/auth.conf.d/kopano.conf \ # prepare z-push installation echo "deb ${KOPANO_ZPUSH_REPOSITORY_URL} /" > /etc/apt/sources.list.d/zpush.list && \ # this is the same key as for the rest of the Kopano stack, making a separate download anyways as this may not be the case in the future