1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 16:06:14 +00:00

Kopano spamd, Bugfixes (#17)

* Add container for kopano-spamd
* Authenticate version requests if needed
* Fix building of z-push for 'supported' base image
* Install kopano-spamd package by default
* Smaller fixes for kopano-spamd
* Fix missing file header
* simplify netrc usage
This commit is contained in:
h44z 2020-08-24 15:24:04 +02:00 committed by GitHub
parent 62e175b3ff
commit 3d7ff97aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 66 additions and 7 deletions

View File

@ -47,7 +47,7 @@ RUN --mount=type=secret,id=repocred,target=/etc/apt/auth.conf.d/kopano.conf \
apt-get update && \ apt-get update && \
set -x && \ set -x && \
apt-get -o Debug::pkgProblemResolver=true install --no-install-recommends -y \ apt-get -o Debug::pkgProblemResolver=true install --no-install-recommends -y \
kopano-server-packages \ kopano-server-packages kopano-spamd \
${ADDITIONAL_KOPANO_PACKAGES} \ ${ADDITIONAL_KOPANO_PACKAGES} \
&& \ && \
coreversion=$(dpkg-query --showformat='${Version}' --show kopano-server) && \ coreversion=$(dpkg-query --showformat='${Version}' --show kopano-server) && \

15
core/defaultconfigs/spamd.py Executable file
View File

@ -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/"))

View File

@ -0,0 +1,3 @@
process:
kopano-spamd:
running: true

View File

@ -0,0 +1,3 @@
process:
kopano-spamd:
running: true

View File

@ -104,6 +104,9 @@ search)
server) server)
EXE="${EXE:-$(command -v kopano-server)}" EXE="${EXE:-$(command -v kopano-server)}"
;; ;;
spamd)
EXE="${EXE:-$(command -v kopano-spamd)}"
;;
spooler) spooler)
EXE="${EXE:-$(command -v kopano-spooler)}" EXE="${EXE:-$(command -v kopano-spooler)}"
KOPANO_CON="$KCCONF_SPOOLER_SERVER_SOCKET" KOPANO_CON="$KCCONF_SPOOLER_SERVER_SOCKET"
@ -246,6 +249,14 @@ search)
exec /usr/bin/python3 "$EXE" --config /tmp/kopano/search.cfg -F exec /usr/bin/python3 "$EXE" --config /tmp/kopano/search.cfg -F
fi fi
;; ;;
spamd)
dockerize \
-wait "$KOPANO_CON" \
-timeout 360s
# cleaning up env variables
unset "${!KCCONF_@}"
exec "$EXE" --config /tmp/kopano/spamd.cfg -F
;;
spooler) spooler)
dockerize \ dockerize \
-wait "$KOPANO_CON" \ -wait "$KOPANO_CON" \

View File

@ -524,6 +524,30 @@ services:
tmpfs: tmpfs:
- /tmp - /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: volumes:
kdavstates: kdavstates:
kopanodata: kopanodata:
@ -534,6 +558,7 @@ volumes:
kopanowebapp: kopanowebapp:
web: web:
zpushstates: zpushstates:
kopanospamd:
networks: networks:
kopano-net: kopano-net:

View File

@ -41,7 +41,7 @@ if [ ! -e /etc/machine-id ]; then
fi fi
echo "Creating individual env files for containers (if they do not exist already)" 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 touch ./"$dockerenv".env
done done

View File

@ -41,7 +41,7 @@ case $component in
core) core)
KOPANO_CORE_REPOSITORY_URL=${KOPANO_CORE_REPOSITORY_URL:-""} KOPANO_CORE_REPOSITORY_URL=${KOPANO_CORE_REPOSITORY_URL:-""}
if [[ $KOPANO_CORE_REPOSITORY_URL == http* ]]; then 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##* }" echo "${version##* }"
exit exit
fi fi
@ -49,7 +49,7 @@ core)
webapp) webapp)
KOPANO_WEBAPP_REPOSITORY_URL=${KOPANO_WEBAPP_REPOSITORY_URL:-""} KOPANO_WEBAPP_REPOSITORY_URL=${KOPANO_WEBAPP_REPOSITORY_URL:-""}
if [[ $KOPANO_WEBAPP_REPOSITORY_URL == http* ]]; then 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##* }" echo "${version##* }"
exit exit
fi fi
@ -65,7 +65,7 @@ zpush)
meet) meet)
KOPANO_MEET_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""} KOPANO_MEET_REPOSITORY_URL=${KOPANO_MEET_REPOSITORY_URL:-""}
if [[ $KOPANO_MEET_REPOSITORY_URL == http* ]]; then 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##* }" echo "${version##* }"
exit exit
fi fi

View File

@ -34,7 +34,9 @@ VOLUME /var/lib/z-push/
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install Z-Push # 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 # prepare z-push installation
echo "deb ${KOPANO_ZPUSH_REPOSITORY_URL} /" > /etc/apt/sources.list.d/zpush.list && \ 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 # 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