1
0
mirror of https://github.com/zokradonh/kopano-docker.git synced 2026-08-11 16:32:59 +00:00

Add container for kapps (which includes the new calendar) (#397)

* Add container for kapps (which includes the new calendar)
* remove calendar.yml
This commit is contained in:
Felix Bartels
2020-05-26 12:10:59 +02:00
committed by GitHub
parent e583247a58
commit 4e2060e491
16 changed files with 224 additions and 37 deletions
+63
View File
@@ -0,0 +1,63 @@
ARG docker_repo=zokradonh
FROM ${docker_repo}/kopano_base:latest
ARG ADDITIONAL_KOPANO_PACKAGES=""
ARG DOWNLOAD_COMMUNITY_PACKAGES=1
ARG KOPANO_REPOSITORY_FLAGS="trusted=yes"
ARG RELEASE_KEY_DOWNLOAD=0
ARG DEBIAN_FRONTEND=noninteractive
ARG KOPANO_CORE_REPOSITORY_URL="file:/kopano/repo/core"
ARG KOPANO_CORE_VERSION=newest
ARG KOPANO_KAPPS_REPOSITORY_URL="file:/kopano/repo/kapps"
ARG KOPANO_KAPPS_VERSION=newest
ENV KOPANO_KAPPS_VERSION=$KOPANO_KAPPS_VERSION
ENV \
ADDITIONAL_KOPANO_PACKAGES=$ADDITIONAL_KOPANO_PACKAGES \
DOWNLOAD_COMMUNITY_PACKAGES=$DOWNLOAD_COMMUNITY_PACKAGES \
KOPANO_CORE_REPOSITORY_URL=$KOPANO_CORE_REPOSITORY_URL \
KOPANO_CORE_VERSION=$KOPANO_CORE_VERSION \
KOPANO_REPOSITORY_FLAGS=$KOPANO_REPOSITORY_FLAGS \
RELEASE_KEY_DOWNLOAD=$RELEASE_KEY_DOWNLOAD
LABEL maintainer=az@zok.xyz \
org.label-schema.name="Kopano apps container" \
org.label-schema.description="Container for running Kopano Apps" \
org.label-schema.url="https://kopano.io" \
org.label-schema.vcs-url="https://github.com/zokradonh/kopano-docker" \
org.label-schema.version=$KOPANO_KAPPS_VERSION \
org.label-schema.schema-version="1.0"
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# install Kopano Core and refresh ca-certificates
RUN \
# community download and package as apt source repository
. /kopano/helper/create-kopano-repo.sh && \
if [ ${DOWNLOAD_COMMUNITY_PACKAGES} -eq 1 ]; then \
dl_and_package_community "kapps"; \
fi; \
echo "deb [${KOPANO_REPOSITORY_FLAGS}] ${KOPANO_KAPPS_REPOSITORY_URL} ./" > /etc/apt/sources.list.d/kopano.list; \
# install
apt-get update && \
# TODO mime-support could be remove once its an official dependency of kopano-kwebd
apt-get install --no-install-recommends -y \
mime-support \
kopano-kwebd \
kopano-calendar \
${ADDITIONAL_KOPANO_PACKAGES} \
&& \
rm -rf /var/cache/apt /var/lib/apt/lists && \
# make configuration a symlink to prevent overwriting it
# TODO better would be to override its configuration in kweb.cfg
ln -s /tmp/calendar.json /usr/share/kopano-kweb/www/config/kopano/calendar.json
COPY start-service.sh /kopano/
COPY goss.yaml /goss/
CMD [ "/kopano/start-service.sh" ]
HEALTHCHECK --interval=1m --timeout=10s \
CMD goss -g /goss/goss.yaml validate
ARG VCS_REF
LABEL org.label-schema.vcs-ref=$VCS_REF
+1
View File
@@ -0,0 +1 @@
# This is for the moment only for testing purposes
+18
View File
@@ -0,0 +1,18 @@
file:
/tmp/calendar.json:
exists: true
mode: "0644"
owner: root
group: root
filetype: file
contains: []
process:
kwebd:
running: true
http:
http://localhost:9080/calendar:
status: 200
allow-insecure: false
no-follow-redirects: false
timeout: 5000
body: []
+78
View File
@@ -0,0 +1,78 @@
#!/bin/bash
ADDITIONAL_KOPANO_PACKAGES=${ADDITIONAL_KOPANO_PACKAGES:-""}
set -eu # unset variables are errors & non-zero return values exit the whole script
[ "$DEBUG" ] && set -x
# copy configuration files to /tmp/kopano to prevent modification of mounted config files
mkdir -p /tmp/kopano
cp /etc/kopano/*.cfg /tmp/kopano
echo "Applying cfg changes from env"
/usr/bin/python3 /kopano/cfg-from-env.py
meetversion=$(dpkg-query --showformat='${Version}' --show kopano-calendar-webapp)
echo "Using Kopano Calendar: $meetversion"
# allow helper commands given by "docker-compose run"
if [ $# -gt 0 ]; then
exec "$@"
exit
fi
cp /usr/share/doc/kopano-calendar-webapp/config.json.in /tmp/calendar.json
CONFIG_JSON="/tmp/calendar.json"
# TODO move into extra file to make it easier to reuse
echo "Updating $CONFIG_JSON"
for setting in $(compgen -A variable KCCONF_CALENDAR); do
setting2=${setting#KCCONF_CALENDAR_}
# dots in setting2 need to be escaped to not be handled as separate entities in the json file
case ${!setting} in
true|TRUE|false|FALSE|[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])
jq ".\"${setting2//_/\".\"}\" = ${!setting}" $CONFIG_JSON | sponge $CONFIG_JSON
;;
*)
jq ".\"${setting2//_/\".\"}\" = \"${!setting}\"" $CONFIG_JSON | sponge $CONFIG_JSON
;;
esac
done
# Populate app grid
# TODO move into extra file to make it easier to reuse
# Note: if all of below variables are set to "no" kpop will fall back to its default behaviour and show all known apps.
# enable Kopano Konnect in the app grid
if [ "${GRID_KONNECT:-yes}" = "yes" ]; then
jq '.apps.enabled += ["kopano-konnect"]' $CONFIG_JSON | sponge $CONFIG_JSON
fi
# enable Kopano Meet in the app grid
if [ "${GRID_MEET:-yes}" = "yes" ]; then
jq '.apps.enabled += ["kopano-meet"]' $CONFIG_JSON | sponge $CONFIG_JSON
fi
# enable Kopano WebApp in the app grid
if [ "${GRID_WEBAPP:-yes}" = "yes" ]; then
jq '.apps.enabled += ["kopano-webapp"]' $CONFIG_JSON | sponge $CONFIG_JSON
fi
# enable Kopano WebApp in the app grid
if [ "${GRID_CALENDAR:-yes}" = "yes" ]; then
jq '.apps.enabled += ["kopano-calendar"]' $CONFIG_JSON | sponge $CONFIG_JSON
fi
sed s/\ *=\ */=/g /tmp/kopano/kwebd.cfg > /tmp/kweb-env
# always disable tls
export tls=no
# shellcheck disable=SC2046
export $(grep -v '^#' /tmp/kweb-env | xargs -d '\n')
# services need to be aware of the machine-id
dockerize \
-wait file:///etc/machine-id \
-wait file:///var/lib/dbus/machine-id
# cleaning up env variables
unset "${!KCCONF_@}"
exec kopano-kwebd serve