Giter Club home page Giter Club logo

demo-site's Introduction

Prometheus monitoring demo site

Build Status License IRC

This repository provides a demo site for prometheus, alertmanager, prometheus exporters, and grafana. Site is provisioned with ansible running every day and on all commits to master branch. Everything is fully automated with travis ci pipeline. If you want to check ansible-playbook output, go to last build.

Have a look at configuration files in group_vars/.

Applications

All applications should be running on their default ports.

App name Address (HTTP) Address (HTTPS)
node_exporter demo.do.prometheus.io:9100 node.demo.do.prometheus.io
prometheus demo.do.prometheus.io:9090 prometheus.demo.do.prometheus.io
alertmanager demo.do.prometheus.io:9093 alertmanager.demo.do.prometheus.io
grafana demo.do.prometheus.io:3000 grafana.demo.do.prometheus.io

Important notice

Before running, golang is required to be installed on deployer machine (necessary to install random_exporter).

Most services can be accessed in two ways (links in Applications section. As an example, prometheus can be accessed via:

  • http://demo.do.prometheus.io:9090 - default way
  • https://prometheus.do.prometheus.io - workaround which in background communicates with prometheus via insecure, "default" channel mentioned above

This workaround was needed to solve issue cloudalchemy/demo-site#13.

Run yourself

You can easily run such setup yourself without much knowledge how any part of this works. You just need to do two things:

Change ansible inventory

First of all you need to configure your inventory, ours is located in hosts file. Here you set up your target hosts by changing value of ansible_host variable. Also here you can exclude parts of this demo site, so if you don't need our website, you just remove this part:

[web]
demo

Accordingly you can exclude grafana, prometheus.

Change passwords

For security measures we encrypted some of our passwords, but it is easy to use yours! You can do it by replacing a file located at group_vars/grafana/vault with following content:

vault_grafana_password: <<INSERT_YOUR_GRAFANA_PASSWORD>>

Download the 'random' exporter binary

You will have to manually run go command to download & copy the random exporter binary to playbooks/files directory.

  • The binary will be downloaded at GOPATH location. The value of GOPATH can be found by running go env|grep GOPATH command on your system.
go get -u github.com/prometheus/client_golang/examples/random
cp <GOPATH>/bin/random /path/to/demo-site/playbooks/files/

Run as usual Ansible playbook

# Download roles
ansible-galaxy install -r roles/requirements.yml

# Run playbook
ansible-playbook site.yml
# or when using vault encrypted variables
ansible-playbook --vault-id @prompt site.yml

demo site is deployed using Cloud Alchemy ansible roles.

DigitalOcean

demo-site's People

Contributors

badbart avatar beorn7 avatar berekuk avatar gardar avatar hasithsen avatar juliusv avatar leviharrison avatar nirmalpathak avatar paulfantom avatar porkepix avatar prombot avatar rdemachkovych avatar richih avatar roidelapluie avatar sachavg avatar sdarwin avatar superq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demo-site's Issues

"msg": "Could not find the requested service blackbox_exporter: host"

Not able to deploy. I got errors. Please help.

ansible-playbook -i hosts site.yml --vault-password-file group_vars/grafana/vault --check -vvvvv

I got errors as follows:

fatal: [10.10.2.19]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "daemon_reexec": false,
            "daemon_reload": true,
            "enabled": true,
            "force": null,
            "masked": null,
            "name": "blackbox_exporter",
            "no_block": false,
            "scope": "system",
            "state": "started"
        }
    },
    "msg": "Could not find the requested service blackbox_exporter: host"
}

ansible all -m ping

10.10.2.19 | SUCCESS => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "ping": "pong"
}

cat hosts:

10.10.2.19 ansible_host=10.10.2.19 ansible_user=root

[prometheus]
10.10.2.19

[alertmanager]
10.10.2.19

[grafana]
10.10.2.19

[exporters]
10.10.2.19

[web]
10.10.2.19

The conditional check 'caddy_features | search('git')' failed.

Issue:
The ansible playbook fails a condition check while installing 'git' using apt on Ubuntu 20.04 LTS.

Error:
TASK [caddy_ansible.caddy_ansible : Install git] ************************************************************************************************************************
fatal: [demo]: FAILED! => {"msg": "The conditional check 'caddy_features | search('git')' failed. The error was: template error while templating string: no filter named 'search'. String: {% if caddy_features | search('git') %} True {% else %} False {% endif %}\n\nThe error appears to be in '/home/npathak/sonic-jobs/ansible/demo-site/roles/caddy_ansible.caddy_ansible/tasks/packages-apt.yml': line 8, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Install git\n ^ here\n"}

Details:

  • The failing condition is set in caddy_ansible role in a file roles/caddy_ansible.caddy_ansible/tasks/packages-apt.yml.
  • Commenting the condition check #when: caddy_features | search('git')works.

Add Prometheus `main` branch demo instance

It would be nice to have an additional Prometheus instance that deploys from main, both to demo features that haven't made a release yet, and to act as a more up-to-date backend for the Netlify deploy previews.

Unable to start service caddy.

Issue:
Unable to start/restart caddy service on Ubuntu 20.04 LTS

Error:
RUNNING HANDLER [caddy_ansible.caddy_ansible : reload caddy] ************************************************************************************************************
fatal: [demo]: FAILED! => {"changed": false, "msg": "Unable to start service caddy: Job for caddy.service failed because the control process exited with error code.\nSee "systemctl status caddy.service" and "journalctl -xe" for details.\n"}

Details:

  • The permission of the directory /var/www is set to 750 after OS hardening.
  • Manually changing the permission of the directory /var/www to 755 works.

FAILED! => {"changed": false, "checksum": "87a17b21ccd22636f3845dd92fb311551c1fd0ba"

I made the change in group_vars/grafana/vault as follows:

vault_grafana_password: demo12345678

I got errors when I ran,

ansible-playbook site.yml

TASK [dev-sec.ssh-hardening : create sshd_config and set permissions to root/600] ********************
fatal: [demo]: FAILED! => {"changed": false, "checksum": "87a17b21ccd22636f3845dd92fb311551c1fd0ba", "exit_status": 255, "msg": "failed to validate", "stderr": "Unsupported KEX algorithm \"[email protected]\"\r\n/root/.ansible/tmp/ansible-tmp-1681618592.8951068-527499-95013378172142/source line 73: Bad SSH2 KexAlgorithms '[email protected],[email protected],diffie-hellman-group-exchange-sha256'.\r\n", "stderr_lines": ["Unsupported KEX algorithm \"[email protected]\"", "/root/.ansible/tmp/ansible-tmp-1681618592.8951068-527499-95013378172142/source line 73: Bad SSH2 KexAlgorithms '[email protected],[email protected],diffie-hellman-group-exchange-sha256'."], "stdout": "", "stdout_lines": []}

I reverted my changes in group_vars/grafana/vault to the original values of group_vars/grafana/vault I got from github. Then I got errors as follows:

ansible-playbook site.yml

PLAY [Install python] ******************************************************************************** ERROR! Attempting to decrypt but no vault secrets found

TASK [Copy random_exporter binary] fails.

Issue:
The ansible playbook fails to copy random export binary.

Error:
TASK [Copy random_exporter binary] **************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [demo]: FAILED! => {"changed": false, "msg": "Could not find or access 'random'\nSearched in:\n\t/home/ubuntu/demo-site/playbooks/files/random\n\t/home/ubuntu/demo-site/playbooks/random\n\t/home/ubuntu/demo-site/playbooks/files/random\n\t/home/ubuntu/demo-site/playbooks/random on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

Details:

  • How does it download the random export binary?
  • The 'golang' is installed on my deployer system.
    $ go version
    go version go1.13.8 linux/amd64
    $ which go
    /usr/bin/go

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.