diff --git a/conf/grafana/dashboards/tasks.json b/conf/grafana/dashboards/tasks.json new file mode 100644 index 0000000..bd9c1d5 --- /dev/null +++ b/conf/grafana/dashboards/tasks.json @@ -0,0 +1,228 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 2, + "links": [], + "panels": [ + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": "Prometheus", + "fill": 1, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(swh_task_duration_seconds_sum[5m]) / rate(swh_task_duration_seconds_count[5m])", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Task duration", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "fill": 1, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "percentage": false, + "pointradius": 5, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "increase(swh_task_success_count[1m])", + "format": "time_series", + "intervalFactor": 1, + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Task/mn", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "schemaVersion": 16, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-15m", + "to": "now" + }, + "timepicker": { + "refresh_intervals": [ + "5s", + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ], + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, + "timezone": "", + "title": "Tasks", + "uid": "cRZm-Mumz", + "version": 4 +} diff --git a/conf/grafana/provisioning/dashboards/all.yaml b/conf/grafana/provisioning/dashboards/all.yaml new file mode 100644 index 0000000..aa79647 --- /dev/null +++ b/conf/grafana/provisioning/dashboards/all.yaml @@ -0,0 +1,6 @@ +- name: 'default' # name of this dashboard configuration (not dashboard itself) + org_id: 1 # id of the org to hold the dashboard + folder: '' # name of the folder to put the dashboard (http://docs.grafana.org/v5.0/reference/dashboard_folders/) + type: 'file' # type of dashboard description (json files) + options: + folder: '/var/lib/grafana/dashboards' # where dashboards are diff --git a/conf/grafana/provisioning/datasources/prometheus.yaml b/conf/grafana/provisioning/datasources/prometheus.yaml new file mode 100644 index 0000000..289aaf1 --- /dev/null +++ b/conf/grafana/provisioning/datasources/prometheus.yaml @@ -0,0 +1,11 @@ +# config file version +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + url: http://localhost:5080/prometheus + access: direct + isDefault: true + version: 1 + editable: false diff --git a/conf/nginx.conf b/conf/nginx.conf index f7b367f..e547252 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,100 +1,105 @@ worker_processes 1; # Show startup logs on stderr; switch to debug to print, well, debug logs when # running nginx-debug error_log /dev/stderr info; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # Built-in Docker resolver. Needed to allow on-demand resolution of proxy # upstreams. resolver 127.0.0.11 valid=30s; server { listen 5080 default_server; # Add a trailing slash to top level requests (e.g. http://localhost:5080/flower) rewrite ^/([^/]+)$ /$1/ permanent; # In this pile of proxies, all upstreams are set using a variable. This # makes nginx DNS-resolve the name of the upstream when clients request # them, rather than on start. This avoids an unstarted container preventing # nginx from starting. # # Variables need to be set as early as possible, as they're statements from # the rewrite module and `rewrite [...] break;` will prevent these # statements from being executed. location /flower/ { set $upstream "http://flower:5555"; rewrite ^/flower/(.*)$ /$1 break; proxy_pass $upstream; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location /rabbitmq/ { set $upstream "http://amqp:15672"; rewrite ^/rabbitmq/(.*)$ /$1 break; proxy_pass $upstream; } location /scheduler { set $upstream "http://swh-scheduler-api:5008"; rewrite ^/scheduler/(.*)$ /$1 break; proxy_pass $upstream; } location /storage { set $upstream "http://swh-storage:5002"; rewrite ^/storage/(.*)$ /$1 break; proxy_pass $upstream; } location /indexer-storage { set $upstream "http://swh-idx-storage:5007"; rewrite ^/indexer-storage/(.*)$ /$1 break; proxy_pass $upstream; } location /deposit { set $upstream "http://swh-deposit:5006"; rewrite ^/deposit/(.*)$ /$1 break; proxy_pass $upstream; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_redirect off; } location /objstorage { set $upstream "http://swh-objstorage:5003"; rewrite ^/objstorage/(.*)$ /$1 break; proxy_pass $upstream; } location /prometheus { set $upstream "http://prometheus:9090"; proxy_pass $upstream; } + location /grafana { + set $upstream "http://grafana:3000"; + rewrite ^/grafana/(.*)$ /$1 break; + proxy_pass $upstream; + } location / { set $upstream "http://swh-web:5004"; proxy_pass $upstream; } } } diff --git a/docker-compose.yml b/docker-compose.yml index fe94139..3756151 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,279 +1,288 @@ version: '2' services: amqp: image: rabbitmq:3.6-management ports: - 5072:5672 # flower: # image: mher/flower # command: --broker=amqp://guest:guest@amqp:5672// --url_prefix=flower # ports: # - 5055:5555 # depends_on: # - amqp zookeeper: image: wurstmeister/zookeeper kafka: image: wurstmeister/kafka ports: - 5092:9092 env_file: ./env/kafka.env depends_on: - zookeeper prometheus: image: prom/prometheus command: # Needed for the reverse-proxy - "--web.external-url=/prometheus" - "--config.file=/etc/prometheus/prometheus.yml" volumes: - "./conf/prometheus.yml:/etc/prometheus/prometheus.yml:ro" restart: unless-stopped prometheus-statsd-exporter: image: prom/statsd-exporter command: - "--statsd.mapping-config=/etc/prometheus/statsd-mapping.yml" volumes: - "./conf/prometheus-statsd-mapping.yml:/etc/prometheus/statsd-mapping.yml:ro" restart: unless-stopped + grafana: + image: grafana/grafana + restart: unless-stopped + environment: + GF_SERVER_ROOT_URL: http://localhost:5080/grafana + volumes: + - "./conf/grafana/provisioning:/etc/grafana/provisioning:ro" + - "./conf/grafana/dashboards:/var/lib/grafana/dashboards" + nginx: image: nginx volumes: - "./conf/nginx.conf:/etc/nginx/nginx.conf:ro" ports: - 5080:5080 # Scheduler swh-scheduler-db: image: postgres:10 environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-scheduler swh-scheduler-api: image: swh/scheduler-api build: ./dockerfiles/swh-scheduler-api env_file: ./env/scheduler.env depends_on: - swh-scheduler-db ports: - 5008:5008 volumes: - "./conf/scheduler.yml:/scheduler.yml:ro" swh-scheduler-listener: image: swh/scheduler-worker build: ./dockerfiles/swh-scheduler-worker env_file: ./env/scheduler.env command: listener depends_on: - swh-scheduler-api - amqp volumes: - "./conf/scheduler.yml:/scheduler.yml:ro" swh-scheduler-runner: image: swh/scheduler-worker build: ./dockerfiles/swh-scheduler-worker env_file: ./env/scheduler.env command: runner -p 10 depends_on: - swh-scheduler-api - amqp volumes: - "./conf/scheduler.yml:/scheduler.yml:ro" # Graph storage swh-storage-db: image: postgres:10 environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-storage swh-storage: build: ./dockerfiles/swh-storage image: swh/storage ports: - 5002:5002 depends_on: - swh-storage-db - swh-objstorage env_file: ./env/storage.env volumes: - "./conf/storage.yml:/storage.yml:ro" # Object storage swh-objstorage: build: ./dockerfiles/swh-objstorage image: swh/objstorage ports: - 5003:5003 volumes: - "./conf/objstorage.yml:/objstorage.yml:ro" # Indexer storage swh-idx-storage-db: image: postgres:10 environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-idx-storage swh-idx-storage: build: ./dockerfiles/swh-indexer-storage image: swh/indexer-storage ports: - 5007:5007 depends_on: - swh-idx-storage-db environment: POSTGRES_PASSWORD: testpassword POSTGRES_DB: swh-idx-storage PGHOST: swh-idx-storage-db PGUSER: postgres volumes: - "./conf/indexer_storage.yml:/indexer_storage.yml:ro" # Web interface swh-web: build: ./dockerfiles/swh-web image: swh/web ports: - 5004:5004 depends_on: - swh-objstorage - swh-storage - swh-idx-storage environment: VERBOSITY: 3 volumes: - "./conf/web.yml:/etc/softwareheritage/web/web.yml:ro" swh-deposit-db: image: postgres:10 env_file: ./env/deposit.env swh-deposit: build: ./dockerfiles/swh-deposit image: swh/deposit ports: - 5006:5006 depends_on: - swh-deposit-db - swh-scheduler-api env_file: ./env/deposit.env environment: PGHOST: swh-deposit-db volumes: - "./conf/deposit_server.yml:/etc/softwareheritage/deposit/server.yml:ro" - "./conf/deposit_private.yml:/etc/softwareheritage/deposit/private.yml:ro" # Lister Celery workers swh-listers-db: image: postgres:10 environment: POSTGRES_PASSWORD: testpassword swh-lister: image: swh/listers-worker build: ./dockerfiles/swh-listers-worker env_file: ./env/listers.env environment: STATSD_HOST: prometheus-statsd-exporter STATSD_PORT: 9125 SWH_WORKER_INSTANCE: listers SWH_CONFIG_FILENAME: /lister.yml depends_on: - swh-listers-db - swh-scheduler-api - swh-scheduler-runner - swh-storage - amqp volumes: - "./conf/lister.yml:/lister.yml:ro" # Loader Celery workers swh-loader: image: swh/loaders-worker build: ./dockerfiles/swh-loaders-worker env_file: ./env/listers.env environment: STATSD_HOST: prometheus-statsd-exporter STATSD_PORT: 9125 SWH_WORKER_INSTANCE: loader SWH_CONFIG_FILENAME: /loader.yml depends_on: - swh-storage - amqp volumes: - "./conf/loader.yml:/loader.yml:ro" # Indexer Celery workers swh-indexer: image: swh/indexer-worker build: ./dockerfiles/swh-indexer-worker env_file: ./env/indexers.env environment: STATSD_HOST: prometheus-statsd-exporter STATSD_PORT: 9125 depends_on: - swh-scheduler-runner - swh-idx-storage - swh-storage - swh-objstorage - amqp volumes: - "./conf/indexer.yml:/indexer.yml:ro" swh-indexer-journal-client: image: swh/indexer-journal-client build: ./dockerfiles/swh-indexer-journal-client depends_on: - swh-journal-publisher - swh-scheduler-api volumes: - "./conf/journal_client.yml:/etc/softwareheritage/indexer/journal_client.yml:ro" # Journal related swh-storage-listener: image: swh/storage-listener build: ./dockerfiles/swh-storage-listener env_file: ./env/storage.env depends_on: - swh-storage-db - kafka volumes: - "./conf/storage_listener.yml:/etc/softwareheritage/storage/listener.yml:ro" swh-journal-publisher: image: swh/journal-publisher build: ./dockerfiles/swh-journal-publisher depends_on: - kafka - swh-storage-listener volumes: - "./conf/journal_publisher.yml:/etc/softwareheritage/journal/publisher.yml:ro" swh-journal-client: image: swh/journal-client build: ./dockerfiles/swh-journal-client depends_on: - swh-journal-publisher volumes: - "./conf/journal_client.yml:/etc/softwareheritage/journal/logger.yml:ro"