Skip to content

Commit

Permalink
docker: standalone grafana container with dashboards code inside
Browse files Browse the repository at this point in the history
  • Loading branch information
asaezper committed Jun 14, 2024
1 parent 2aa832a commit bae786c
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 5 deletions.
46 changes: 46 additions & 0 deletions .gitlab/ci/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,27 @@ metrics tox:
changes:
- docker/metrics_server/**/*

grafana version changed:
extends: .version_changed_pyproject
stage: static
rules:
- if: $ON_MR
changes:
- docker/grafana/**/*
script:
- NEW_VERSION=$(cat docker/grafana/version.yml | grep SRS_GRAFANA_VERSION | cut -d'"' -f2)
- export NEW_VERSION
- |
git checkout $CI_MERGE_REQUEST_DIFF_BASE_SHA
if [ ! -e "docker/grafana/version.yml" ]; then
exit 0
fi
- OLD_VERSION=$(cat docker/grafana/version.yml | grep SRS_GRAFANA_VERSION | cut -d'"' -f2)
- export OLD_VERSION
- |
echo "OLD version: $OLD_VERSION -- NEW version: $NEW_VERSION"
- python3 -c "import semver; import os; exit(0) if (semver.compare(os.environ['NEW_VERSION'], os.environ['OLD_VERSION']) > 0) else exit(1)"

metrics version changed:
extends: .version_changed_pyproject
stage: static
Expand Down Expand Up @@ -187,3 +208,28 @@ metrics server image latest:
before_script:
- |
export VERSION=latest
grafana server image:
extends: .docker-builder
stage: publish
rules:
- if: $ON_MR
changes:
paths:
- docker/grafana/**/*
variables:
REGISTRY_URI: $GITLAB_REGISTRY_URI
NAME: grafana
CONTEXT: ${CI_PROJECT_DIR}/docker/grafana
MODE: publish
before_script:
- |
export VERSION=$(cat docker/grafana/version.yml | grep SRS_GRAFANA_VERSION | cut -d'"' -f2)
grafana server image latest:
extends: grafana server image
variables:
OVERWRITE: "true"
before_script:
- |
export VERSION=latest
1 change: 0 additions & 1 deletion docker/.env
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ INFLUXD_LOG_LEVEL=error

## Grafana

GRAFANA_VERSION=10.1.5
GRAFANA_PORT=3000

GF_AUTH_ANONYMOUS_ENABLED=true
Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ services:

grafana:
container_name: grafana
image: grafana/grafana-oss:${GRAFANA_VERSION}
image: srsran/grafana
build:
context: grafana
volumes:
- grafana-storage:/var/lib/grafana:rw
- ./grafana/provisioning:/etc/grafana/provisioning
- ./grafana/dashboards:/etc/dashboards
env_file:
- .env
depends_on:
Expand Down
13 changes: 13 additions & 0 deletions docker/grafana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright 2021-2024 Software Radio Systems Limited
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the distribution.
#

ARG GRAFANA_VERSION=10.1.5
FROM grafana/grafana-oss:${GRAFANA_VERSION}

ADD provisioning /etc/grafana/provisioning
ADD dashboards /etc/dashboards
2 changes: 1 addition & 1 deletion docker/grafana/dashboards/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"refId": "Downlink"
}
],
"title": "Num Cells",
"title": "Num Cells with Active UEs",
"transformations": [
{
"id": "renameByRegex",
Expand Down
9 changes: 9 additions & 0 deletions docker/grafana/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright 2021-2024 Software Radio Systems Limited
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the distribution.
#

SRS_GRAFANA_VERSION: "1.0.0"

0 comments on commit bae786c

Please sign in to comment.