diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbc39b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +credentials/ \ No newline at end of file diff --git a/server/README.md b/server/README.md new file mode 100644 index 0000000..3b37807 --- /dev/null +++ b/server/README.md @@ -0,0 +1,2 @@ +# Server configuration, intended use of this demo +#TODO demo , describe all files \ No newline at end of file diff --git a/server/ansible.cfg b/server/ansible.cfg new file mode 100644 index 0000000..9fc0fd3 --- /dev/null +++ b/server/ansible.cfg @@ -0,0 +1,4 @@ +# ansible configuration file + +[defaults] +inventory = ./ansible_inventory diff --git a/server/ansible_inventory b/server/ansible_inventory new file mode 100644 index 0000000..f822a23 --- /dev/null +++ b/server/ansible_inventory @@ -0,0 +1,2 @@ +[android-prometheus-exporter-target-server] +139.144.68.186 diff --git a/server/ansible_playbook.yaml b/server/ansible_playbook.yaml new file mode 100644 index 0000000..68597dd --- /dev/null +++ b/server/ansible_playbook.yaml @@ -0,0 +1,23 @@ +# run this playbook against new linux server + +- name: Install example server stack for prometheus-exporter-android + hosts: android-prometheus-exporter-target-server + remote_user: root + + tasks: + - name: Assert linux distribution is Rocky Linux + + - name: Install docker + + - name: Install docker compose + + - name: Create user androidexporter + + - name: + + +#TODO create user androidexporter +#TODO install docker +#TODO install docker compose +#TODO copy files over +#TODO create folder structure \ No newline at end of file diff --git a/server/configuration/nginx.conf b/server/configuration/nginx.conf new file mode 100644 index 0000000..f37637f --- /dev/null +++ b/server/configuration/nginx.conf @@ -0,0 +1,66 @@ +# nginx configuration for pushprox, grafana and prometheus +http{ + + # Needed for grafana websockets + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + # Upstream server definitions + upstream prometheus{ + server http://prometheus:9090; + } + + upstream pushprox{ + server http://pushprox:8080; + } + + upstream grafana{ + server http://grafana:3000; + } + + # Grafana server configuration + server { + listen 3000; + + root /usr/share/nginx/html; + index index.html index.htm; + + location / { + proxy_set_header Host $http_host; + proxy_pass http://grafana; + } + + # Proxy Grafana Live WebSocket connections + location /api/live/ { + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Host $http_host; + proxy_pass http://grafana; + } + } + + # PushProx server configuration + server { + listen 8080; + + location / { + proxy_pass http://pushprox; + } + } + + # Prometheus UI server configuration + server { + listen 9090; + + location / { + proxy_pass http://prometheus; + } + } +} + +events { + worker_connections 1024; +} diff --git a/server/configuration/prometheus.yaml b/server/configuration/prometheus.yaml new file mode 100644 index 0000000..e69de29 diff --git a/server/docker-compose.yaml b/server/docker-compose.yaml index e69de29..d1a8bfb 100644 --- a/server/docker-compose.yaml +++ b/server/docker-compose.yaml @@ -0,0 +1,38 @@ +# nginx, pushprox, prometheus, grafana stack + +version: '3.9' + +services: + + # monitoring dashboard for prometheus + grafana: + container_name: grafana + image: grafana/grafana:8.5.22 + restart: on-failure + networks: + - common-network + + # reverse proxy + nginx: + container_name: nginx + image: nginx:1.23.4 + networks: + - common-network + + # proxy for prometheus to traverse NAT + pushprox: + image: prometheuscommunity/pushprox:master + + # prometheus time-series database + prometheus: + container_name: prometheus + image: bitnami/prometheus:2.43.0 + volumes: + - ./ + restart: on-failure + networks: + - common-network + +networks: + common-network: + driver: bridge