From 43dd0a5bec3886bc67ca79e6ff34ab680d74727d Mon Sep 17 00:00:00 2001 From: Manuel Kieweg <manuel.kieweg@h-da.de> Date: Fri, 20 Aug 2021 12:39:52 +0000 Subject: [PATCH] Compose stack --- .csbi.yaml | 3 +- cmd/root.go | 2 +- docker-compose.yml | 49 +++++++++++++++++++ .../datasources/prometheus_ds.yml | 6 +++ prometheus/alerts.yml | 8 +++ prometheus/prometheus.yml | 18 +++++++ 6 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 docker-compose.yml create mode 100644 grafana/provisioning/datasources/prometheus_ds.yml create mode 100644 prometheus/alerts.yml create mode 100644 prometheus/prometheus.yml diff --git a/.csbi.yaml b/.csbi.yaml index eda32e1f..43e12d56 100644 --- a/.csbi.yaml +++ b/.csbi.yaml @@ -1,2 +1,3 @@ repository-base-path: "./models" -orchestrator-shutown-timeout: "1min" \ No newline at end of file +orchestrator-shutown-timeout: "1min" +docker-orchestrator-network: "csbi-dev-net" \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index 57ee1607..44b3481f 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -126,6 +126,6 @@ func initConfig() { } viper.SetDefault("repository-base-path", "./models") viper.SetDefault("orchestrator-shutown-timeout", time.Duration(1)*time.Minute) - viper.SetDefault("docker-orchestrator-network", "msc-thesis_default") + viper.SetDefault("docker-orchestrator-network", "csbi-dev-net") log.WithFields(viper.AllSettings()).Debug("current viper config") } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..9b5b1095 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,49 @@ +version: "3.9" +services: + gosdn: + image: registry.code.fbi.h-da.de/danet/gosdn:thesis-mk + ports: + - "55055:55055" + - "40000:40000" + security_opt: ["apparmor=unconfined"] + cap_add: [SYS_PTRACE] + environment: + - GOSDN_LOG=trace + command: ["--csbi-orchestrator", "orchestrator:55056"] + gnmi-target: + build: + context: ./gnmi-target + dockerfile: Dockerfile + ports: + - "7030:7030" + orchestrator: + image: registry.code.fbi.h-da.de/danet/csbi:latest + ports: + - "55056:55056" + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + command: ["--log-level", "trace"] + prometheus: + image: prom/prometheus:v2.29.1 + ports: + - 9000:9090 + volumes: + - ./prometheus:/etc/prometheus + - prometheus-data:/prometheus + command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml + grafana: + image: grafana/grafana:7.5.7 + ports: + - 3000:3000 + restart: unless-stopped + volumes: + - ./grafana/provisioning/datasources:/etc/grafana/provisioning/datasources + - grafana-data:/var/lib/grafana + + +volumes: + prometheus-data: + grafana-data: + +networks: + csbi-dev-net: \ No newline at end of file diff --git a/grafana/provisioning/datasources/prometheus_ds.yml b/grafana/provisioning/datasources/prometheus_ds.yml new file mode 100644 index 00000000..0cd616ec --- /dev/null +++ b/grafana/provisioning/datasources/prometheus_ds.yml @@ -0,0 +1,6 @@ +datasources: +- name: Prometheus + access: proxy + type: prometheus + url: http://prometheus:9090 + isDefault: true diff --git a/prometheus/alerts.yml b/prometheus/alerts.yml new file mode 100644 index 00000000..7181d534 --- /dev/null +++ b/prometheus/alerts.yml @@ -0,0 +1,8 @@ +groups: + - name: DemoAlerts + rules: + - alert: InstanceDown + expr: up{job="services"} < 1 + for: 5m + + diff --git a/prometheus/prometheus.yml b/prometheus/prometheus.yml new file mode 100644 index 00000000..042b8531 --- /dev/null +++ b/prometheus/prometheus.yml @@ -0,0 +1,18 @@ +global: + scrape_interval: 5s + scrape_timeout: 10s + +rule_files: + - alert.yml + +scrape_configs: + - job_name: services + metrics_path: /metrics + static_configs: + - targets: + - 'prometheus:9090' + - 'gosdn:8080' + - 'orchestrator:9338' + + + -- GitLab