From 36a140d1b821c9081fa027a61d2a89d1a3207ff0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 Dec 2020 00:19:27 +0100 Subject: [PATCH] working docker-compose --- docker-compose/docker-compose.yml | 139 +++++++++--------- .../provisioning/datasources/datasource.yml | 11 +- docker-compose/initdb/addusers.sql | 5 + 3 files changed, 82 insertions(+), 73 deletions(-) create mode 100644 docker-compose/initdb/addusers.sql diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 50a41b7..c157b92 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -11,59 +11,69 @@ volumes: services: - prometheus: - image: prom/prometheus:v2.22.1 - container_name: prometheus - volumes: - - ./prometheus:/etc/prometheus - - prometheus_data:/prometheus - command: - - '--config.file=/etc/prometheus/prometheus.yml' - - '--storage.tsdb.path=/prometheus' - - '--web.console.libraries=/etc/prometheus/console_libraries' - - '--web.console.templates=/etc/prometheus/consoles' - - '--storage.tsdb.retention.time=14d' - - '--web.enable-lifecycle' - restart: unless-stopped - expose: - - 9090 - networks: - - monitor-net - labels: - org.label-schema.group: "monitoring" - - alertmanager: - image: prom/alertmanager:v0.21.0 - container_name: alertmanager - volumes: - - ./alertmanager:/etc/alertmanager - command: - - '--config.file=/etc/alertmanager/config.yml' - - '--storage.path=/alertmanager' - restart: unless-stopped - expose: - - 9093 - networks: - - monitor-net - labels: - org.label-schema.group: "monitoring" +# prometheus: +# image: prom/prometheus:v2.22.1 +# container_name: prometheus +# volumes: +# - ./prometheus:/etc/prometheus +# - prometheus_data:/prometheus +# command: +# - '--config.file=/etc/prometheus/prometheus.yml' +# - '--storage.tsdb.path=/prometheus' +# - '--web.console.libraries=/etc/prometheus/console_libraries' +# - '--web.console.templates=/etc/prometheus/consoles' +# - '--storage.tsdb.retention.time=14d' +# - '--web.enable-lifecycle' +# restart: unless-stopped +# expose: +# - 9090 +# networks: +# - monitor-net +# labels: +# org.label-schema.group: "monitoring" +# +# alertmanager: +# image: prom/alertmanager:v0.21.0 +# container_name: alertmanager +# volumes: +# - ./alertmanager:/etc/alertmanager +# command: +# - '--config.file=/etc/alertmanager/config.yml' +# - '--storage.path=/alertmanager' +# restart: unless-stopped +# expose: +# - 9093 +# networks: +# - monitor-net +# labels: +# org.label-schema.group: "monitoring" grafana: - image: grafana/grafana:7.3.1 + image: grafana/grafana:7.3.4 container_name: grafana volumes: - grafana_data:/var/lib/grafana - ./grafana/provisioning:/etc/grafana/provisioning environment: + - GF_AUTH_PROXY_ENABLED=true + - GF_AUTH_PROXY_HEADER_NAME=X-Proxy-Station + - GF_AUTH_PROXY_HEADER_PROPERTY_username + - GF_AUTH_PROXY_AUTO_SIGN_UP=true + - GF_AUTH_PROXY_SYNC_TTL=60 + - GF_INSTALL_PLUGINS=grafana-worldmap-panel,michaeldmoore-multistat-panel + - GF_LOG_FILTERS='rendering:debug' + - GF_RENDERING_SERVER_URL=http://grafana-image-renderer:8081/render + - GF_RENDERING_CALLBACK_URL=http://grafana:3000/ - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} + - GF_SERVER_DOMAIN=cloud.ixyd.net + - GF_SERVER_ROOT_URL=https://cloud.ixyd.net/grafana - GF_USERS_ALLOW_SIGN_UP=false - - GF_RENDERING_SERVER_URL=http://grafana-image-renderer:8081/render - - GF_RENDERING_CALLBACK_URL=http://grafana:3000/ - - GF_LOG_FILTERS='rendering:debug' + - GF_USERS_AUTO_ASSIGN_ORG=true + - GF_USERS_AUTO_ASSIGN_ORG_ROLE=Editor restart: unless-stopped - expose: - - 3001 + ports: + - "3001:3000" networks: - monitor-net labels: @@ -84,37 +94,36 @@ services: # labels: # org.label-schema.group: "monitoring" - grafana-image-renderer: - image: grafana/grafana-image-renderer:latest - container_name: grafana-image-renderer - expose: - - 8081 - environment: - - ENABLE_METRICS=true - - HTTP_HOST=grafana-image-renderer - - LOG_LEVEL=debug - restart: unless-stopped - networks: - - monitor-net - labels: - org.label-schema.group: "monitoring" - +# grafana-image-renderer: +# image: grafana/grafana-image-renderer:latest +# container_name: grafana-image-renderer +# expose: +# - 8081 +# environment: +# - ENABLE_METRICS=true +# - HTTP_HOST=grafana-image-renderer +# - LOG_LEVEL=debug +# restart: unless-stopped +# networks: +# - monitor-net +# labels: +# org.label-schema.group: "monitoring" +# db: image: mysql:8 container_name: db # cpus: 4.0 cap_add: - SYS_NICE - expose: - - 3306 volumes: - db_data:/var/lib/mysql + - ./initdb:/docker-entrypoint-initdb.d - ./shared:/shared restart: always environment: MYSQL_ROOT_PASSWORD: verysecret MYSQL_DATABASE: digimode_stats - MYSQL_USER: stationmonitor + MYSQL_USER: stationmonitor MYSQL_PASSWORD: secret networks: - monitor-net @@ -127,8 +136,6 @@ services: restart: always environment: - DATA_SOURCE_NAME=root:verysecret@(db:3306)/digimode_stats - expose: - - 9104 networks: - monitor-net labels: @@ -137,8 +144,8 @@ services: wsjtx-exporter: image: 10.0.73.1:5000/wsjtx-exporter:latest container_name: wsjtx-exporter - expose: - - 9888 + ports: + - "4000:4000" environment: - PROMETHEUS=true - MYSQL=true @@ -149,11 +156,9 @@ services: labels: org.label-schema.group: "monitoring" - pskreporter_exporter: + pskreporter-exporter: image: 10.0.73.1:5000/pskreporter-exporter:latest container_name: pskreporter-exporter - expose: - - 9889 environment: - PROMETHEUS=true - MYSQL=true diff --git a/docker-compose/grafana/provisioning/datasources/datasource.yml b/docker-compose/grafana/provisioning/datasources/datasource.yml index 11174f9..f230433 100644 --- a/docker-compose/grafana/provisioning/datasources/datasource.yml +++ b/docker-compose/grafana/provisioning/datasources/datasource.yml @@ -11,9 +11,8 @@ datasources: editable: true - name: MySQL type: mysql - access: direct - orgId: 1 - url: mysql://stationmonitor:secret@db:3306/digimode_stats - basicAuth: false - isDefault: false - editable: true + url: db:3306 + database: digimode_stats + user: stationmonitor + secureJsonData: + password: secret diff --git a/docker-compose/initdb/addusers.sql b/docker-compose/initdb/addusers.sql new file mode 100644 index 0000000..df214b8 --- /dev/null +++ b/docker-compose/initdb/addusers.sql @@ -0,0 +1,5 @@ +create user 'http'@'%' identified by 'httppw'; +grant select on digimode_stats.* to 'http'@'%'; + +create user 'grafana'@'%' identified by 'grafanapw'; +grant select on digimode_stats.* to 'grafana'@'%';