1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-06 15:36:40 +00:00

More tests (#240)

* add goss healthcheck to meet
* add goss healthcheck to scheduler
* enhance goss tests for webapp
* add meet and scheduler to make target for goss
* fix healtcheck for webapp

will report 200, but also cause an error because of it being requested over plain
have dedicated url for check
* disable stats reporting in build
* update commander
This commit is contained in:
Felix Bartels 2019-09-15 18:01:09 +02:00 committed by GitHub
parent 00b15becfd
commit b273c87cb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 94 additions and 7 deletions

View File

@ -11,7 +11,7 @@ env:
- DOCKER_COMPOSE_VERSION=1.23.2
- TRIVY_VERSION=0.1.1
- GOSS_VERSION=0.3.7
- COMMANDER_VERSION=1.2.0
- COMMANDER_VERSION=1.2.1
services:
- docker
before_install:
@ -40,6 +40,9 @@ install:
- make lint # rerun lint to see if output is different with .env in place
- echo "docker_repo=$docker_repo" >> .env
- echo "DOCKERREADME=yes" >> .env # add DOCKERREADME env var so that make publish also updates readme files on docker hub
- echo "KCCONF_SERVER_SURVEYCLIENT_INTERVAL=0" >> kopano_server.env
- echo "KOPANO_SURVEYCLIENT_ENABLED=false" >> kopano_konnect.env
- echo "KOPANO_SURVEYCLIENT_ENABLED=false" >> kopano_kwmserver.env
- travis_retry make build-all
script:
- make test-ci

View File

@ -381,6 +381,8 @@ test-goss: ## Test configuration of containers with goss
GOSS_FILES_PATH=core/goss/monitor dcgoss run kopano_monitor
GOSS_FILES_PATH=core/goss/search dcgoss run kopano_search
GOSS_FILES_PATH=core/goss/spooler dcgoss run kopano_spooler
GOSS_FILES_PATH=meet dcgoss run kopano_meet
GOSS_FILES_PATH=scheduler dcgoss run kopano_scheduler
GOSS_FILES_PATH=webapp dcgoss run kopano_webapp
test-commander: ## Test scripts with commander

View File

@ -57,4 +57,9 @@ ENV KOPANO_USERSCRIPT_LOCALE="de_DE.UTF-8"
ENV LANG=en_US.UTF-8
COPY defaultconfigs/ 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 --format json_oneline

18
meet/goss.yaml Normal file
View File

@ -0,0 +1,18 @@
file:
/usr/share/kopano-kweb/www/config/kopano/meet.json:
exists: true
mode: "0644"
owner: root
group: root
filetype: file
contains: []
process:
kwebd:
running: true
http:
http://localhost:9080/meet:
status: 200
allow-insecure: false
no-follow-redirects: false
timeout: 5000
body: []

View File

@ -1,6 +1,10 @@
:9080 {
log stdout
errors stderr
# healthcheck
status 200 /status
alias /webapp/ /usr/share/kopano-webapp/
fastcgi2 /webapp/ /run/php/php7.0-fpm.sock php {
without /webapp/

View File

@ -4,6 +4,7 @@ ARG VCS_REF
ENV \
DOCKERIZE_VERSION=v0.6.1 \
GOSS_VERSION=v0.3.7 \
SUPERCRONIC_VERSION=0.1.9
LABEL maintainer=az@zok.xyz \
@ -15,16 +16,30 @@ LABEL maintainer=az@zok.xyz \
org.label-schema.version=$SUPERCRONIC_VERSION \
org.label-schema.schema-version="1.0"
RUN apk --no-cache add bash
RUN wget https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-amd64 \
-O /usr/local/bin/supercronic \
&& chmod +x /usr/local/bin/supercronic
RUN apk --no-cache add bash curl ca-certificates
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN wget https://github.com/aelsabbahy/goss/releases/download/$GOSS_VERSION/goss-linux-amd64 -O /usr/local/bin/goss \
&& chmod +x /usr/local/bin/goss \
&& goss --version
RUN wget https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-amd64 \
-O /usr/local/bin/supercronic \
&& chmod +x /usr/local/bin/supercronic
# Setup timezone
ENV TZ=UTC
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime
RUN printf '%s\n' "$TZ" > /etc/timezone
COPY start.sh /usr/local/bin/
COPY goss.yaml /goss/
CMD ["start.sh"]
# TODO interval does not only define how often the healtcheck is run, but also how long to wait for the first check after startup
HEALTHCHECK --interval=60m --timeout=15s \
CMD goss -g /goss/goss.yaml validate --format json_oneline

9
scheduler/goss.yaml Normal file
View File

@ -0,0 +1,9 @@
command:
kill -SIGUSR2 $(pidof supercronic):
exit-status: 0
stdout: []
stderr: []
timeout: 10000
process:
supercronic:
running: true

3
scheduler/goss_wait.yaml Normal file
View File

@ -0,0 +1,3 @@
process:
supercronic:
running: true

View File

@ -34,4 +34,5 @@ for cronvar in ${!CRON_*}; do
$croncommand
done
supercronic -test /etc/crontab
exec supercronic /etc/crontab

View File

@ -1,9 +1,36 @@
file:
/run/sessions:
exists: true
mode: "0755"
size: 4096
owner: www-data
group: www-data
filetype: directory
contains: []
/usr/lib/php/20151012/mapi.so:
exists: true
mode: "0644"
owner: root
group: root
filetype: file
contains: []
/var/lib/kopano-webapp/tmp:
exists: true
mode: "0755"
size: 4096
owner: www-data
group: www-data
filetype: directory
contains: []
process:
kwebd:
running: true
php-fpm7.0:
running: true
http:
http://localhost:9080/webapp:
http://localhost:9080/status:
status: 200
allow-insecure: false
no-follow-redirects: false
timeout: 5000
body: []