Skip to content
Snippets Groups Projects
Commit 5e1630d1 authored by Corné Lukken's avatar Corné Lukken
Browse files

L2SS-1544: Prevent Grafana permission issues and test for regression

parent 76954753
Branches
Tags
1 merge request!755L2SS-1544: Prevent Grafana permission issues and test for regression
...@@ -268,12 +268,12 @@ unit_test: ...@@ -268,12 +268,12 @@ unit_test:
- tangostationcontrol/cover/* - tangostationcontrol/cover/*
- tangostationcontrol/.coverage - tangostationcontrol/.coverage
integration_test_docker: .test_docker:
stage: integration-tests stage: integration-tests
image: docker:23.0.5 # latest ships with docker compose v2.19, which has the following bug: https://github.com/docker/compose/issues/10668 image: docker:23.0.5 # latest ships with docker compose v2.19, which has the following bug: https://github.com/docker/compose/issues/10668
needs: # needs:
- unit_test # - unit_test
- docker_build_image_device_base # - docker_build_image_device_base
tags: tags:
- privileged - privileged
services: services:
...@@ -294,7 +294,6 @@ integration_test_docker: ...@@ -294,7 +294,6 @@ integration_test_docker:
- apk add --update bind-tools - apk add --update bind-tools
- apk add --update postgresql14-client gzip - apk add --update postgresql14-client gzip
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- touch /root/.Xauthority - touch /root/.Xauthority
# Hack BASH_SOURCE into sourced files, docker its sh shell won't set this # Hack BASH_SOURCE into sourced files, docker its sh shell won't set this
- export BASH_SOURCE=$(pwd)/setup.sh - export BASH_SOURCE=$(pwd)/setup.sh
...@@ -306,9 +305,7 @@ integration_test_docker: ...@@ -306,9 +305,7 @@ integration_test_docker:
- unset TANGO_HOST - unset TANGO_HOST
# Do not remove 'bash' or statement will be ignored by primitive docker shell # Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag - bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh pull $tag
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- export TAG="$tag" - export TAG="$tag"
- bash -e $CI_PROJECT_DIR/sbin/run_integration_test.sh --no-build
after_script: after_script:
# Collect output of all containers # Collect output of all containers
- | - |
...@@ -325,10 +322,24 @@ integration_test_docker: ...@@ -325,10 +322,24 @@ integration_test_docker:
paths: paths:
- log/ - log/
integration_test_docker:
extends: .test_docker
script:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash -e $CI_PROJECT_DIR/sbin/run_integration_test.sh --no-build
service_test_docker:
extends: .test_docker
script:
# Fix logstash healthcheck
- export HOSTNAME=localhost
# Do not remove 'bash' or statement will be ignored by primitive docker shell
- bash -e $CI_PROJECT_DIR/sbin/run_service_test.sh
multi_project_integration_test: multi_project_integration_test:
stage: integration-tests stage: integration-tests
needs: # needs:
- docker_build_image_device_base # - docker_build_image_device_base
variables: variables:
TANGO_DEFAULT_BRANCH: $CI_DEFAULT_BRANCH TANGO_DEFAULT_BRANCH: $CI_DEFAULT_BRANCH
TANGO_CURRENT_BRANCH: $CI_COMMIT_BRANCH TANGO_CURRENT_BRANCH: $CI_COMMIT_BRANCH
......
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
version: '2.1' version: '2.1'
volumes:
grafana-database: {}
# grafana-configs: {}
services: services:
grafana: grafana:
image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/grafana:${TAG} image: ${LOCAL_DOCKER_REGISTRY_HOST}/${LOCAL_DOCKER_REGISTRY_USER}/grafana:${TAG}
...@@ -23,12 +19,19 @@ services: ...@@ -23,12 +19,19 @@ services:
networks: networks:
- control - control
volumes: volumes:
- grafana-database:/var/lib/grafana/database - grafana-database:/var/lib/grafana/database:rw
# - grafana-configs:/etc/grafana # - grafana-configs:/etc/grafana
ports: ports:
- "3000:3000" - "3000:3000"
environment: environment:
- GF_SERVER_DOMAIN=${HOSTNAME} - GF_SERVER_DOMAIN=${HOSTNAME}
healthcheck:
test: >
bash -c "printf 'GET /nc.1 HTTP/1.1\r\nHost: astron.nl\r\n\r\n' | nc localhost 3000"
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
logging: logging:
driver: syslog driver: syslog
options: options:
...@@ -36,3 +39,7 @@ services: ...@@ -36,3 +39,7 @@ services:
syslog-format: rfc3164 syslog-format: rfc3164
tag: "{{.Name}}" tag: "{{.Name}}"
restart: unless-stopped restart: unless-stopped
volumes:
grafana-database:
# grafana-configs:
FROM git.astron.nl:5000/lofar2.0/grafana-station-dashboards:latest FROM git.astron.nl:5000/lofar2.0/grafana-station-dashboards:latest
COPY stationcontrol-dashboards.yaml /etc/grafana/provisioning/dashboards/ COPY stationcontrol-dashboards.yaml /etc/grafana/provisioning/dashboards/
RUN mkdir -p /var/lib/grafana/database
RUN chown grafana -R /var/lib/grafana/database
...@@ -23,6 +23,13 @@ services: ...@@ -23,6 +23,13 @@ services:
options: options:
max-size: "100m" max-size: "100m"
max-file: "10" max-file: "10"
healthcheck:
test: >
sh -c "printf 'GET /nc.1 HTTP/1.1\r\nHost: astron.nl\r\n\r\n' | nc localhost 3100"
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
networks: networks:
- control - control
volumes: volumes:
......
...@@ -27,6 +27,13 @@ services: ...@@ -27,6 +27,13 @@ services:
- prometheus-data:/prometheus - prometheus-data:/prometheus
ports: ports:
- "9090:9090" - "9090:9090"
healthcheck:
test: >
sh -c "printf 'GET /nc.1 HTTP/1.1\r\nHost: astron.nl\r\n\r\n' | nc localhost 9090"
interval: 1m
timeout: 30s
retries: 3
start_period: 30s
logging: logging:
driver: syslog driver: syslog
options: options:
......
#!/bin/bash -e
#
# Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: Apache-2.0
#
if [ -z "$LOFAR20_DIR" ]; then
# We assume we aren't in the PATH, so we can derive our path.
# We need our parent directory.
LOFAR20_DIR_RELATIVE=$(dirname "$0")/..
# As an absolute path
LOFAR20_DIR=$(readlink -f "${LOFAR20_DIR_RELATIVE}")
fi
export TANGO_SKIP_BUILD=1
export NO_BASE=1
cd "$LOFAR20_DIR/docker-compose" || exit 1
make start grafana loki logstash prometheus
make await grafana loki logstash prometheus
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment