├── VERSION
├── examples
├── alerta
│ ├── README.md
│ ├── config
│ │ ├── alerta.conf
│ │ ├── config.json
│ │ └── alertad.conf
│ └── docker-compose.yml
├── icinga
│ ├── .gitignore
│ └── docker-compose.yml
├── sensu
│ ├── .gitignore
│ └── docker-compose.yml
├── federated
│ ├── config
│ │ ├── alerta.conf
│ │ ├── config.json
│ │ ├── logging.conf
│ │ ├── alertad-mlm1.conf
│ │ ├── alertad-mlm2.conf
│ │ ├── alertad-mom1.conf
│ │ └── alertad-mom2.conf
│ ├── scripts
│ │ └── pg-init.sh
│ ├── README.md
│ └── docker-compose.yml
├── keycloak
│ ├── config
│ │ ├── alertad.conf
│ │ └── demo-realm.json
│ ├── README.md
│ └── docker-compose.yml
├── prometheus
│ ├── .gitignore
│ ├── config
│ │ ├── alertmanager.yml
│ │ ├── prometheus.yml
│ │ └── prometheus.rules.yml
│ └── docker-compose.yml
├── apache
│ ├── webui
│ │ ├── .env
│ │ ├── config.json
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ ├── api
│ │ └── alertad.conf
│ ├── proxy
│ │ ├── proxy.conf
│ │ └── httpd.conf
│ ├── README.md
│ └── docker-compose.yaml
├── traefik
│ ├── webui
│ │ ├── .env
│ │ ├── config.json
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ ├── api
│ │ └── alertad.conf
│ ├── README.md
│ └── docker-compose.yaml
├── envoy
│ ├── webui
│ │ ├── .env
│ │ ├── config.json
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ ├── api
│ │ └── alertad.conf
│ ├── README.md
│ ├── docker-compose.yaml
│ └── proxy
│ │ └── front-proxy.yaml
├── nginx
│ ├── webui
│ │ ├── .env
│ │ ├── config.json
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ ├── api
│ │ └── alertad.conf
│ ├── proxy
│ │ ├── proxy.conf
│ │ └── nginx.conf
│ ├── README.md
│ └── docker-compose.yaml
├── ldap
│ ├── config
│ │ ├── config.json
│ │ └── alertad.conf
│ ├── README.md
│ └── docker-compose.yml
├── nagios
│ ├── alerta-neb.o
│ ├── Dockerfile
│ ├── config
│ │ └── heartbeat.cfg
│ └── docker-compose.yml
├── webhook
│ ├── alertad.conf
│ ├── Dockerfile
│ ├── README.md
│ └── docker-compose.yml
├── mongo
│ ├── config
│ │ └── alertad.conf
│ ├── README.md
│ └── docker-compose.yml
├── snmptrap
│ ├── config
│ │ └── snmptrapd.conf
│ ├── snmptrapd.conf.sh
│ ├── Dockerfile
│ └── docker-compose.yml
├── zabbix
│ └── docker-compose.yml
├── saml
│ ├── config
│ │ └── alertad.conf
│ ├── README.md
│ └── docker-compose.yml
├── README.md
├── basic
│ └── docker-compose.yml
├── google
│ └── docker-compose.yml
├── gitlab
│ └── docker-compose.yml
├── postgres
│ └── docker-compose.yml
└── azure
│ └── docker-compose.yml
├── .env
├── .github
├── FUNDING.yml
├── dependabot.yml
└── workflows
│ ├── tests.yml
│ └── release.yml
├── config
├── templates
│ ├── web
│ │ └── config.json.j2
│ └── app
│ │ ├── wsgi.py
│ │ ├── alertad.conf.j2
│ │ ├── alerta.conf.j2
│ │ ├── uwsgi.ini.j2
│ │ ├── supervisord.conf.j2
│ │ └── nginx.conf.j2
└── examples
│ ├── config.json
│ ├── alerta.conf
│ └── alertad.conf
├── contrib
└── kubernetes
│ ├── backend
│ ├── wsgi.py
│ ├── uwsgi.ini
│ ├── Dockerfile
│ └── docker-entrypoint.sh
│ ├── frontend
│ ├── config.json.template
│ ├── alerta-frontend-entrypoint.sh
│ └── Dockerfile
│ └── helm
│ └── alerta
│ ├── Chart.yaml
│ ├── requirements.yaml
│ ├── .helmignore
│ ├── templates
│ ├── service.yaml
│ ├── secrets.yaml
│ ├── configmap.yaml
│ ├── _helpers.tpl
│ ├── ingress.yaml
│ ├── NOTES.txt
│ └── deployment.yaml
│ └── values.yaml
├── requirements-docker.txt
├── tests
├── docker
│ ├── .rspec
│ ├── Gemfile
│ ├── Dockerfile
│ └── Gemfile.lock
├── spec
│ ├── web_spec.rb
│ ├── helpers
│ │ ├── client.rb
│ │ └── spec_helper.rb
│ └── api_spec.rb
├── docker-compose.test.mongodb.yml
└── docker-compose.test.postgres.yml
├── .gitignore
├── CHANGELOG.md
├── install-plugins.sh
├── .dockerignore
├── requirements.txt
├── plugins.txt
├── docker-compose.yml
├── LICENSE
├── Makefile
├── docker-entrypoint.sh
├── Dockerfile
└── README.md
/VERSION:
--------------------------------------------------------------------------------
1 | 9.0.4
2 |
--------------------------------------------------------------------------------
/examples/alerta/README.md:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/icinga/.gitignore:
--------------------------------------------------------------------------------
1 | data
--------------------------------------------------------------------------------
/examples/sensu/.gitignore:
--------------------------------------------------------------------------------
1 | data
--------------------------------------------------------------------------------
/.env:
--------------------------------------------------------------------------------
1 | IMAGE_NAME=alerta/alerta-web
2 |
--------------------------------------------------------------------------------
/examples/alerta/config/alerta.conf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/alerta/config/config.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/federated/config/alerta.conf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/federated/config/config.json:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/examples/keycloak/config/alertad.conf:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: satterly
2 |
--------------------------------------------------------------------------------
/examples/prometheus/.gitignore:
--------------------------------------------------------------------------------
1 | data
2 |
--------------------------------------------------------------------------------
/examples/apache/webui/.env:
--------------------------------------------------------------------------------
1 | BASE_URL=/web
2 |
--------------------------------------------------------------------------------
/examples/traefik/webui/.env:
--------------------------------------------------------------------------------
1 | BASE_URL=/web
2 |
--------------------------------------------------------------------------------
/examples/envoy/webui/.env:
--------------------------------------------------------------------------------
1 | BASE_URL=/alerta/ui
2 |
--------------------------------------------------------------------------------
/examples/nginx/webui/.env:
--------------------------------------------------------------------------------
1 | BASE_URL=/alerta/ui
2 |
--------------------------------------------------------------------------------
/config/templates/web/config.json.j2:
--------------------------------------------------------------------------------
1 | {"endpoint": "/api"}
2 |
--------------------------------------------------------------------------------
/contrib/kubernetes/backend/wsgi.py:
--------------------------------------------------------------------------------
1 | from alerta import app
2 |
--------------------------------------------------------------------------------
/config/examples/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://api.local.alerta.io:8080/api"}
2 |
--------------------------------------------------------------------------------
/config/templates/app/wsgi.py:
--------------------------------------------------------------------------------
1 | from alerta import create_app
2 | app = create_app()
3 |
--------------------------------------------------------------------------------
/examples/apache/webui/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://local.alerta.io:8000/api"}
2 |
--------------------------------------------------------------------------------
/examples/ldap/config/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://host.docker.internal:8080"}
2 |
--------------------------------------------------------------------------------
/examples/traefik/webui/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://api.local.alerta.io:8000"}
2 |
--------------------------------------------------------------------------------
/contrib/kubernetes/frontend/config.json.template:
--------------------------------------------------------------------------------
1 | {"endpoint": "${ALERTA_API_SERVER}"}
2 |
--------------------------------------------------------------------------------
/examples/envoy/webui/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://proxy.local.alerta.io:8000/alerta/api"}
2 |
--------------------------------------------------------------------------------
/examples/nginx/webui/config.json:
--------------------------------------------------------------------------------
1 | {"endpoint": "http://proxy.local.alerta.io:8000/alerta/api"}
2 |
--------------------------------------------------------------------------------
/requirements-docker.txt:
--------------------------------------------------------------------------------
1 | lxml==5.2.1
2 | pysaml2==7.2.1
3 | python-ldap==3.4.4
4 | uWSGI==2.0.21
5 |
--------------------------------------------------------------------------------
/tests/docker/.rspec:
--------------------------------------------------------------------------------
1 | --color
2 | --require ./spec/helpers/spec_helper
3 | --require ./spec/helpers/client
4 |
--------------------------------------------------------------------------------
/examples/nagios/alerta-neb.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alerta/docker-alerta/HEAD/examples/nagios/alerta-neb.o
--------------------------------------------------------------------------------
/examples/webhook/alertad.conf:
--------------------------------------------------------------------------------
1 | # NOTE: use this file for config not supported by Docker environment variables
2 |
--------------------------------------------------------------------------------
/config/templates/app/alertad.conf.j2:
--------------------------------------------------------------------------------
1 | DEBUG = {{ 'True' if env.DEBUG else 'False' }}
2 | SECRET = "{{ env.SECRET_KEY }}"
3 |
--------------------------------------------------------------------------------
/examples/mongo/config/alertad.conf:
--------------------------------------------------------------------------------
1 | BASE_URL = 'http://localhost:9080/api'
2 | USE_PROXYFIX = True
3 | SECRET_KEY = 'supersecret'
4 |
--------------------------------------------------------------------------------
/tests/docker/Gemfile:
--------------------------------------------------------------------------------
1 | # Gemfile
2 | source "https://rubygems.org"
3 |
4 | gem "rspec"
5 | gem 'rest-client'
6 | gem 'nokogiri'
7 |
--------------------------------------------------------------------------------
/examples/apache/api/alertad.conf:
--------------------------------------------------------------------------------
1 | BASE_URL = 'http://local.alerta.io:8000/api'
2 | USE_PROXYFIX = True
3 | SECRET_KEY = 'supersecret'
4 |
--------------------------------------------------------------------------------
/examples/traefik/api/alertad.conf:
--------------------------------------------------------------------------------
1 | BASE_URL = 'http://api.local.alerta.io:8000'
2 | USE_PROXYFIX = True
3 | SECRET_KEY = 'supersecret'
4 |
--------------------------------------------------------------------------------
/config/examples/alerta.conf:
--------------------------------------------------------------------------------
1 | [DEFAULT]
2 | sslverify = no
3 | output = psql
4 | endpoint = http://localhost:8080/api
5 | timezone = Europe/London
6 |
--------------------------------------------------------------------------------
/examples/envoy/api/alertad.conf:
--------------------------------------------------------------------------------
1 | BASE_URL = 'http://api.local.alerta.io:8000/alerta/api/'
2 | USE_PROXYFIX = True
3 | SECRET_KEY = 'supersecret'
4 |
--------------------------------------------------------------------------------
/examples/nginx/api/alertad.conf:
--------------------------------------------------------------------------------
1 | BASE_URL = 'http://api.local.alerta.io:8000/alerta/api/'
2 | USE_PROXYFIX = True
3 | SECRET_KEY = 'supersecret'
4 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | appVersion: "8.7.0"
3 | description: A Helm chart for Kubernetes
4 | name: alerta
5 | version: 0.4.0
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | mongodb
2 | pg-data
3 | contrib/kubernetes/helm/alerta/charts
4 |
5 | .env.local
6 | .env.*.local
7 |
8 | .idea/*
9 |
10 | /.bundle/
11 |
12 | /venv/
13 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/requirements.yaml:
--------------------------------------------------------------------------------
1 | dependencies:
2 | - name: postgresql
3 | version: "10.6.*"
4 | repository: https://charts.bitnami.com/bitnami
5 | condition: postgresql.enabled
6 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## v8.3.0 (2020-12-12)
2 |
3 | ### Feat
4 |
5 | - allow to specify housekeeping hours for expired and info alerts (#272)
6 |
7 | ### Fix
8 |
9 | - **helm**: remove space from admin users list (#271)
10 |
--------------------------------------------------------------------------------
/install-plugins.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | while read plugin version; do
4 | echo "Installing '${plugin}' (${version})"
5 | /venv/bin/pip install git+https://github.com/alerta/alerta-contrib.git@${version}#subdirectory=${plugin}
6 | done /usr/share/nginx/html/config.json
6 | fi
7 |
8 | exec "$@"
9 |
--------------------------------------------------------------------------------
/examples/federated/scripts/pg-init.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
5 | CREATE DATABASE mom1;
6 | CREATE DATABASE mom2;
7 | CREATE DATABASE mlm1;
8 | CREATE DATABASE mlm2;
9 | EOSQL
10 |
--------------------------------------------------------------------------------
/examples/alerta/config/alertad.conf:
--------------------------------------------------------------------------------
1 | DATABASE_URL='postgres://postgres:postgres@db:5432/monitoring'
2 | AUTH_REQUIRED=True
3 |
4 | ALERT_TIMEOUT=120
5 | HEARTBEAT_TIMEOUT=30
6 | LOG_LEVEL='INFO'
7 | LOG_HANDLERS=['console']
8 | PLUGINS=['remote_ip','reject','heartbeat','blackout','normalise','enhance']
9 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .dockerignore
2 | .DS_Store
3 | .git
4 | .github
5 | .gitignore
6 | .gitmodules
7 | .idea
8 | .jekyll-metadata
9 | .sass-cache
10 | tests
11 | _site
12 | CONTRIBUTING.md
13 | Dockerfile
14 | Dockerfile.archive
15 | docker-compose.yml
16 | Gemfile
17 | Gemfile.lock
18 | _website*.json
19 | **/pg-data
20 |
--------------------------------------------------------------------------------
/examples/snmptrap/config/snmptrapd.conf:
--------------------------------------------------------------------------------
1 | disableAuthorization yes
2 | authCommunity log,execute,net public
3 | format execute \$a %a\n\$A %A\n\$s %s\n\$b %b\n\$B %B\n\$x %#y-%#02m-%#02l\n\$X %#02.2h:%#02.2j:%#02.2k\n\$N %N\n\$q %q\n\$P %P\n\$t %t\n\$T %T\n\$w %w\n\$W %W\n%V~\%~%v\n
4 | traphandle default alerta-snmptrap
5 |
--------------------------------------------------------------------------------
/contrib/kubernetes/backend/uwsgi.ini:
--------------------------------------------------------------------------------
1 | [uwsgi]
2 | chdir = /
3 | mount = !BASE_PATH!=/app/wsgi.py
4 | callable = app
5 | manage-script-name = true
6 |
7 | master = true
8 | processes = 5
9 |
10 | http-socket = :8080
11 | chmod-socket = 664
12 | uid = alerta
13 | gid = alerta
14 | vacuum = true
15 |
16 | die-on-term = true
--------------------------------------------------------------------------------
/examples/zabbix/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | zabbix:
5 | image: zabbix/zabbix-appliance
6 | volumes:
7 | - ./config/alertscripts:/usr/lib/zabbix/alertscripts
8 | ports:
9 | - 10051:10051
10 | - 10080:10080
11 | environment:
12 | - ZBX_DEBUGLEVEL=3
13 | restart: always
14 |
--------------------------------------------------------------------------------
/tests/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ruby:3.0
2 |
3 | COPY Gemfile* ./
4 | RUN gem install bundler && bundle install --jobs=3 --retry=3
5 |
6 | RUN apt-get -q update && apt-get -qy install netcat
7 | RUN wget https://raw.githubusercontent.com/eficode/wait-for/v2.2.0/wait-for && chmod +x wait-for
8 |
9 | COPY .rspec .
10 | CMD ["bundle", "exec", "rspec"]
11 |
--------------------------------------------------------------------------------
/examples/nagios/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM jasonrivers/nagios
2 |
3 | RUN apt-get update && apt-get install -y \
4 | libcurl4-openssl-dev \
5 | libjansson-dev
6 |
7 | RUN echo "broker_module=/opt/nagios/libexec/alerta-neb.o http://alerta:8080/api key=demo-admin-key debug=1" >>/opt/nagios/etc/nagios.cfg
8 |
9 | COPY alerta-neb.o /opt/nagios/libexec/alerta-neb.o
10 |
11 |
--------------------------------------------------------------------------------
/examples/snmptrap/snmptrapd.conf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | cat >/etc/snmp/snmptrapd.conf << EOF
4 | disableAuthorization yes
5 | authCommunity log,execute,net public
6 | format execute \$a %a\n\$A %A\n\$s %s\n\$b %b\n\$B %B\n\$x %#y-%#02m-%#02l\n\$X %#02.2h:%#02.2j:%#02.2k\n\$N %N\n\$q %q\n\$P %P\n\$t %t\n\$T %T\n\$w %w\n\$W %W\n%V~\%~%v\n
7 | traphandle default alerta-snmptrap
8 | EOF
9 |
10 |
--------------------------------------------------------------------------------
/examples/ldap/README.md:
--------------------------------------------------------------------------------
1 | # Alerta with LDAP auth
2 |
3 | ## Run
4 |
5 | Note: Add the following entry to `/etc/hosts`:
6 |
7 | 127.0.0.1 host.docker.internal
8 |
9 | To launch Alerta and LDAP containers:
10 |
11 | $ docker-compose up
12 | => http://local.alerta.io:8000/login # leela/leela
13 |
14 | ## References
15 |
16 | https://hub.docker.com/r/rroemhild/test-openldap
17 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | bcrypt==4.2.0
2 | blinker==1.8.2
3 | cryptography==43.0.1
4 | Flask==3.0.3
5 | Flask-Compress==1.15
6 | Flask-Cors==5.0.0
7 | mohawk==1.1.0
8 | psycopg2==2.9.9
9 | PyJWT==2.9.0
10 | pymongo==4.4.1
11 | pyparsing==3.1.4
12 | python-dateutil==2.9.0.post0
13 | pytz==2024.1
14 | PyYAML==6.0.1
15 | requests==2.32.3
16 | requests-hawk==1.2.1
17 | sentry-sdk[flask]==2.13.0
18 | StrEnum==0.4.15
19 | werkzeug==3.0.4
20 |
--------------------------------------------------------------------------------
/examples/nginx/proxy/proxy.conf:
--------------------------------------------------------------------------------
1 | proxy_redirect off;
2 | proxy_set_header Host $host;
3 | proxy_set_header X-Real-IP $remote_addr;
4 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
5 | client_max_body_size 10m;
6 | client_body_buffer_size 128k;
7 | proxy_connect_timeout 90;
8 | proxy_send_timeout 90;
9 | proxy_read_timeout 90;
10 | proxy_buffers 32 4k;
11 |
--------------------------------------------------------------------------------
/tests/spec/web_spec.rb:
--------------------------------------------------------------------------------
1 | require 'nokogiri'
2 |
3 | describe "web" do
4 | WEB_BASE_URL = "http://sut:8080"
5 | context "/alerts" do
6 | context "get" do
7 | result = Client.get "#{WEB_BASE_URL}/alerts"
8 | it "return 200" do
9 | expect(result.code).to eq(200)
10 | end
11 | it "return HTML" do
12 | expect(Nokogiri::HTML.parse(result.body).title).to eq("Alerta")
13 | end
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/.helmignore:
--------------------------------------------------------------------------------
1 | # Patterns to ignore when building packages.
2 | # This supports shell glob matching, relative path matching, and
3 | # negation (prefixed with !). Only one pattern per line.
4 | .DS_Store
5 | # Common VCS dirs
6 | .git/
7 | .gitignore
8 | .bzr/
9 | .bzrignore
10 | .hg/
11 | .hgignore
12 | .svn/
13 | # Common backup files
14 | *.swp
15 | *.bak
16 | *.tmp
17 | *~
18 | # Various IDEs
19 | .project
20 | .idea/
21 | *.tmproj
22 |
--------------------------------------------------------------------------------
/examples/apache/proxy/proxy.conf:
--------------------------------------------------------------------------------
1 |
2 | ProxyPreserveHost On
3 | ProxyRequests Off
4 | ServerName local.alerta.io
5 |
6 | # Possible values include: debug, info, notice, warn, error, crit,
7 | # alert, emerg.
8 | LogLevel debug
9 |
10 | ProxyPass /web http://web/
11 | ProxyPassReverse /web http://web/
12 |
13 | ProxyPass /api http://api:8080/api
14 | ProxyPassReverse /api http://api:8080/api
15 |
16 |
17 |
--------------------------------------------------------------------------------
/examples/saml/config/alertad.conf:
--------------------------------------------------------------------------------
1 | DEBUG = True
2 | SECRET = "^Bpa%i8_nCAc8fI4l9)nhn2EG2!@GJga"
3 | AUTH_REQUIRED = False
4 |
5 | # SAML 2.0
6 | AUTH_PROVIDER = 'saml2'
7 | SAML2_ENTITY_ID = 'http://host.docker.internal:8080/api' # Alerta API
8 | SAML2_METADATA_URL = 'http://host.docker.internal:9080/simplesaml/saml2/idp/metadata.php' # SAML2 IdP
9 | SAML2_USER_NAME_FORMAT = '{first_name} {last_name}'
10 | SAML2_EMAIL_ATTRIBUTE = 'email'
11 | SAML2_CONFIG = {}
12 | ALLOWED_SAML2_GROUPS = ['*']
13 |
--------------------------------------------------------------------------------
/examples/snmptrap/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM ubuntu
2 |
3 | RUN apt-get update && apt-get install -y \
4 | git \
5 | python3-pip \
6 | snmptrapd \
7 | snmp \
8 | snmp-mibs-downloader
9 |
10 | ENV MIBS +ALL
11 |
12 | ADD snmptrapd.conf.sh /snmptrapd.conf.sh
13 | RUN /snmptrapd.conf.sh
14 |
15 | RUN pip3 install git+https://github.com/alerta/alerta-contrib.git#subdirectory=integrations/snmptrap
16 |
17 | EXPOSE 162/udp
18 |
19 | CMD ["snmptrapd", "-f", "-Lo", "-n", "-m+ALL", "-Dtrap"]
20 |
--------------------------------------------------------------------------------
/examples/README.md:
--------------------------------------------------------------------------------
1 | Examples
2 | ========
3 |
4 | Example monitoring stacks using `docker-compose`:
5 |
6 | * [Alerta minimal](alerta)
7 | x [Alerta using GitLab auth](gitlab)
8 | * [Alerta with Icinga](icinga)
9 | * [Alerta using Keycloak auth](keycloak)
10 | * [Alerta using LDAP auth](ldap)
11 | * [Alerta with Nagios](nagios)
12 | * [Alerta with Netdata](netdata)
13 | * [Alerta with Prometheus/Alertmanager](prometheus)
14 | * [Alerta with Sensu](sensu)
15 | * [Alerta SNMP Trap forwarder](snmptrap)
16 | * [Alerta with Zabbix](zabbix)
17 |
18 |
--------------------------------------------------------------------------------
/examples/federated/README.md:
--------------------------------------------------------------------------------
1 | # Federated Alerta Example
2 |
3 | This is an example configuration to demonstrate how to forward
4 | alerts between Alerta servers to create a highly-available
5 | cluster of monitoring servers.
6 |
7 | ## Containers
8 |
9 | - MoM (Manager-of-Mangers, aka. top-level manager) x 2
10 | - MLM (Mid-Level Manager, aka. regional manager) x 2
11 |
12 | ## Run
13 |
14 | $ cd examples/federated
15 | $ docker-compose up -d
16 |
17 | ## Endpoints
18 |
19 | TBC
20 |
21 | ## References
22 |
23 | https://prometheus.io/docs/prometheus/latest/federation/
24 |
--------------------------------------------------------------------------------
/examples/mongo/README.md:
--------------------------------------------------------------------------------
1 | # Alerta with MongoDB Replica Set Example
2 |
3 | Once the mongo containers have started, run an interactive shell in one of the mongoDB containers, like so:
4 |
5 | $ docker exec -ti mongo_db0_1 mongo
6 |
7 | To initiate the replicaset, at the `mongo` prompt ">" run:
8 |
9 | ```
10 | rs.initiate(
11 | {
12 | _id: "rs0",
13 | version: 1,
14 | members: [
15 | { _id: 0, host : "db0:27017" },
16 | { _id: 1, host : "db1:27017" },
17 | { _id: 2, host : "db2:27017" }
18 | ]
19 | }
20 | )
21 | ```
22 |
--------------------------------------------------------------------------------
/examples/prometheus/config/alertmanager.yml:
--------------------------------------------------------------------------------
1 | global:
2 | # The smarthost and SMTP sender used for mail notifications.
3 | smtp_smarthost: 'localhost:25'
4 | smtp_from: 'alertmanager@example.org'
5 |
6 | route:
7 | receiver: "alerta"
8 | group_by: ['alertname']
9 | group_wait: 15s
10 | group_interval: 15s
11 | repeat_interval: 1m
12 |
13 | receivers:
14 | - name: "alerta"
15 | webhook_configs:
16 | - url: 'http://alerta:8080/api/webhooks/prometheus'
17 | send_resolved: true
18 | http_config:
19 | basic_auth:
20 | username: admin@alerta.io
21 | password: alerta
22 |
--------------------------------------------------------------------------------
/examples/apache/webui/Dockerfile:
--------------------------------------------------------------------------------
1 | # build stage
2 | FROM node:14-alpine as build-stage
3 | RUN apk add --no-cache python3 py3-pip make g++
4 | RUN apk add --no-cache git
5 | WORKDIR /app
6 | ADD https://github.com/alerta/alerta-webui/archive/master.tar.gz /tmp/webui.tar.gz
7 | RUN tar zxvf /tmp/webui.tar.gz -C /app --strip-components=1
8 | RUN npm install
9 | COPY .env .
10 | RUN npm run build
11 |
12 | # production stage
13 | FROM nginx:stable-alpine as production-stage
14 | COPY --from=build-stage /app/dist /app
15 | COPY config.json /app/config.json
16 | COPY nginx.conf /etc/nginx/nginx.conf
17 | EXPOSE 80
18 | CMD ["nginx", "-g", "daemon off;"]
19 |
--------------------------------------------------------------------------------
/examples/envoy/webui/Dockerfile:
--------------------------------------------------------------------------------
1 | # build stage
2 | FROM node:14-alpine as build-stage
3 | RUN apk add --no-cache python3 py3-pip make g++
4 | RUN apk add --no-cache git
5 | WORKDIR /app
6 | ADD https://github.com/alerta/alerta-webui/archive/master.tar.gz /tmp/webui.tar.gz
7 | RUN tar zxvf /tmp/webui.tar.gz -C /app --strip-components=1
8 | RUN npm install
9 | COPY .env .
10 | RUN npm run build
11 |
12 | # production stage
13 | FROM nginx:stable-alpine as production-stage
14 | COPY --from=build-stage /app/dist /app
15 | COPY config.json /app/config.json
16 | COPY nginx.conf /etc/nginx/nginx.conf
17 | EXPOSE 80
18 | CMD ["nginx", "-g", "daemon off;"]
19 |
--------------------------------------------------------------------------------
/examples/traefik/webui/Dockerfile:
--------------------------------------------------------------------------------
1 | # build stage
2 | FROM node:14-alpine as build-stage
3 | RUN apk add --no-cache python3 py3-pip make g++
4 | RUN apk add --no-cache git
5 | WORKDIR /app
6 | ADD https://github.com/alerta/alerta-webui/archive/master.tar.gz /tmp/webui.tar.gz
7 | RUN tar zxvf /tmp/webui.tar.gz -C /app --strip-components=1
8 | RUN npm install
9 | COPY .env .
10 | RUN npm run build
11 |
12 | # production stage
13 | FROM nginx:stable-alpine as production-stage
14 | COPY --from=build-stage /app/dist /app
15 | COPY config.json /app/config.json
16 | COPY nginx.conf /etc/nginx/nginx.conf
17 | EXPOSE 80
18 | CMD ["nginx", "-g", "daemon off;"]
19 |
--------------------------------------------------------------------------------
/config/examples/alertad.conf:
--------------------------------------------------------------------------------
1 | DEBUG = True
2 | SECRET = "^Bpa%i8_nCAc8fI4l9)nhn2EG2!@GJga"
3 | AUTH_REQUIRED = True
4 |
5 | SEVERITY_MAP = {
6 | 'fatal': 0,
7 | 'critical': 1,
8 | 'major': 2,
9 | 'minor': 3,
10 | 'warning': 4,
11 | 'indeterminate': 5,
12 | 'cleared': 5,
13 | 'normal': 5,
14 | 'ok': 5,
15 | 'informational': 6,
16 | 'debug': 7,
17 | 'trace': 8,
18 | 'unknown': 9
19 | }
20 | DEFAULT_NORMAL_SEVERITY = 'normal' # 'normal', 'ok', 'cleared'
21 | DEFAULT_PREVIOUS_SEVERITY = 'indeterminate'
22 |
23 | PLUGINS = ['reject', 'blackout', 'geoip', 'normalise']
24 | GEOIP_URL = 'http://ip-api.com/json'
25 |
--------------------------------------------------------------------------------
/examples/nginx/webui/Dockerfile:
--------------------------------------------------------------------------------
1 | # build stage
2 | FROM node:14-alpine as build-stage
3 |
4 | RUN apk add --no-cache python3 py3-pip make g++
5 | RUN apk add --no-cache git
6 | WORKDIR /app
7 | ADD https://github.com/alerta/alerta-webui/archive/master.tar.gz /tmp/webui.tar.gz
8 | RUN tar zxvf /tmp/webui.tar.gz -C /app --strip-components=1
9 | RUN npm install
10 | COPY .env .
11 | RUN npm run build
12 |
13 | # production stage
14 | FROM nginx:stable-alpine as production-stage
15 | COPY --from=build-stage /app/dist /app
16 | COPY config.json /app/config.json
17 | COPY nginx.conf /etc/nginx/nginx.conf
18 | EXPOSE 80
19 | CMD ["nginx", "-g", "daemon off;"]
20 |
--------------------------------------------------------------------------------
/plugins.txt:
--------------------------------------------------------------------------------
1 | plugins/alertops master
2 | plugins/amqp master
3 | plugins/cachet master
4 | plugins/dingtalk master
5 | plugins/enhance master
6 | plugins/geoip master
7 | plugins/influxdb master
8 | plugins/logstash master
9 | plugins/mattermost master
10 | plugins/msteams master
11 | plugins/normalise master
12 | plugins/op5 master
13 | plugins/opsgenie master
14 | plugins/pagerduty master
15 | plugins/prometheus master
16 | plugins/pubsub master
17 | plugins/pushover master
18 | plugins/rocketchat master
19 | plugins/slack master
20 | plugins/sns master
21 | plugins/syslog master
22 | plugins/telegram master
23 | plugins/twilio master
24 | plugins/zabbix master
25 |
--------------------------------------------------------------------------------
/examples/nginx/README.md:
--------------------------------------------------------------------------------
1 | # NGINX Reverse Proxy Example
2 |
3 | This is an example configuration to demonstrate how to proxy
4 | the web UI and Alerta API on a non-root URL sub-path.
5 |
6 | ## Containers
7 |
8 | - nginx reverse proxy
9 | - webui (custom built image)
10 | - api (using official docker image)
11 | - db (postgres image)
12 |
13 | ## Run
14 |
15 | $ cd examples/nginx
16 | $ docker-compose build
17 | $ docker-compose up
18 |
19 | ## Endpoints
20 |
21 | - web UI => http://local.alerta.io/alerta/ui
22 | - API => http://local.alerta.io/alerta/api
23 |
24 | ## References
25 |
26 | https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
27 |
--------------------------------------------------------------------------------
/tests/spec/helpers/client.rb:
--------------------------------------------------------------------------------
1 | require 'rest-client'
2 |
3 | module Client
4 | include RestClient
5 |
6 | def self.get(*args)
7 | begin
8 | RestClient.get(*args)
9 | rescue => e
10 | e.response
11 | end
12 | end
13 |
14 | def self.post(*args)
15 | begin
16 | RestClient.post(*args)
17 | rescue => e
18 | e.response
19 | end
20 | end
21 |
22 | def self.put(*args)
23 | begin
24 | RestClient.put(*args)
25 | rescue => e
26 | e.response
27 | end
28 | end
29 |
30 | def self.delete(*args)
31 | begin
32 | RestClient.delete(*args)
33 | rescue => e
34 | e.response
35 | end
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/contrib/kubernetes/frontend/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM nginx:1.13
2 |
3 | ADD https://github.com/alerta/angular-alerta-webui/archive/master.tar.gz /tmp/web.tar.gz
4 | RUN tar zxvf /tmp/web.tar.gz -C /tmp && \
5 | rm -rf /usr/share/nginx/html && \
6 | mv /tmp/angular-alerta-webui-master/app /usr/share/nginx/html && \
7 | mv /usr/share/nginx/html/config.json /usr/share/nginx/html/config.json.orig
8 |
9 |
10 | ENV ALERTA_API_SERVER 'http://alerta:8080/'
11 |
12 | COPY config.json.template /usr/share/nginx/html/config.json.template
13 | COPY alerta-frontend-entrypoint.sh /alerta-frontend-entrypoint.sh
14 |
15 | ENTRYPOINT ["/alerta-frontend-entrypoint.sh"]
16 | CMD ["nginx", "-g", "daemon off;"]
17 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ include "alerta.fullname" . }}
5 | labels:
6 | app: {{ include "alerta.name" . }}
7 | chart: {{ include "alerta.chart" . }}
8 | release: {{ .Release.Name }}
9 | heritage: {{ .Release.Service }}
10 | spec:
11 | type: {{ .Values.service.type }}
12 | ports:
13 | - port: {{ .Values.service.port }}
14 | targetPort: http
15 | protocol: TCP
16 | name: http
17 | {{- if contains "NodePort" .Values.service.type }}
18 | nodePort: {{ default "30080" .Values.service.nodeport }}
19 | {{- end}}
20 | selector:
21 | app: {{ include "alerta.name" . }}
22 | release: {{ .Release.Name }}
23 |
--------------------------------------------------------------------------------
/examples/envoy/README.md:
--------------------------------------------------------------------------------
1 | # Envoy Proxy Example
2 |
3 | This is an example configuration to demonstrate how to proxy
4 | the web UI and Alerta API on a non-root URL sub-path using Envoy.
5 |
6 | ## Containers
7 |
8 | - envoy proxy
9 | - webui (custom built image)
10 | - api (using official docker image)
11 | - db (postgres image)
12 |
13 | ## Run
14 |
15 | $ cd examples/envoy
16 | $ docker-compose build
17 | $ docker-compose up -d
18 | $ docker-compose up -d --scale webui=2
19 | $ docker-compose up -d --scale api=3
20 |
21 | ## Endpoints
22 |
23 | - web UI =>
24 | - API =>
25 |
26 | ## References
27 |
28 |
29 |
--------------------------------------------------------------------------------
/examples/nagios/config/heartbeat.cfg:
--------------------------------------------------------------------------------
1 | # cfg_file=/usr/local/nagios/etc/objects/nagios4-heartbeat.cfg
2 |
3 | define command{
4 | command_name check_heartbeat
5 | command_line $USER1$/check_dummy 0
6 | }
7 |
8 | define hostgroup {
9 | hostgroup_name nagios-servers
10 | alias Nagios servers
11 | members localhost
12 | }
13 |
14 | define service {
15 | hostgroup_name nagios-servers
16 | service_description Heartbeat
17 | check_command check_heartbeat
18 | use generic-service
19 | notification_interval 0 ; set > 0 if you want to be renotified
20 | normal_check_interval 1
21 | }
22 |
--------------------------------------------------------------------------------
/examples/apache/README.md:
--------------------------------------------------------------------------------
1 | # Apache Reverse Proxy Example
2 |
3 | This is an example configuration to demonstrate how to proxy
4 | the web UI and Alerta API on a non-root URL sub-path using Apache.
5 |
6 | ## Containers
7 |
8 | - apache httpd as reverse proxy
9 | - webui (custom built image)
10 | - api (using official docker image)
11 | - db (postgres image)
12 |
13 | ## Run
14 |
15 | $ cd examples/apache
16 | $ docker-compose build
17 | $ docker-compose up -d
18 | $ docker-compose up -d --scale webui=2
19 | $ docker-compose up -d --scale api=3
20 |
21 | ## Endpoints
22 |
23 | - web UI =>
24 | - API =>
25 |
26 | ## References
27 |
28 |
29 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/secrets.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: {{ template "alerta.fullname" . }}
5 | labels:
6 | app: {{ template "alerta.fullname" . }}
7 | chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
8 | release: "{{ .Release.Name }}"
9 | heritage: "{{ .Release.Service }}"
10 | type: Opaque
11 | data:
12 | {{ if .Values.alertaAdminPassword }}
13 | alerta-admin-password: {{ .Values.alertaAdminPassword | b64enc | quote }}
14 | {{ else }}
15 | alerta-admin-password: {{ randAlphaNum 10 | b64enc | quote }}
16 | {{ end }}
17 | {{ if .Values.alertaAdminKey }}
18 | alerta-admin-key: {{ .Values.alertaAdminKey | b64enc | quote }}
19 | {{ end }}
20 | {{ if .Values.alertaApiKey }}
21 | alerta-api-key: {{ .Values.alertaApiKey | b64enc | quote }}
22 | {{ end }}
23 |
--------------------------------------------------------------------------------
/examples/ldap/config/alertad.conf:
--------------------------------------------------------------------------------
1 | SECRET = "^Bpa%i8_nCAc8fI4l9)nhn2EG2!@GJga"
2 |
3 | AUTH_PROVIDER = 'ldap'
4 | ADMIN_USERS = ['professor@planetexpress.com']
5 | ALLOWED_EMAIL_DOMAINS = ['planetexpress.com']
6 | LDAP_URL = 'ldap://host.docker.internal:389' # openldap container
7 | LDAP_BASEDN = 'dc=planetexpress,dc=com'
8 |
9 | LDAP_BIND_USERNAME = 'cn=admin,dc=planetexpress,dc=com'
10 | LDAP_BIND_PASSWORD = 'GoodNewsEveryone'
11 |
12 | LDAP_USER_BASEDN = 'ou=people,dc=planetexpress,dc=com'
13 | LDAP_USER_FILTER = '(&(uid={username})(objectClass=inetOrgPerson))'
14 | LDAP_USER_NAME_ATTR = 'cn'
15 | LDAP_USER_EMAIL_ATTR = 'mail'
16 |
17 | LDAP_GROUP_BASEDN = 'ou=people,dc=planetexpress,dc=com'
18 | LDAP_GROUP_FILTER = '(&(member={userdn})(objectClass=group))'
19 | LDAP_GROUP_NAME_ATTR = 'cn'
20 |
21 | LDAP_DEFAULT_DOMAIN = 'planetexpress.com'
22 |
--------------------------------------------------------------------------------
/config/templates/app/uwsgi.ini.j2:
--------------------------------------------------------------------------------
1 | [uwsgi]
2 | chdir = /app
3 | module = wsgi
4 | manage-script-name = true
5 | mount = /api=wsgi:app
6 | master = true
7 | processes = {{ env.UWSGI_PROCESSES }}
8 | listen = {{ env.UWSGI_LISTEN }}
9 | {%- if env.UWSGI_MAX_WORKER_LIFETIME %}
10 | max-worker-lifetime = {{ env.UWSGI_MAX_WORKER_LIFETIME }}
11 | max-worker-lifetime-delta = {{ env.UWSGI_WORKER_LIFETIME_DELTA }}
12 | {%- endif %}
13 |
14 | {%- if env.UWSGI_THREADS %}
15 | threads = {{ env.UWSGI_THREADS }}
16 | enable-threads = True
17 | {%- endif %}
18 |
19 | socket = 127.0.0.1:29000
20 | buffer-size = {{ env.UWSGI_BUFFER_SIZE }}
21 | chmod-socket = 664
22 | uid = alerta
23 | gid = root
24 | vacuum = true
25 |
26 | die-on-term = true
27 |
28 | {%- if env.DEBUG %}
29 | show-config
30 | stats = :1717
31 | stats-http
32 | {%- else %}
33 | disable-logging = True
34 | {%- endif %}
35 |
--------------------------------------------------------------------------------
/examples/federated/config/logging.conf:
--------------------------------------------------------------------------------
1 | {
2 | 'version': 1,
3 | 'disable_existing_loggers': False,
4 | 'formatters': {
5 | 'standard': {
6 | 'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
7 | },
8 | },
9 | 'handlers': {
10 | 'default': {
11 | 'level': 'DEBUG',
12 | 'formatter': 'standard',
13 | 'class': 'logging.StreamHandler',
14 | 'stream': 'ext://sys.stdout',
15 | },
16 | },
17 | 'loggers': {
18 | 'mohawk': { # HMAC
19 | 'handlers': ['default'],
20 | 'level': 'DEBUG',
21 | 'propagate': False
22 | },
23 | 'alerta.plugins.forwarder': {
24 | 'handlers': ['default'],
25 | 'level': 'DEBUG',
26 | 'propagate': False
27 | },
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/examples/saml/README.md:
--------------------------------------------------------------------------------
1 | # Alerta with SAML2 IdP Example
2 |
3 | ## IMPORTANT
4 |
5 | NOTE: You must add the following entry to /etc/hosts for this to work:
6 |
7 | 127.0.0.1 host.docker.internal
8 |
9 | ## Run
10 |
11 | $ docker-compose up
12 |
13 | => http://local.alerta.io:8080/login user1/user1pass
14 |
15 | ### Example auth data
16 |
17 | ```
18 | {
19 | "Attributes": {
20 | "uid": [
21 | "2"
22 | ],
23 | "first_name": [
24 | "User"
25 | ],
26 | "last_name": [
27 | "Two"
28 | ],
29 | "email": [
30 | "user_2@example.com"
31 | ]
32 | },
33 | "Authority": "example-userpass",
34 | "AuthnInstant": 1604355254,
35 | "Expire": 1604384054
36 | }
37 | ```
38 |
39 | ## References
40 |
41 | https://hub.docker.com/r/jamedjo/test-saml-idp/
42 |
--------------------------------------------------------------------------------
/contrib/kubernetes/backend/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.6
2 | ENV PYTHONUNBUFFERED 1
3 |
4 | ARG VERSION
5 |
6 | RUN apt-get update && apt-get install -y \
7 | mongodb-clients \
8 | postgresql-client \
9 | gettext
10 |
11 | RUN pip install --no-cache-dir virtualenv && \
12 | virtualenv --python=python3 /venv && \
13 | /venv/bin/pip install uwsgi alerta alerta-server==$VERSION
14 |
15 | ENV PATH $PATH:/venv/bin
16 |
17 | WORKDIR /app
18 |
19 | RUN chgrp -R 0 /app /venv && \
20 | chmod -R g=u /app /venv && \
21 | useradd -u 1001 -g 0 alerta
22 |
23 | USER 1001
24 |
25 | COPY wsgi.py /app/wsgi.py
26 | COPY uwsgi.ini /app/uwsgi.ini
27 |
28 | ENV ALERTA_SVR_CONF_FILE /app/alertad.conf
29 | ENV ALERTA_CONF_FILE /app/alerta.conf
30 | ENV BASE_URL /
31 | ENV INSTALL_PLUGINS ""
32 |
33 | EXPOSE 8080
34 |
35 | COPY docker-entrypoint.sh /
36 | ENTRYPOINT ["/docker-entrypoint.sh"]
37 | CMD ["uwsgi", "--ini", "/app/uwsgi.ini"]
38 |
--------------------------------------------------------------------------------
/examples/basic/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | image: alerta/alerta-web
5 | ports:
6 | - 8080:8080
7 | depends_on:
8 | - db
9 | environment:
10 | # - DEBUG=1 # remove this line to turn DEBUG off
11 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
12 | - AUTH_REQUIRED=True
13 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
14 | - ADMIN_PASSWORD=super-secret # default is "alerta"
15 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
16 | - ADMIN_KEY_MAXAGE=500
17 | # - PLUGINS=remote_ip,reject,heartbeat,blackout,normalise,enhance
18 | restart: always
19 | db:
20 | image: postgres
21 | volumes:
22 | - ./pg-data:/var/lib/postgresql/data
23 | environment:
24 | POSTGRES_DB: monitoring
25 | POSTGRES_USER: postgres
26 | POSTGRES_PASSWORD: postgres
27 | restart: always
28 |
29 |
--------------------------------------------------------------------------------
/examples/snmptrap/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | snmptrap:
4 | #image: alerta/alerta-snmptrap
5 | build: .
6 | volumes:
7 | - $PWD/config/snmptrapd.conf:/etc/snmp/snmptrapd.conf
8 | ports:
9 | - "1662:162/udp"
10 | environment:
11 | - ALERTA_ENDPOINT=http://alerta:8080/api
12 | command: ["snmptrapd", "-f", "-Lo", "-n", "-m+ALL", "-Dtrap"]
13 |
14 | alerta:
15 | image: alerta/alerta-web
16 | ports:
17 | - 8081:8080
18 | depends_on:
19 | - db
20 | environment:
21 | - DEBUG=1 # remove this line to turn DEBUG off
22 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
23 | restart: always
24 |
25 | db:
26 | image: postgres
27 | volumes:
28 | - ./pg-data:/var/lib/postgresql/data
29 | environment:
30 | POSTGRES_DB: monitoring
31 | POSTGRES_USER: postgres
32 | POSTGRES_PASSWORD: postgres
33 | restart: always
--------------------------------------------------------------------------------
/examples/traefik/README.md:
--------------------------------------------------------------------------------
1 | # Traefik Reverse Proxy Example
2 |
3 | This is an example configuration to demonstrate how to proxy
4 | the web UI and Alerta API on a non-root URL sub-path using Traefik.
5 |
6 | ## Containers
7 |
8 | - traefik reverse proxy
9 | - webui (custom built image)
10 | - api (using official docker image)
11 | - db (postgres image)
12 |
13 | ## Run
14 |
15 | $ cd examples/nginx
16 | $ docker-compose build
17 | $ docker-compose up -d
18 | $ docker-compose up -d --scale webui=2
19 | $ docker-compose up -d --scale api=3
20 |
21 | ## Endpoints
22 |
23 | - web UI =>
24 | - API =>
25 | - Traefik =>
26 |
27 | ## References
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/examples/nginx/proxy/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | error_log /var/log/nginx/error.log warn;
4 | pid /var/run/nginx.pid;
5 | events {
6 | worker_connections 1024;
7 | }
8 | http {
9 | include /etc/nginx/mime.types;
10 | include /etc/nginx/proxy.conf;
11 | default_type application/octet-stream;
12 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
13 | '$status $body_bytes_sent "$http_referer" '
14 | '"$http_user_agent" "$http_x_forwarded_for"';
15 | access_log /var/log/nginx/access.log main;
16 | sendfile on;
17 | keepalive_timeout 65;
18 |
19 | server { # simple reverse-proxy
20 | listen 80;
21 | server_name localhost;
22 |
23 | location /alerta/ui {
24 | proxy_pass http://web:80/;
25 | }
26 | location /alerta/api {
27 | proxy_pass http://api:8080/api;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/examples/federated/config/alertad-mlm1.conf:
--------------------------------------------------------------------------------
1 | BASE_URL='http://mlm1.local.alerta.io:8080/api'
2 |
3 | DEBUG = True
4 | LOG_LEVEL = 'DEBUG'
5 | LOG_CONFIG_FILE = '/app/logging.conf'
6 | AUDIT_LOG = True
7 | AUDIT_TRAIL = ['admin', 'write', 'auth']
8 | PLUGINS=['forwarder']
9 |
10 | HMAC_AUTH_CREDENTIALS = [
11 | { # mlm1
12 | 'key': '2dfbc0f3-29e6-4752-ae4e-7a2724d96c22',
13 | 'secret': 'OTNhZTdiNDk2ODM2YTRjMzMyNzMwMGVkYTkxYTFhNWYK',
14 | 'algorithm': 'sha256'
15 | },
16 | ]
17 |
18 | FWD_DESTINATIONS = [
19 | ('http://mom1.local.alerta.io:8080/api', {
20 | 'key': 'c075b86b-293c-4539-b825-14ec0130f06d',
21 | 'secret': 'ZmEwM2E0MWQxZWQ0ZDA5ZDY5NTBmY2Q0OTU5ZjBkNGYK'
22 | }, ['*']), # Hawk HMAC
23 | ('http://mom2.local.alerta.io:8080/api', {
24 | 'key': '63cac7c0-5536-4bde-9415-2f0fa5f26281',
25 | 'secret': 'NjcyM2NjZmNmMDBiMTM4MjEyMDYwNzBiMWVkZGU5YWQK'
26 | }, ['*']), # Hawk HMAC
27 | ]
28 |
--------------------------------------------------------------------------------
/examples/federated/config/alertad-mlm2.conf:
--------------------------------------------------------------------------------
1 | BASE_URL='http://mlm2.local.alerta.io:8080/api'
2 |
3 | DEBUG = True
4 | LOG_LEVEL = 'DEBUG'
5 | LOG_CONFIG_FILE = '/app/logging.conf'
6 | AUDIT_LOG = True
7 | AUDIT_TRAIL = ['admin', 'write', 'auth']
8 | PLUGINS=['forwarder']
9 |
10 | HMAC_AUTH_CREDENTIALS = [
11 | { # mlm2
12 | 'key': 'd39a54fb-64b1-426e-8734-7895ca7f9eb1',
13 | 'secret': 'YjBhNTRiMDY1MmQwMDQxMjIxOGI2MWE5NTU3YjdlMGMK',
14 | 'algorithm': 'sha256'
15 | },
16 | ]
17 |
18 | FWD_DESTINATIONS = [
19 | ('http://mom1.local.alerta.io:8080/api', {
20 | 'key': 'c075b86b-293c-4539-b825-14ec0130f06d',
21 | 'secret': 'ZmEwM2E0MWQxZWQ0ZDA5ZDY5NTBmY2Q0OTU5ZjBkNGYK'
22 | }, ['*']), # Hawk HMAC
23 | ('http://mom2.local.alerta.io:8080/api', {
24 | 'key': '63cac7c0-5536-4bde-9415-2f0fa5f26281',
25 | 'secret': 'NjcyM2NjZmNmMDBiMTM4MjEyMDYwNzBiMWVkZGU5YWQK'
26 | }, ['*']), # Hawk HMAC
27 | ]
28 |
--------------------------------------------------------------------------------
/examples/webhook/README.md:
--------------------------------------------------------------------------------
1 | # Custom Webhook Example
2 |
3 | This is an example configuration to demonstrate how to extend
4 | the "official" base image to add a custom webhook or plugin.
5 |
6 | ## Containers
7 |
8 | - custom image using "official" image as base
9 |
10 | ## Run
11 |
12 | $ cd examples/webhook
13 | $ docker-compose build
14 | $ docker-compose up
15 |
16 | ## Test
17 |
18 | List all webhooks:
19 |
20 | $ curl http://localhost:9000/api/
21 |
22 | Send test webhook payload:
23 |
24 | $ curl -XPOST http://localhost:9000/api/webhooks/msteams \
25 | -H 'Content-Type: application/json' \
26 | -H 'X-API-Key: demo-key' \
27 | -d '{"action":"ack","alert_id":"da9b3d24-3ee3-4cdc-8a58-a6533c9e9af9"}'
28 |
29 | ## Endpoints
30 |
31 | - web UI =>
32 | - API =>
33 |
34 | ## References
35 |
36 |
37 |
--------------------------------------------------------------------------------
/config/templates/app/supervisord.conf.j2:
--------------------------------------------------------------------------------
1 | [supervisord]
2 | nodaemon=true
3 | logfile=/tmp/supervisord.log
4 | loglevel={{ env.SUPERVISORD_LOG_LEVEL|lower or 'debug' }}
5 | pidfile=/tmp/supervisord.pid
6 |
7 | [program:uwsgi]
8 | command=/venv/bin/uwsgi --ini /app/uwsgi.ini
9 | redirect_stderr=true
10 |
11 | [program:nginx]
12 | command=nginx -c /app/nginx.conf
13 | redirect_stderr=true
14 | stopsignal=QUIT
15 |
16 | {% if env.HK_EXPIRED_DELETE_HRS and env.HK_INFO_DELETE_HRS -%}
17 | [program:housekeeping]
18 | command=bash -c "sleep 60 && alerta housekeeping --expired {{ env.HK_EXPIRED_DELETE_HRS }} --info {{ env.HK_INFO_DELETE_HRS }}"
19 | autostart=true
20 | autorestart=true
21 | redirect_stderr=true
22 | {%- endif %}
23 |
24 | {% if env.HEARTBEAT_SEVERITY -%}
25 | [program:heartbeats]
26 | command=sh -c "sleep 60 && alerta heartbeats --alert --severity {{ env.HEARTBEAT_SEVERITY }}"
27 | autostart=true
28 | autorestart=true
29 | redirect_stderr=true
30 | {%- endif %}
31 |
--------------------------------------------------------------------------------
/examples/envoy/webui/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | error_log /var/log/nginx/error.log warn;
4 | pid /var/run/nginx.pid;
5 | events {
6 | worker_connections 1024;
7 | }
8 | http {
9 | include /etc/nginx/mime.types;
10 | default_type application/octet-stream;
11 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
12 | '$status $body_bytes_sent "$http_referer" '
13 | '"$http_user_agent" "$http_x_forwarded_for"';
14 | access_log /var/log/nginx/access.log main;
15 | sendfile on;
16 | keepalive_timeout 65;
17 | server {
18 | listen 80;
19 | server_name localhost;
20 | location / {
21 | root /app;
22 | index index.html;
23 | try_files $uri $uri/ /index.html;
24 | }
25 | error_page 500 502 503 504 /50x.html;
26 | location = /50x.html {
27 | root /usr/share/nginx/html;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/examples/nginx/webui/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | error_log /var/log/nginx/error.log warn;
4 | pid /var/run/nginx.pid;
5 | events {
6 | worker_connections 1024;
7 | }
8 | http {
9 | include /etc/nginx/mime.types;
10 | default_type application/octet-stream;
11 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
12 | '$status $body_bytes_sent "$http_referer" '
13 | '"$http_user_agent" "$http_x_forwarded_for"';
14 | access_log /var/log/nginx/access.log main;
15 | sendfile on;
16 | keepalive_timeout 65;
17 | server {
18 | listen 80;
19 | server_name localhost;
20 | location / {
21 | root /app;
22 | index index.html;
23 | try_files $uri $uri/ /index.html;
24 | }
25 | error_page 500 502 503 504 /50x.html;
26 | location = /50x.html {
27 | root /usr/share/nginx/html;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/examples/apache/webui/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | error_log /var/log/nginx/error.log warn;
4 | pid /var/run/nginx.pid;
5 | events {
6 | worker_connections 1024;
7 | }
8 | http {
9 | include /etc/nginx/mime.types;
10 | default_type application/octet-stream;
11 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
12 | '$status $body_bytes_sent "$http_referer" '
13 | '"$http_user_agent" "$http_x_forwarded_for"';
14 | access_log /var/log/nginx/access.log main;
15 | sendfile on;
16 | keepalive_timeout 65;
17 | server {
18 | listen 80;
19 | server_name localhost;
20 | location / {
21 | root /app;
22 | index index.html;
23 | try_files $uri $uri/ /index.html;
24 | }
25 | error_page 500 502 503 504 /50x.html;
26 | location = /50x.html {
27 | root /usr/share/nginx/html;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/examples/traefik/webui/nginx.conf:
--------------------------------------------------------------------------------
1 | user nginx;
2 | worker_processes 1;
3 | error_log /var/log/nginx/error.log warn;
4 | pid /var/run/nginx.pid;
5 | events {
6 | worker_connections 1024;
7 | }
8 | http {
9 | include /etc/nginx/mime.types;
10 | default_type application/octet-stream;
11 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
12 | '$status $body_bytes_sent "$http_referer" '
13 | '"$http_user_agent" "$http_x_forwarded_for"';
14 | access_log /var/log/nginx/access.log main;
15 | sendfile on;
16 | keepalive_timeout 65;
17 | server {
18 | listen 80;
19 | server_name localhost;
20 | location / {
21 | root /app;
22 | index index.html;
23 | try_files $uri $uri/ /index.html;
24 | }
25 | error_page 500 502 503 504 /50x.html;
26 | location = /50x.html {
27 | root /usr/share/nginx/html;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/examples/webhook/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 | services:
3 | web:
4 | build: .
5 | image: alerta-web
6 | ports:
7 | - 9000:8080
8 | volumes:
9 | - ./alertad.conf:/app/alertad.conf
10 | environment:
11 | - DEBUG=1 # remove this line to turn DEBUG off
12 | - DATABASE_URL=postgres://alerta:8l3rt8@db:5432/monitoring
13 | - AUTH_REQUIRED=True
14 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
15 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS list
16 | - PLUGINS=reject,blackout,normalise,enhance
17 | networks:
18 | - net
19 | depends_on:
20 | - db
21 | restart: always
22 | db:
23 | image: postgres
24 | volumes:
25 | - ./pg-data:/var/lib/postgresql/data
26 | environment:
27 | POSTGRES_DB: monitoring
28 | POSTGRES_USER: alerta
29 | POSTGRES_PASSWORD: 8l3rt8
30 | networks:
31 | - net
32 | restart: always
33 | networks:
34 | net: {}
35 |
--------------------------------------------------------------------------------
/examples/google/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | image: alerta/alerta-web
5 | ports:
6 | - 8080:8080
7 | depends_on:
8 | - db
9 | environment:
10 | - DEBUG=1
11 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
12 | - AUTH_REQUIRED=True
13 | - AUTH_PROVIDER=google
14 | # - AUTH_PROVIDER=openid
15 | # - OIDC_ISSUER_URL=https://accounts.google.com
16 | - OAUTH2_CLIENT_ID=736147134702-gspe3a3v9b98drelu32uio4a0tuurkj3.apps.googleusercontent.com
17 | - OAUTH2_CLIENT_SECRET=xNwEm5sgJFeqpKZVN_tdsjYe
18 | - OIDC_VERIFY_TOKEN=True
19 | - ALLOWED_EMAIL_DOMAINS=gmail.com
20 | - ADMIN_USERS=nfsatterly@gmail.com
21 | - ADMIN_KEY=demo-key
22 | restart: always
23 | db:
24 | image: postgres
25 | volumes:
26 | - ./pg-data:/var/lib/postgresql/data
27 | environment:
28 | POSTGRES_DB: monitoring
29 | POSTGRES_USER: postgres
30 | POSTGRES_PASSWORD: postgres
31 | restart: always
32 |
--------------------------------------------------------------------------------
/examples/gitlab/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | alerta:
5 | image: alerta/alerta-web
6 | ports:
7 | - 9080:8080
8 | depends_on:
9 | - db
10 | environment:
11 | - DEBUG=1 # remove this line to turn DEBUG off
12 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
13 | - AUTH_REQUIRED=True
14 | - CUSTOMER_VIEWS=True
15 | - ADMIN_USERS=satterly
16 | - AUTH_PROVIDER=gitlab
17 | - OAUTH2_CLIENT_ID=73cb4a5e279b85caf4ae39e7c0a3a88a07d9a099da1bd84958b63b7195ae3768
18 | - OAUTH2_CLIENT_SECRET=06b850ce35a171397e31b8ae85253450a5127049886e42cc670722ca2aa837ed
19 | - GOOGLE_TRACKING_ID=UA-44644195-6
20 | - PLUGINS=remote_ip,reject,heartbeat,blackout,normalise,enhance
21 | restart: always
22 |
23 | db:
24 | image: postgres
25 | volumes:
26 | - ./pg-data:/var/lib/postgresql/data
27 | environment:
28 | POSTGRES_DB: monitoring
29 | POSTGRES_USER: postgres
30 | POSTGRES_PASSWORD: postgres
31 | restart: always
32 |
--------------------------------------------------------------------------------
/examples/nagios/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | alerta:
5 | image: alerta/alerta-web
6 | ports:
7 | - 9080:8080
8 | depends_on:
9 | - db
10 | environment:
11 | - DEBUG=1 # remove this line to turn DEBUG off
12 | - DATABASE_URL=mongodb://db:27017/monitoring
13 | - AUTH_REQUIRED=True
14 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
15 | - ADMIN_PASSWORD=password
16 | - ADMIN_KEY=demo-key
17 | - TRACKING_ID=UA-44644195-6
18 | - PLUGINS=reject,heartbeat,blackout,normalise,enhance
19 | restart: always
20 |
21 | db:
22 | image: mongo
23 | volumes:
24 | - ./data/mongodb:/data/db
25 | restart: always
26 |
27 | nagios:
28 | # image: jasonrivers/nagios
29 | build: .
30 | volumes:
31 | - ./config/nagios.cfg:/opt/nagios/etc/nagios.cfg
32 | # - ./config/alerta-neb.o:/opt/nagios/libexec/alerta-neb.o
33 | - ./config/heartbeat.cfg:/opt/nagios/etc/conf.d/heartbeat.cfg
34 | ports:
35 | - 8100:80
36 | restart: always
37 |
--------------------------------------------------------------------------------
/examples/icinga/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | icinga2:
5 | image: jordan/icinga2
6 | volumes:
7 | - ./data/icinga/cache:/var/cache/icinga2
8 | - ./data/icinga/certs:/etc/apache2/ssl
9 | - ./data/icinga/etc/icinga2:/etc/icinga2
10 | - ./data/icinga/etc/icingaweb2:/etc/icingaweb2
11 | - ./data/icinga/lib/icinga:/var/lib/icinga2
12 | - ./data/icinga/lib/php/sessions:/var/lib/php/sessions
13 | - ./data/icinga/log/apache2:/var/log/apache2
14 | - ./data/icinga/log/icinga2:/var/log/icinga2
15 | - ./data/icinga/log/icingaweb2:/var/log/icingaweb2
16 | - ./data/icinga/log/mysql:/var/log/mysql
17 | - ./data/icinga/spool:/var/spool/icinga2
18 | ports:
19 | - 5080:80
20 | - 5443:443
21 | - 5665:5665
22 | environment:
23 | # icingaadmin / icinga
24 | - ICINGAWEB2_ADMIN_USER=icingaadmin
25 | - ICINGAWEB2_ADMIN_PASS=icinga
26 | restart: always
27 | networks:
28 | - alerta_sharednet
29 |
30 | networks:
31 | alerta_sharednet:
32 | external: true
33 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | web:
5 | image: alerta/alerta-web
6 | # volumes:
7 | # - $PWD/config/config.json:/web/config.json
8 | ports:
9 | - 8080:8080
10 | depends_on:
11 | - db
12 | environment:
13 | # - DEBUG=1 # remove this line to turn DEBUG off
14 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
15 | - AUTH_REQUIRED=True
16 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
17 | - ADMIN_PASSWORD=super-secret # default is "alerta"
18 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
19 | - ADMIN_KEY_MAXAGE=500
20 | # - NGINX_MAX_BODY_SIZE=42M # allow larger alerts to be processed by alerta
21 | # - PLUGINS=remote_ip,reject,heartbeat,blackout,normalise,enhance
22 | restart: always
23 |
24 | db:
25 | image: postgres
26 | volumes:
27 | - ./pg-data:/var/lib/postgresql/data
28 | environment:
29 | POSTGRES_DB: monitoring
30 | POSTGRES_USER: postgres
31 | POSTGRES_PASSWORD: postgres
32 | restart: always
33 |
--------------------------------------------------------------------------------
/examples/alerta/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | image: alerta/alerta-web
5 | build:
6 | context: ../..
7 | args:
8 | VCS_REF: 1
9 | VERSION: 8.6.4
10 | volumes:
11 | - $PWD/config/alertad.conf:/app/alertad.conf
12 | # - $PWD/config/alerta.conf:/app/alerta.conf
13 | # - $PWD/config/config.json:/web/config.json
14 | ports:
15 | - 8080:8080
16 | depends_on:
17 | - db
18 | environment:
19 | - DEBUG=1
20 | - LOG_LEVEL=info # debug,info,notice,warn,error,crit,alert,emerg
21 | - AUTH_REQUIRED=True # FIXME should not have to declare this twice
22 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io,admin@alerta.dev
23 | - ADMIN_PASSWORD=super-secret
24 | - ADMIN_KEY=demo-key
25 | - ADMIN_KEY_MAXAGE=86400
26 | restart: always
27 | db:
28 | image: postgres
29 | volumes:
30 | - ./pg-data:/var/lib/postgresql/data
31 | environment:
32 | POSTGRES_DB: monitoring
33 | POSTGRES_USER: postgres
34 | POSTGRES_PASSWORD: postgres
35 | restart: always
36 |
--------------------------------------------------------------------------------
/examples/federated/config/alertad-mom1.conf:
--------------------------------------------------------------------------------
1 | BASE_URL='http://mom1.local.alerta.io:8080/api'
2 |
3 | DEBUG = True
4 | LOG_LEVEL = 'DEBUG'
5 | LOG_CONFIG_FILE = '/app/logging.conf'
6 | AUDIT_LOG = True
7 | AUDIT_TRAIL = ['admin', 'write', 'auth']
8 | PLUGINS=['forwarder']
9 |
10 | HMAC_AUTH_CREDENTIALS = [
11 | { # mom1
12 | 'key': 'c075b86b-293c-4539-b825-14ec0130f06d',
13 | 'secret': 'ZmEwM2E0MWQxZWQ0ZDA5ZDY5NTBmY2Q0OTU5ZjBkNGYK',
14 | 'algorithm': 'sha256'
15 | }
16 | ]
17 |
18 | FWD_DESTINATIONS = [
19 | # ('http://mom2.local.alerta.io:8080/api', {'key': 'demo-key'}, ['alerts', 'actions']),
20 | # ('http://mom2.local.alerta.io:8080/api', {'username': 'admin@alerta.io', 'password': 'alerta'}, ['alerts', 'actions']),
21 | # ('http://mom2.local.alerta.io:8080/api', dict(username='admin@alerta.io', password='alerta', ssl_verify=False), ['alerts', 'actions']),
22 | ('http://mom2.local.alerta.io:8080/api', {
23 | 'key': '63cac7c0-5536-4bde-9415-2f0fa5f26281',
24 | 'secret': 'NjcyM2NjZmNmMDBiMTM4MjEyMDYwNzBiMWVkZGU5YWQK'
25 | }, ['*']), # Hawk HMAC
26 | ]
27 |
--------------------------------------------------------------------------------
/examples/federated/config/alertad-mom2.conf:
--------------------------------------------------------------------------------
1 | BASE_URL='http://mom2.local.alerta.io:8080/api'
2 |
3 | DEBUG = True
4 | LOG_LEVEL = 'DEBUG'
5 | LOG_CONFIG_FILE = '/app/logging.conf'
6 | AUDIT_LOG = True
7 | AUDIT_TRAIL = ['admin', 'write', 'auth']
8 | PLUGINS=['forwarder']
9 |
10 | HMAC_AUTH_CREDENTIALS = [
11 | { # mom2
12 | 'key': '63cac7c0-5536-4bde-9415-2f0fa5f26281',
13 | 'secret': 'NjcyM2NjZmNmMDBiMTM4MjEyMDYwNzBiMWVkZGU5YWQK',
14 | 'algorithm': 'sha256'
15 | },
16 | ]
17 |
18 | FWD_DESTINATIONS = [
19 | # ('http://mom1.local.alerta.io:8080/api', {'key': 'demo-key'}, ['alerts', 'actions']),
20 | # ('http://mom1.local.alerta.io:8080/api', {'username': 'admin@alerta.io', 'password': 'alerta'}, ['alerts', 'actions']),
21 | # ('http://mom1.local.alerta.io:8080/api', dict(username='admin@alerta.io', password='alerta', ssl_verify=False), ['alerts', 'actions']),
22 | ('http://mom1.local.alerta.io:8080/api', {
23 | 'key': 'c075b86b-293c-4539-b825-14ec0130f06d',
24 | 'secret': 'ZmEwM2E0MWQxZWQ0ZDA5ZDY5NTBmY2Q0OTU5ZjBkNGYK'
25 | }, ['*']), # Hawk HMAC
26 | ]
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014-2021 Nick Satterly
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/examples/keycloak/README.md:
--------------------------------------------------------------------------------
1 | # Alerta with Keycloak Auth
2 |
3 | Containers
4 | ----------
5 |
6 | * Alerta web
7 | * Postgres database for Alerta
8 | * [Keycloak](https://hub.docker.com/r/jboss/keycloak/)
9 |
10 | ## Configuration
11 |
12 | Step 1.
13 | The hostname "host.docker.internal" must resolve to "127.0.0.12".
14 |
15 | **Example /etc/hosts file**
16 |
17 | ```
18 | ##
19 | # Host Database
20 | #
21 | # localhost is used to configure the loopback interface
22 | # when the system is booting. Do not change this entry.
23 | ##
24 | 127.0.0.1 localhost host.docker.internal
25 | 255.255.255.255 broadcasthost
26 | ::1 localhost
27 | ```
28 |
29 | Step 3. Launch services
30 |
31 | $ docker-compose up
32 |
33 | Step 3. Login to Alerta Web UI
34 |
35 | Using credentials "alice" / "alice" login to Alerta web UI
36 |
37 | ## Troubleshooting
38 |
39 | OpenID Connect Wellknown http://host.docker.internal:8080/auth/realms/demo/.well-known/openid-configuration
40 |
41 | ## References
42 |
43 | * Keycloak Docker Compose Example - https://github.com/jboss-dockerfiles/keycloak/blob/master/docker-compose-examples/keycloak-postgres.yml
44 |
--------------------------------------------------------------------------------
/examples/postgres/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | # build: .
5 | image: alerta/alerta-web
6 | # volumes:
7 | # - $PWD/config/alertad.conf.example:/app/alertad.conf
8 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
9 | # - $PWD/config/config.json.example:/web/config.json
10 | ports:
11 | - 8080:8080
12 | depends_on:
13 | - db
14 | environment:
15 | # - DEBUG=1 # remove this line to turn DEBUG off
16 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
17 | - AUTH_REQUIRED=True
18 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
19 | - ADMIN_PASSWORD=super-secret # default is "alerta"
20 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
21 | - ADMIN_KEY_MAXAGE=500
22 | # - PLUGINS=remote_ip,reject,heartbeat,blackout,normalise,enhance
23 | restart: always
24 | db:
25 | image: postgres
26 | volumes:
27 | - ./pg-data:/var/lib/postgresql/data
28 | environment:
29 | POSTGRES_DB: monitoring
30 | POSTGRES_USER: postgres
31 | POSTGRES_PASSWORD: postgres
32 | restart: always
33 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/configmap.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | data:
3 | {{- if or .Values.alertaConfig .Values.postgresql.enabled }}
4 | alertad.conf: |
5 | {{- if .Values.alertaConfig }}
6 | {{ range $key, $value := .Values.alertaConfig }}
7 | {{ $key }} = {{ $value | nindent 4 | trim }}
8 | {{- end }}
9 | {{- end }}
10 | {{ if .Values.postgresql.enabled -}}
11 | DATABASE_URL = "postgresql://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ .Release.Name }}-postgresql:5432/{{ .Values.postgresql.postgresqlDatabase }}"
12 | {{- end }}
13 | {{- end }}
14 | {{- if .Values.alertaWebUIConfig }}
15 | config.js: |
16 | {{ .Values.alertaWebUIConfig | indent 4 }}
17 | {{- end }}
18 | {{- if .Values.extraConfigs }}
19 | {{- range .Values.extraConfigs }}
20 | {{ .subPath }}: |
21 | {{ .data | indent 4 }}
22 | {{- end }}
23 | {{- end }}
24 | kind: ConfigMap
25 | metadata:
26 | name: {{ include "alerta.fullname" . }}
27 | labels:
28 | app: {{ include "alerta.name" . }}
29 | chart: {{ include "alerta.chart" . }}
30 | release: {{ .Release.Name }}
31 | heritage: {{ .Release.Service }}
32 |
--------------------------------------------------------------------------------
/examples/sensu/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | sensu:
5 | image: sensu/sensu
6 | volumes:
7 | - ./data/sensu:/var/lib/sensu
8 | ports:
9 | - 2379:2379
10 | - 2380:2380
11 | - 3000:3000
12 | - 3080:8080
13 | - 3081:8081
14 | command: sensu-backend start --etcd-listen-client-urls http://0.0.0.0:2379 --etcd-name sensu --etcd-advertise-client-urls http://sensu:2379 --etcd-initial-cluster sensu=http://sensu:2380 --etcd-initial-cluster-state new --etcd-initial-advertise-peer-urls http://sensu:2380 --state-dir /var/lib/sensu/sensu/etcd1 --etcd-listen-peer-urls http://0.0.0.0:2380 --log-level info --debug
15 | restart: always
16 | networks:
17 | - alerta_sharednet
18 | - sensunet
19 |
20 | agent:
21 | image: sensu/sensu
22 | volumes:
23 | - ./data/sensu:/var/lib/sensu
24 | depends_on:
25 | - sensu
26 | command: sensu-agent start --backend-url ws://sensu:8081 --subscriptions webserver,system
27 | restart: always
28 | networks:
29 | - alerta_sharednet
30 | - sensunet
31 |
32 | networks:
33 | alerta_sharednet:
34 | external: true
35 | sensunet:
36 | driver: bridge
37 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/_helpers.tpl:
--------------------------------------------------------------------------------
1 | {{/* vim: set filetype=mustache: */}}
2 | {{/*
3 | Expand the name of the chart.
4 | */}}
5 | {{- define "alerta.name" -}}
6 | {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7 | {{- end -}}
8 |
9 | {{/*
10 | Create a default fully qualified app name.
11 | We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12 | If release name contains chart name it will be used as a full name.
13 | */}}
14 | {{- define "alerta.fullname" -}}
15 | {{- if .Values.fullnameOverride -}}
16 | {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17 | {{- else -}}
18 | {{- $name := default .Chart.Name .Values.nameOverride -}}
19 | {{- if contains $name .Release.Name -}}
20 | {{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21 | {{- else -}}
22 | {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23 | {{- end -}}
24 | {{- end -}}
25 | {{- end -}}
26 |
27 | {{/*
28 | Create chart name and version as used by the chart label.
29 | */}}
30 | {{- define "alerta.chart" -}}
31 | {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32 | {{- end -}}
33 |
--------------------------------------------------------------------------------
/examples/azure/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | image: alerta/alerta-web
5 | ports:
6 | - 8080:8080
7 | # => http://localhost:8080/alerts
8 | depends_on:
9 | - db
10 | environment:
11 | - DEBUG=1
12 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
13 | - AUTH_REQUIRED=True
14 | - AUTH_PROVIDER=azure
15 |
16 | # Azure (Common)
17 | - AZURE_TENANT=common
18 | - OAUTH2_CLIENT_ID=00bb046a-36d9-4411-b93a-2f10fb35f0b5
19 | - OAUTH2_CLIENT_SECRET=7GWBR~bYQT0d5MG9Rfs_Ca9-r2YB.6nSG-
20 |
21 | # Azure (Tenant ID)
22 | # - AZURE_TENANT=f24341ef-7a6f-4cff-abb7-99a11ab11127
23 | # - OAUTH2_CLIENT_ID=38ba6223-a887-43e2-9f7d-8d539df55f67
24 | # - OAUTH2_CLIENT_SECRET=/FZ.Sp?-5J4Wt8EdJr1ZWPBz1:t5wYY6
25 |
26 | - ALLOWED_EMAIL_DOMAINS=gmail.com
27 | - ADMIN_USERS=nfsatterly@gmail.com
28 | - ADMIN_KEY=demo-key
29 | restart: always
30 | db:
31 | image: postgres
32 | volumes:
33 | - ./pg-data:/var/lib/postgresql/data
34 | environment:
35 | POSTGRES_DB: monitoring
36 | POSTGRES_USER: postgres
37 | POSTGRES_PASSWORD: postgres
38 | restart: always
39 |
--------------------------------------------------------------------------------
/examples/saml/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | #
3 | # NOTE: You must add the following entry to /etc/hosts for this to work:
4 | #
5 | # 127.0.0.1 host.docker.internal
6 | #
7 | services:
8 | web:
9 | image: alerta/alerta-web
10 | volumes:
11 | - $PWD/config/alertad.conf:/app/alertad.conf
12 | ports:
13 | - 8080:8080
14 | depends_on:
15 | - db
16 | environment:
17 | BASE_URL: http://host.docker.internal:8080/api
18 | DATABASE_URL: postgres://postgres:postgres@db:5432/monitoring
19 | # SAML2 config not supported as environment variables, see config/alertad.conf
20 | restart: always
21 | db:
22 | image: postgres
23 | volumes:
24 | - ./pg-data:/var/lib/postgresql/data
25 | environment:
26 | POSTGRES_DB: monitoring
27 | POSTGRES_USER: postgres
28 | POSTGRES_PASSWORD: postgres
29 | restart: always
30 | idp:
31 | image: jamedjo/test-saml-idp # http://host.docker.internal:9080/simplesaml admin/secret
32 | ports:
33 | - 9080:8080
34 | - 8443:8443
35 | environment:
36 | SIMPLESAMLPHP_SP_ENTITY_ID: http://host.docker.internal:8080/api
37 | SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE: http://host.docker.internal:8080/api/auth/saml
38 |
39 | networks:
40 | default:
41 | name: dev
42 |
--------------------------------------------------------------------------------
/examples/prometheus/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | prometheus:
5 | image: prom/prometheus
6 | volumes:
7 | - ./config:/prometheus
8 | - ./data/prometheus:/data
9 | command:
10 | - '--config.file=/prometheus/prometheus.yml'
11 | - '--storage.tsdb.path=/data'
12 | ports:
13 | - 9090:9090
14 | restart: always
15 | networks:
16 | - promnet
17 |
18 | node:
19 | image: prom/node-exporter
20 | ports:
21 | - 9100:9100
22 | restart: always
23 | networks:
24 | - promnet
25 |
26 | alertmanager:
27 | image: prom/alertmanager
28 | volumes:
29 | - ./config:/prometheus
30 | - ./data/alertmanager:/data
31 | command:
32 | - '--config.file=/prometheus/alertmanager.yml'
33 | - '--storage.path=/data'
34 | ports:
35 | - 9093:9093
36 | networks:
37 | - alerta_sharednet
38 | - promnet
39 |
40 | cadvisor:
41 | image: google/cadvisor
42 | ports:
43 | - 9880:8080
44 | volumes:
45 | - /:/rootfs:ro
46 | - /var/run:/var/run:rw
47 | - /sys:/sys:ro
48 | - /var/lib/docker/:/var/lib/docker:ro
49 | networks:
50 | - promnet
51 |
52 | networks:
53 | alerta_sharednet:
54 | external: true
55 | promnet:
56 | driver: bridge
--------------------------------------------------------------------------------
/tests/docker/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | diff-lcs (1.4.4)
5 | domain_name (0.5.20190701)
6 | unf (>= 0.0.5, < 1.0.0)
7 | http-accept (1.7.0)
8 | http-cookie (1.0.4)
9 | domain_name (~> 0.5)
10 | mime-types (3.4.1)
11 | mime-types-data (~> 3.2015)
12 | mime-types-data (3.2021.1115)
13 | mini_portile2 (2.8.6)
14 | netrc (0.11.0)
15 | nokogiri (1.16.5)
16 | mini_portile2 (~> 2.8.2)
17 | racc (~> 1.4)
18 | racc (1.7.3)
19 | rest-client (2.1.0)
20 | http-accept (>= 1.7.0, < 2.0)
21 | http-cookie (>= 1.0.2, < 2.0)
22 | mime-types (>= 1.16, < 4.0)
23 | netrc (~> 0.8)
24 | rspec (3.10.0)
25 | rspec-core (~> 3.10.0)
26 | rspec-expectations (~> 3.10.0)
27 | rspec-mocks (~> 3.10.0)
28 | rspec-core (3.10.1)
29 | rspec-support (~> 3.10.0)
30 | rspec-expectations (3.10.1)
31 | diff-lcs (>= 1.2.0, < 2.0)
32 | rspec-support (~> 3.10.0)
33 | rspec-mocks (3.10.2)
34 | diff-lcs (>= 1.2.0, < 2.0)
35 | rspec-support (~> 3.10.0)
36 | rspec-support (3.10.3)
37 | unf (0.1.4)
38 | unf_ext
39 | unf_ext (0.0.8)
40 |
41 | PLATFORMS
42 | ruby
43 |
44 | DEPENDENCIES
45 | nokogiri
46 | rest-client
47 | rspec
48 |
49 | BUNDLED WITH
50 | 2.4.6
51 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/ingress.yaml:
--------------------------------------------------------------------------------
1 | {{- if .Values.ingress.enabled -}}
2 | {{- $fullName := include "alerta.fullname" . -}}
3 | {{- $ingressPath := .Values.ingress.path -}}
4 | apiVersion: networking.k8s.io/v1
5 | kind: Ingress
6 | metadata:
7 | name: {{ $fullName }}
8 | labels:
9 | app: {{ include "alerta.name" . }}
10 | chart: {{ include "alerta.chart" . }}
11 | release: {{ .Release.Name }}
12 | heritage: {{ .Release.Service }}
13 | {{- with .Values.ingress.annotations }}
14 | annotations:
15 | {{ toYaml . | indent 4 }}
16 | {{- end }}
17 | spec:
18 | {{- if .Values.ingress.className }}
19 | ingressClassName: {{ .Values.ingress.className }}
20 | {{- end }}
21 | {{- if .Values.ingress.tls }}
22 | tls:
23 | {{- range .Values.ingress.tls }}
24 | - hosts:
25 | {{- range .hosts }}
26 | - {{ . | quote }}
27 | {{- end }}
28 | secretName: {{ .secretName }}
29 | {{- end }}
30 | {{- end }}
31 | rules:
32 | {{- range .Values.ingress.hosts }}
33 | - host: {{ . | quote }}
34 | http:
35 | paths:
36 | - path: {{ $ingressPath }}
37 | pathType: ImplementationSpecific
38 | backend:
39 | service:
40 | name: {{ $fullName }}
41 | port:
42 | name: http
43 | {{- end }}
44 | {{- end }}
45 |
--------------------------------------------------------------------------------
/examples/prometheus/config/prometheus.yml:
--------------------------------------------------------------------------------
1 | # prometheus global config
2 | global:
3 | scrape_interval: 15s
4 | evaluation_interval: 15s
5 | # scrape_timeout is set to the global default (10s).
6 |
7 | external_labels:
8 | monitor: codelab
9 | environment: Production
10 | service: Prometheus
11 | region: EU
12 | dc: eu-west-1
13 |
14 | alerting:
15 | alertmanagers:
16 | - static_configs:
17 | - targets:
18 | - alertmanager:9093
19 |
20 | rule_files:
21 | - "prometheus.rules.yml"
22 |
23 | scrape_configs:
24 | # metrics_path defaults to '/metrics'
25 | # scheme defaults to 'http'.
26 | - job_name: prometheus
27 |
28 | scrape_interval: 5s
29 | scrape_timeout: 2s
30 | honor_labels: true
31 |
32 | static_configs:
33 | - targets: ['prometheus:9090']
34 |
35 | - job_name: cadvisor
36 |
37 | scrape_interval: 5s
38 | scrape_timeout: 2s
39 | honor_labels: true
40 |
41 | static_configs:
42 | - targets: ['cadvisor:8080']
43 |
44 | - job_name: node-exporter
45 |
46 | scrape_interval: 5s
47 | scrape_timeout: 2s
48 | honor_labels: true
49 |
50 | static_configs:
51 | - targets: ['node:9100']
52 |
53 | - job_name: collectd
54 | static_configs:
55 | - targets: ['collectd:9103']
56 |
57 | - job_name: alerta
58 | metrics_path: /api/management/metrics
59 | static_configs:
60 | - targets: ['alerta:8080']
61 | basic_auth:
62 | username: admin@alerta.io
63 | password: alerta
64 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/NOTES.txt:
--------------------------------------------------------------------------------
1 | 1. Get the application URL by running these commands:
2 | {{- if .Values.ingress.enabled }}
3 | {{- range .Values.ingress.hosts }}
4 | http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
5 | {{- end }}
6 | {{- else if contains "NodePort" .Values.service.type }}
7 | export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "alerta.fullname" . }})
8 | export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
9 | echo http://$NODE_IP:$NODE_PORT
10 | {{- else if contains "LoadBalancer" .Values.service.type }}
11 | NOTE: It may take a few minutes for the LoadBalancer IP to be available.
12 | You can watch the status of by running 'kubectl get svc -w {{ include "alerta.fullname" . }}'
13 | export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "alerta.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
14 | echo http://$SERVICE_IP:{{ .Values.service.port }}
15 | {{- else if contains "ClusterIP" .Values.service.type }}
16 | export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "alerta.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
17 | echo "Visit http://127.0.0.1:8080 to use your application"
18 | kubectl port-forward $POD_NAME 8080:{{ .Values.service.port }}
19 | {{- end }}
20 |
--------------------------------------------------------------------------------
/examples/envoy/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | front:
5 | image: envoyproxy/envoy:v1.13.1
6 | volumes:
7 | - ./proxy/front-proxy.yaml:/etc/envoy/envoy.yaml
8 | expose:
9 | - "80"
10 | - "8001"
11 | ports:
12 | - "8000:80"
13 | - "8001:8001"
14 | networks:
15 | - envoymesh
16 |
17 | webui:
18 | build:
19 | context: webui
20 | networks:
21 | envoymesh:
22 | aliases:
23 | - web
24 |
25 | api:
26 | image: alerta/alerta-web # use API in "alerta-web" image
27 | depends_on:
28 | - db
29 | volumes:
30 | - ./api/alertad.conf:/app/alertad.conf
31 | environment:
32 | DEBUG: 1 # remove this line to turn DEBUG off
33 | DATABASE_URL: postgres://postgres:postgres@db:5432/monitoring
34 | AUTH_REQUIRED: "True"
35 | ADMIN_USERS: admin@alerta.io,devops@alerta.io #default password: alerta
36 | ADMIN_KEY: demo-key # assigned to first user in ADMIN_USERS list
37 | # PLUGINS: reject,blackout,normalise,enhance
38 | networks:
39 | envoymesh:
40 | aliases:
41 | - api
42 |
43 | db:
44 | image: postgres
45 | volumes:
46 | - ./pg-data:/var/lib/postgresql/data
47 | environment:
48 | POSTGRES_DB: monitoring
49 | POSTGRES_USER: postgres
50 | POSTGRES_PASSWORD: postgres
51 | networks:
52 | envoymesh:
53 | aliases:
54 | - db
55 | restart: always
56 |
57 | networks:
58 | envoymesh: {}
59 |
--------------------------------------------------------------------------------
/tests/docker-compose.test.mongodb.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | sut:
5 | build:
6 | context: ..
7 | args:
8 | BUILD_DATE: ${BUILD_DATE}
9 | RELEASE: ${RELEASE}
10 | VERSION: ${VERSION}
11 | # image: alerta/alerta-web
12 | ports:
13 | - 8080
14 | depends_on:
15 | - db
16 | environment:
17 | # - DEBUG=1 # remove this line to turn DEBUG off
18 | - LOG_LEVEL=error # debug, info, warn (default), or error
19 | - SECRET_KEY=super-secret
20 | - DATABASE_URL=mongodb://db:27017/monitoring
21 | - AUTH_REQUIRED=tRuE
22 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io # default password: alerta
23 | - ADMIN_KEY=demo-key
24 | - ADMIN_KEY_MAXAGE=31536000 # 1 year in seconds
25 | - PLUGINS=reject,blackout,normalise,enhance
26 | - HK_EXPIRED_DELETE_HRS=39
27 | - HK_INFO_DELETE_HRS=17
28 | - HEARTBEAT_SEVERITY=warning
29 | # Disable Housekeeping by setting one or both of HK env vars to a empty string
30 | # - HK_EXPIRED_DELETE_HRS=
31 | # - HK_INFO_DELETE_HRS=
32 | # Disable hearbeat alerts by setting below env var to empty string
33 | # - HEARTBEAT_SEVERITY=
34 |
35 | tester:
36 | build:
37 | context: docker
38 | dockerfile: Dockerfile
39 | volumes:
40 | - ./spec:/spec
41 | depends_on:
42 | - sut
43 | command: sh -c './wait-for sut:8080 -t 240 -- bundle exec rspec ./spec'
44 |
45 | db:
46 | image: mongo
47 | restart: always
48 |
--------------------------------------------------------------------------------
/examples/apache/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | proxy:
5 | image: httpd:2.4
6 | volumes:
7 | - ./proxy/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro
8 | - ./proxy/proxy.conf:/usr/local/apache2/conf/extra/proxy.conf:ro
9 | ports:
10 | - "8000:80" # HTTP port
11 | depends_on:
12 | - api
13 | - webui
14 | networks:
15 | - net
16 |
17 | webui:
18 | build:
19 | context: webui
20 | networks:
21 | net:
22 | aliases:
23 | - web
24 |
25 | api:
26 | image: alerta/alerta-web # use API in "alerta-web" image
27 | depends_on:
28 | - db
29 | volumes:
30 | - ./api/alertad.conf:/app/alertad.conf
31 | environment:
32 | - DEBUG=1 # remove this line to turn DEBUG off
33 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
34 | - AUTH_REQUIRED=True
35 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
36 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS list
37 | # - PLUGINS=reject,blackout,normalise,enhance
38 | networks:
39 | net:
40 | aliases:
41 | - api
42 |
43 | db:
44 | image: postgres
45 | volumes:
46 | - ./pg-data:/var/lib/postgresql/data
47 | environment:
48 | - POSTGRES_DB=monitoring
49 | - POSTGRES_USER=postgres
50 | - POSTGRES_PASSWORD=postgres
51 | networks:
52 | net:
53 | aliases:
54 | - db
55 | restart: always
56 |
57 | networks:
58 | net: {}
59 |
--------------------------------------------------------------------------------
/examples/nginx/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | front:
5 | image: nginx
6 | volumes:
7 | - ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro
8 | - ./proxy/proxy.conf:/etc/nginx/proxy.conf:ro
9 | command: [nginx, '-g', 'daemon off;']
10 | ports:
11 | - "8000:80"
12 | depends_on:
13 | - api
14 | - webui
15 | networks:
16 | - nginxnet
17 |
18 | webui:
19 | build:
20 | context: webui
21 | networks:
22 | nginxnet:
23 | aliases:
24 | - web
25 |
26 | api:
27 | image: alerta/alerta-web # use API in "alerta-web" image
28 | depends_on:
29 | - db
30 | volumes:
31 | - ./api/alertad.conf:/app/alertad.conf
32 | environment:
33 | - DEBUG=1 # remove this line to turn DEBUG off
34 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
35 | - AUTH_REQUIRED=True
36 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
37 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS list
38 | # - PLUGINS=reject,blackout,normalise,enhance
39 | networks:
40 | nginxnet:
41 | aliases:
42 | - api
43 |
44 | db:
45 | image: postgres
46 | volumes:
47 | - ./pg-data:/var/lib/postgresql/data
48 | environment:
49 | - POSTGRES_DB=monitoring
50 | - POSTGRES_USER=postgres
51 | - POSTGRES_PASSWORD=postgres
52 | networks:
53 | nginxnet:
54 | aliases:
55 | - db
56 | restart: always
57 |
58 | networks:
59 | nginxnet: {}
60 |
--------------------------------------------------------------------------------
/examples/keycloak/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | alerta:
5 | image: alerta/alerta-web
6 | container_name: alerta-web
7 | volumes:
8 | - $PWD/config/alertad.conf:/app/alertad.conf
9 | ports:
10 | - 8000:8080
11 | depends_on:
12 | - db
13 | - keycloak
14 | environment:
15 | - DEBUG=1 # remove this line to turn DEBUG off
16 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
17 | - AUTH_REQUIRED=True
18 | - ADMIN_USERS=alice # password=alice
19 | - AUTH_PROVIDER=keycloak
20 | - KEYCLOAK_URL=http://host.docker.internal:8080
21 | - KEYCLOAK_REALM=demo
22 | # - ALLOWED_OIDC_ROLES=devops
23 | # - ALLOWED_EMAIL_DOMAINS=alerta.io,alerta.dev
24 | - OAUTH2_CLIENT_ID=alerta-webui
25 | - OAUTH2_CLIENT_SECRET=fa134126-222b-4fc3-a8dd-070a28f39e88
26 | restart: always
27 | db:
28 | image: postgres
29 | container_name: alerta-db
30 | volumes:
31 | - ./pg-data:/var/lib/postgresql/data
32 | environment:
33 | POSTGRES_DB: monitoring
34 | POSTGRES_USER: postgres
35 | POSTGRES_PASSWORD: postgres
36 | restart: always
37 |
38 | keycloak:
39 | image: jboss/keycloak
40 | container_name: keycloak
41 | volumes:
42 | - $PWD/config/demo-realm.json:/tmp/demo-realm.json
43 | environment:
44 | DB_VENDOR: h2
45 | KEYCLOAK_USER: admin
46 | KEYCLOAK_PASSWORD: Pa55w0rd
47 | KEYCLOAK_IMPORT: /tmp/demo-realm.json
48 | # JDBC_PARAMS: "ssl=true"
49 | ports:
50 | - 8080:8080
51 |
--------------------------------------------------------------------------------
/examples/mongo/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 | services:
3 | web:
4 | # build: .
5 | image: alerta/alerta-web
6 | # volumes:
7 | # - $PWD/config/alertad.conf.example:/app/alertad.conf
8 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
9 | # - $PWD/config/config.json.example:/web/config.json
10 | ports:
11 | - 9080:8080
12 | volumes:
13 | - $PWD/config/alertad.conf:/app/alertad.conf
14 | depends_on:
15 | - db0
16 | environment:
17 | # - DEBUG=1 # remove this line to turn DEBUG off
18 | - DATABASE_URL=mongodb://db0:27017/monitoring?replicaSet=rs0
19 | - MONGO_INITDB_DATABASE=monitoring
20 | - AUTH_REQUIRED=True
21 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
22 | - ADMIN_PASSWORD=super-secret # default is "alerta"
23 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
24 | # - PLUGINS=remote_ip,reject,heartbeat,blackout,normalise,enhance
25 | restart: always
26 |
27 | db0:
28 | image: mongo
29 | ports:
30 | - 27017
31 | volumes:
32 | - ./mongodb/0:/data/db
33 | command: ["--replSet", "rs0", "--bind_ip_all"]
34 | restart: always
35 |
36 | db1:
37 | image: mongo
38 | ports:
39 | - 27017
40 | volumes:
41 | - ./mongodb/1:/data/db
42 | command: ["--replSet", "rs0", "--bind_ip_all" ]
43 | restart: always
44 |
45 | db2:
46 | image: mongo
47 | ports:
48 | - 27017
49 | volumes:
50 | - ./mongodb/2:/data/db
51 | command: ["--replSet", "rs0", "--bind_ip_all" ]
52 | restart: always
53 |
54 | networks:
55 | net:
56 |
--------------------------------------------------------------------------------
/tests/docker-compose.test.postgres.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | sut:
5 | build:
6 | context: ..
7 | args:
8 | BUILD_DATE: ${BUILD_DATE}
9 | RELEASE: ${RELEASE}
10 | VERSION: ${VERSION}
11 | # image: alerta/alerta-web
12 | ports:
13 | - 8080
14 | depends_on:
15 | - db
16 | environment:
17 | # - DEBUG=1 # remove this line to turn DEBUG off
18 | - LOG_LEVEL=error # debug, info, warn (default), or error
19 | - SECRET_KEY=super-secret
20 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
21 | - AUTH_REQUIRED=tRuE
22 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io # default password: alerta
23 | - ADMIN_KEY=demo-key
24 | - ADMIN_KEY_MAXAGE=31536000 # 1 year in seconds
25 | - PLUGINS=reject,blackout,normalise,enhance
26 | - HK_EXPIRED_DELETE_HRS=39
27 | - HK_INFO_DELETE_HRS=17
28 | - HEARTBEAT_SEVERITY=warning
29 | # Disable Housekeeping by setting one or both of HK env vars to a empty string
30 | # - HK_EXPIRED_DELETE_HRS=
31 | # - HK_INFO_DELETE_HRS=
32 | # Disable hearbeat alerts by setting below env var to empty string
33 | # - HEARTBEAT_SEVERITY=
34 |
35 | tester:
36 | build:
37 | context: docker
38 | dockerfile: Dockerfile
39 | volumes:
40 | - ./spec:/spec
41 | depends_on:
42 | - sut
43 | command: sh -c './wait-for sut:8080 -t 240 -- bundle exec rspec ./spec'
44 |
45 | db:
46 | image: postgres
47 | environment:
48 | POSTGRES_DB: monitoring
49 | POSTGRES_USER: postgres
50 | POSTGRES_PASSWORD: postgres
51 |
--------------------------------------------------------------------------------
/contrib/kubernetes/backend/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -x
3 |
4 | RUN_ONCE=/app/.run_once
5 |
6 | # Generate server config, if not supplied
7 | if [ ! -f "${ALERTA_SVR_CONF_FILE}" ]; then
8 | cat >"${ALERTA_SVR_CONF_FILE}" << EOF
9 | SECRET_KEY = '$(< /dev/urandom tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= | head -c 32)'
10 | EOF
11 | fi
12 |
13 | if [ ! -f "${RUN_ONCE}" ]; then
14 |
15 | BASE_PATH=$(echo "/"${BASE_URL#*//*/} | tr -s /)
16 | sed -i 's@!BASE_PATH!@'"$BASE_PATH"'@' /app/uwsgi.ini
17 |
18 | # Init admin users and API keys
19 | if [ -n "${ADMIN_USERS}" ]; then
20 | alertad user --password ${ADMIN_PASSWORD:-alerta} --all
21 | alertad key --all
22 |
23 | # Create user-defined API key, if required
24 | if [ -n "${ADMIN_KEY}" ]; then
25 | alertad key --username $(echo ${ADMIN_USERS} | cut -d, -f1) --key ${ADMIN_KEY}
26 | fi
27 | fi
28 |
29 | # Install plugins
30 | IFS=","
31 | for plugin in ${INSTALL_PLUGINS}
32 | do
33 | echo "Installing plugin '${plugin}'"
34 | /venv/bin/pip install git+https://github.com/alerta/alerta-contrib.git#subdirectory=plugins/$plugin
35 | done
36 | touch ${RUN_ONCE}
37 | fi
38 |
39 | # Generate client config, if not supplied
40 | if [ ! -f "${ALERTA_CONF_FILE}" ]; then
41 | API_KEY=${ADMIN_KEY:-$(alertad keys 2>/dev/null | head -1 | cut -d" " -f1)}
42 | if [ -n "${API_KEY}" ]; then
43 | cat >${ALERTA_CONF_FILE} << EOF
44 | [DEFAULT]
45 | endpoint = http://localhost:8080${BASE_PATH}
46 | key = ${API_KEY}
47 | EOF
48 | else
49 | cat >${ALERTA_CONF_FILE} << EOF
50 | [DEFAULT]
51 | endpoint = http://localhost:8080${BASE_PATH}
52 | EOF
53 | fi
54 | fi
55 |
56 | exec "$@"
57 |
--------------------------------------------------------------------------------
/examples/envoy/proxy/front-proxy.yaml:
--------------------------------------------------------------------------------
1 | static_resources:
2 | listeners:
3 | - address:
4 | socket_address:
5 | address: 0.0.0.0
6 | port_value: 80
7 | filter_chains:
8 | - filters:
9 | - name: envoy.http_connection_manager
10 | typed_config:
11 | "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager
12 | codec_type: auto
13 | stat_prefix: ingress_http
14 | route_config:
15 | name: local_route
16 | virtual_hosts:
17 | - name: backend
18 | domains:
19 | - "*"
20 | routes:
21 | - match:
22 | prefix: "/alerta/ui"
23 | route:
24 | prefix_rewrite: "/"
25 | cluster: web
26 | - match:
27 | prefix: "/alerta/api"
28 | route:
29 | prefix_rewrite: "/api"
30 | cluster: api
31 | http_filters:
32 | - name: envoy.router
33 | typed_config: {}
34 | clusters:
35 | - name: web
36 | connect_timeout: 0.25s
37 | type: strict_dns
38 | lb_policy: round_robin
39 | hosts:
40 | - socket_address:
41 | address: web
42 | port_value: 80
43 | - name: api
44 | connect_timeout: 0.25s
45 | type: strict_dns
46 | lb_policy: round_robin
47 | hosts:
48 | - socket_address:
49 | address: api
50 | port_value: 8080
51 | admin:
52 | access_log_path: "/dev/null"
53 | address:
54 | socket_address:
55 | address: 0.0.0.0
56 | port_value: 8001
57 |
--------------------------------------------------------------------------------
/examples/ldap/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2.1'
2 | services:
3 | web:
4 | image: alerta/alerta-web
5 | container_name: alerta-web
6 | volumes:
7 | - $PWD/config/config.json:/web/config.json
8 | ports:
9 | - 8000:8080
10 | depends_on:
11 | - db
12 | environment:
13 | - DEBUG=1 # remove this line to turn DEBUG off
14 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
15 | - AUTH_REQUIRED=True
16 | - AUTH_PROVIDER=ldap
17 | # LDAP configuration not support by environment variables, see config/alertad.conf
18 | restart: always
19 | api:
20 | image: ghcr.io/alerta/alerta-api:latest
21 | container_name: alerta-api
22 | volumes:
23 | - $PWD/config/alertad.conf:/app/alertad.conf
24 | ports:
25 | - 8080:8080
26 | depends_on:
27 | - db
28 | environment:
29 | - DEBUG=1 # remove this line to turn DEBUG off
30 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
31 | - AUTH_REQUIRED=True
32 | - AUTH_PROVIDER=ldap
33 | # LDAP configuration not support by environment variables, see config/alertad.conf
34 | restart: always
35 | db:
36 | image: postgres
37 | container_name: postgres
38 | volumes:
39 | - ./pg-data:/var/lib/postgresql/data
40 | environment:
41 | POSTGRES_DB: monitoring
42 | POSTGRES_USER: postgres
43 | POSTGRES_PASSWORD: postgres
44 | restart: always
45 | openldap:
46 | image: rroemhild/test-openldap
47 | container_name: openldap
48 | ports:
49 | - 389:389
50 | - 636:636
51 | phpldapadmin:
52 | image: osixia/phpldapadmin:latest
53 | container_name: ldapadmin
54 | environment:
55 | PHPLDAPADMIN_LDAP_HOSTS: "openldap"
56 | PHPLDAPADMIN_HTTPS=false:
57 | ports:
58 | - "8081:80"
59 | depends_on:
60 | - openldap
61 |
--------------------------------------------------------------------------------
/config/templates/app/nginx.conf.j2:
--------------------------------------------------------------------------------
1 |
2 | worker_processes {{ env.NGINX_WORKER_PROCESSES }};
3 | pid /tmp/nginx.pid;
4 |
5 | daemon off;
6 | {%- if env.DEBUG %}
7 | error_log /dev/stderr debug;
8 | {%- else %}
9 | error_log /dev/stderr {{ env.LOG_LEVEL|lower or 'warn' }};
10 | {%- endif %}
11 |
12 | events {
13 | worker_connections {{ env.NGINX_WORKER_CONNECTIONS }};
14 | }
15 |
16 | http {
17 | client_body_temp_path /tmp/client_body;
18 | fastcgi_temp_path /tmp/fastcgi_temp;
19 | proxy_temp_path /tmp/proxy_temp;
20 | scgi_temp_path /tmp/scgi_temp;
21 | uwsgi_temp_path /tmp/uwsgi_temp;
22 |
23 | include /etc/nginx/mime.types;
24 |
25 | server_tokens off;
26 |
27 | gzip on;
28 | gzip_disable "msie6";
29 | client_max_body_size {{ env.NGINX_MAX_BODY_SIZE or '2M' }};
30 |
31 | log_format main '$remote_addr - $remote_user [$time_local] '
32 | '"$request" $status $body_bytes_sent '
33 | '"$http_referer" "$http_user_agent" - $request_time '
34 | 'x_forwarded_for=$http_x_forwarded_for host=$host '
35 | '$request_id $sent_http_x_request_id';
36 |
37 | default_type application/octet-stream;
38 |
39 | upstream backend {
40 | server 127.0.0.1:29000;
41 | }
42 |
43 | server {
44 | listen 8080 default_server;
45 | listen [::]:8080 default_server;
46 |
47 | access_log /dev/stdout main;
48 |
49 | location /api {
50 | include /etc/nginx/uwsgi_params;
51 | uwsgi_pass backend;
52 |
53 | uwsgi_param Host $host;
54 | uwsgi_param X-Real-IP $remote_addr;
55 | uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for;
56 | uwsgi_param X-Forwarded-Proto $http_x_forwarded_proto;
57 | }
58 |
59 | root /web;
60 | index index.html;
61 | location / {
62 | try_files $uri $uri/ /index.html;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/.github/workflows/tests.yml:
--------------------------------------------------------------------------------
1 | name: Tests
2 |
3 | on:
4 | push:
5 | pull_request:
6 | branches: [ master ]
7 |
8 | env:
9 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
10 |
11 | jobs:
12 | test-postgres:
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | - name: Docker Lint
18 | id: docker-lint
19 | run: |
20 | docker run --rm -i ghcr.io/hadolint/hadolint hadolint \
21 | --ignore DL3008 \
22 | --ignore DL3059 \
23 | - < Dockerfile
24 | - name: Run tests
25 | id: smoketest
26 | run: >-
27 | BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
28 | RELEASE=$(cat VERSION)
29 | VERSION=${{ github.sha }}
30 | docker compose
31 | -f tests/docker-compose.test.mongodb.yml
32 | up
33 | --build
34 | --quiet-pull
35 | --exit-code-from tester
36 | - uses: act10ns/slack@v2
37 | with:
38 | status: ${{ job.status }}
39 | steps: ${{ toJson(steps) }}
40 | if: always()
41 |
42 | test-mongodb:
43 | runs-on: ubuntu-latest
44 |
45 | steps:
46 | - uses: actions/checkout@v4
47 | - name: Docker Lint
48 | id: docker-lint
49 | run: |
50 | docker run --rm -i ghcr.io/hadolint/hadolint hadolint \
51 | --ignore DL3008 \
52 | --ignore DL3059 \
53 | - < Dockerfile
54 | - name: Run tests
55 | id: smoketest
56 | run: >-
57 | BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
58 | RELEASE=$(cat VERSION)
59 | VERSION=${{ github.sha }}
60 | docker compose
61 | -f tests/docker-compose.test.mongodb.yml
62 | up
63 | --build
64 | --quiet-pull
65 | --exit-code-from tester
66 | - uses: act10ns/slack@v2
67 | with:
68 | status: ${{ job.status }}
69 | steps: ${{ toJson(steps) }}
70 | if: always()
71 |
--------------------------------------------------------------------------------
/examples/traefik/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 | reverse-proxy:
5 | image: traefik:v2.0
6 | command: --api.insecure=true --providers.docker
7 | volumes:
8 | - /var/run/docker.sock:/var/run/docker.sock:ro
9 | ports:
10 | - "8000:80" # HTTP port
11 | - "8080:8080" # admin web UI
12 | depends_on:
13 | - api
14 | - webui
15 | networks:
16 | - net
17 |
18 | webui:
19 | build:
20 | context: webui
21 | networks:
22 | net:
23 | aliases:
24 | - web
25 | labels:
26 | - "traefik.backend=webui"
27 | - "traefik.http.routers.webui.rule=Host(`local.alerta.io`) && PathPrefix(`/web`)"
28 | - "traefik.http.routers.webui.middlewares=webui-stripprefix@docker"
29 | - "traefik.http.middlewares.webui-stripprefix.stripprefix.prefixes=/web"
30 |
31 | api:
32 | image: alerta/alerta-web # use API in "alerta-web" image
33 | depends_on:
34 | - db
35 | volumes:
36 | - ./api/alertad.conf:/app/alertad.conf
37 | environment:
38 | - DEBUG=1 # remove this line to turn DEBUG off
39 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
40 | - AUTH_REQUIRED=True
41 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
42 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS list
43 | # - PLUGINS=reject,blackout,normalise,enhance
44 | networks:
45 | net:
46 | aliases:
47 | - api
48 | labels:
49 | - "traefik.backend=api"
50 | - "traefik.http.routers.api.rule=Host(`api.local.alerta.io`)"
51 | - "traefik.http.routers.api.middlewares=api-addprefix@docker"
52 | - "traefik.http.middlewares.api-addprefix.addprefix.prefix=/api"
53 |
54 | db:
55 | image: postgres
56 | volumes:
57 | - ./pg-data:/var/lib/postgresql/data
58 | environment:
59 | - POSTGRES_DB=monitoring
60 | - POSTGRES_USER=postgres
61 | - POSTGRES_PASSWORD=postgres
62 | networks:
63 | net:
64 | aliases:
65 | - db
66 | restart: always
67 |
68 | networks:
69 | net: {}
70 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #!make
2 |
3 | DOCKER=docker
4 | DOCKER_COMPOSE=docker-compose
5 |
6 | .DEFAULT_GOAL:=help
7 |
8 | -include .env .env.local .env.*.local
9 |
10 | VCS_REF=$(shell git rev-parse --short HEAD)
11 | BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
12 | VERSION:=$(shell cat VERSION)
13 |
14 | BACKEND ?= postgres
15 |
16 | ifndef IMAGE_NAME
17 | $(error IMAGE_NAME is not set)
18 | endif
19 |
20 | .PHONY: version
21 |
22 | all: help
23 |
24 | ## lint - Lint Dockerfile.
25 | lint:
26 | docker run --rm -i hadolint/hadolint < Dockerfile
27 |
28 | ## test.unit - Run unit tests.
29 | test.unit:
30 | IMAGE_NAME=${IMAGE_NAME} \
31 | VCS_REF=${VCS_REF} \
32 | VERSION=${VERSION} \
33 | $(DOCKER_COMPOSE) \
34 | -f tests/docker-compose.test.${BACKEND}.yml \
35 | up \
36 | --build \
37 | --renew-anon-volumes \
38 | --no-color \
39 | --exit-code-from tester
40 |
41 | ## build - Build docker image.
42 | build:
43 | $(DOCKER) build \
44 | --build-arg VCS_REF=$(VCS_REF) \
45 | --build-arg BUILD_DATE=$(BUILD_DATE) \
46 | --build-arg VERSION=$(VERSION) \
47 | -t $(IMAGE_NAME) \
48 | -t $(IMAGE_NAME):$(VERSION) \
49 | -t $(IMAGE_NAME):$(VCS_REF) \
50 | -t $(IMAGE_NAME):latest .
51 |
52 | ## push - Push docker image to repository.
53 | push:
54 | $(DOCKER) push $(IMAGE_NAME)
55 |
56 | ## pull - Pull docker images.
57 | pull:
58 | $(DOCKER_COMPOSE) -f docker-compose.yml pull
59 |
60 | ## up - Create and start up docker containers.
61 | up:
62 | $(DOCKER_COMPOSE) -f docker-compose.yml up
63 |
64 | ## down - Stop and remove docker containers.
65 | down:
66 | $(DOCKER_COMPOSE) -f docker-compose.yml down
67 |
68 | ## clean - Clean up docker containers.
69 | clean:
70 | $(DOCKER_COMPOSE) -f docker-compose.yml rm
71 |
72 | ## version - Show version.
73 | version:
74 | @$(DOCKER_COMPOSE) version
75 | @echo "alerta version $(VERSION)"
76 |
77 | ## shell - Container shell prompt.
78 | shell:
79 | $(DOCKER_COMPOSE) -f docker-compose.test.yml run --rm sut bash
80 |
81 | ## env - Print environment variables.
82 | env:
83 | env | sort
84 |
85 | ## help - Show this help.
86 | help: Makefile
87 | @echo ''
88 | @echo 'Usage:'
89 | @echo ' make [TARGET]'
90 | @echo ''
91 | @echo 'Targets:'
92 | @sed -n 's/^##//p' $<
93 | @echo ''
94 |
95 | @echo 'Add project-specific env variables to .env file:'
96 | @echo 'PROJECT=$(PROJECT)'
97 |
98 | .PHONY: help lint test build sdist wheel clean all
99 |
--------------------------------------------------------------------------------
/examples/prometheus/config/prometheus.rules.yml:
--------------------------------------------------------------------------------
1 | groups:
2 | - name: ./rules.conf
3 | rules:
4 |
5 | # heartbeat alert
6 | - alert: Heartbeat
7 | expr: vector(1)
8 | labels:
9 | severity: informational
10 |
11 | # service availability alert
12 | - alert: service_down
13 | expr: up == 0
14 | labels:
15 | service: Platform
16 | severity: major
17 | correlate: service_up,service_down
18 | annotations:
19 | description: Service {{ $labels.instance }} is unavailable.
20 | value: DOWN ({{ $value }})
21 | runbook: http://wiki.alerta.io/RunBook/{app}/Event/{alertname}
22 |
23 | - alert: service_up
24 | expr: up == 1
25 | labels:
26 | service: Platform
27 | severity: normal
28 | correlate: service_up,service_down
29 | annotations:
30 | description: Service {{ $labels.instance }} is available.
31 | value: UP ({{ $value }})
32 |
33 | # system load alert
34 | - alert: high_load
35 | expr: node_load1 > 0.5
36 | annotations:
37 | description: '{{ $labels.instance }} of job {{ $labels.job }} is under high load.'
38 | summary: Instance {{ $labels.instance }} under high load
39 | value: '{{ $value }}'
40 |
41 | # disk space alert (with resource=: event=disk_space
42 | - alert: disk_space
43 | expr: (node_filesystem_size_bytes - node_filesystem_free_bytes) * 100 / node_filesystem_size_bytes > 5
44 | labels:
45 | instance: '{{ $labels.instance }}:{{ $labels.mountpoint }}'
46 | annotations:
47 | value: '{{ humanize $value }}%'
48 |
49 | # disk space alert (with resource= event=disk_util:
50 | - alert: disk_util
51 | expr: (node_filesystem_size_bytes - node_filesystem_free_bytes) * 100 / node_filesystem_size_bytes > 5
52 | labels:
53 | instance: '{{ $labels.instance }}'
54 | event: '{alertname}:{{ $labels.mountpoint }}' # python templating rendered by Alerta
55 | annotations:
56 | value: '{{ humanize $value }}%'
57 |
58 | # API request rate alert
59 | - alert: api_requests_high
60 | expr: rate(alerta_alerts_queries_count{instance="alerta:8080",job="alerta"}[5m]) > 5
61 | labels:
62 | service: Alerta,Platform
63 | severity: major
64 | annotations:
65 | description: API request rate of {{ $value | printf "%.1f" }} req/s is high (threshold 5 req/s)
66 | summary: API request rate high
67 | value: '{{ humanize $value }} req/s'
68 |
--------------------------------------------------------------------------------
/tests/spec/api_spec.rb:
--------------------------------------------------------------------------------
1 | require 'json'
2 |
3 | describe "api" do
4 | GATEWAY_BASE_URL = "http://sut:8080/api"
5 | context "/_" do
6 | context "get" do
7 | result = Client.get "#{GATEWAY_BASE_URL}/_"
8 | it "return 200" do
9 | expect(result.code).to eq(200)
10 | end
11 | it "return OK" do
12 | expect(result.body).to eq("OK")
13 | end
14 | end
15 | end
16 | context "/config" do
17 | context "get" do
18 | result = Client.get "#{GATEWAY_BASE_URL}/config"
19 | it "return 200" do
20 | expect(result.code).to eq(200)
21 | end
22 | it "response header content-type is application/json" do
23 | expect(result.headers[:content_type]).to eq("application/json")
24 | end
25 | it "config is valid json" do
26 | expect(JSON.parse(result.body)['provider']).to eq("basic")
27 | end
28 | end
29 | end
30 | context "/management" do
31 | context "get manifest" do
32 | result = Client.get "#{GATEWAY_BASE_URL}/management/manifest", {'x-api-key' => 'demo-key'}
33 | it "return 200" do
34 | expect(result.code).to eq(200)
35 | end
36 | end
37 | context "get properties" do
38 | result = Client.get "#{GATEWAY_BASE_URL}/management/properties", {'x-api-key' => 'demo-key'}
39 | it "return 200" do
40 | expect(result.code).to eq(200)
41 | end
42 | it "X-Forwarded-For header is set" do
43 | expect(result.body).to include("X-Forwarded-For")
44 | end
45 | end
46 | context "get healthcheck" do
47 | result = Client.get "#{GATEWAY_BASE_URL}/management/gtg"
48 | it "return 200" do
49 | expect(result.code).to eq(200)
50 | end
51 | it "good-to-go is OK" do
52 | expect(result.body).to eq("OK")
53 | end
54 | it "response header does not contain nginx version" do
55 | expect(result.headers[:server]).to eq("nginx")
56 | end
57 | end
58 | end
59 | context "/alerts" do
60 | context "get without auth" do
61 | result = Client.get "#{GATEWAY_BASE_URL}/alerts"
62 | it "return 401" do
63 | expect(result.code).to eq(401)
64 | end
65 | end
66 | context "get" do
67 | result = Client.get "#{GATEWAY_BASE_URL}/alerts?api-key=demo-key"
68 | it "return 200" do
69 | expect(result.code).to eq(200)
70 | end
71 | it "total is 0" do
72 | expect(JSON.parse(result.body)['total']).to eq(0)
73 | end
74 | end
75 | end
76 | end
77 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Push to DockerHub
2 |
3 | on:
4 | push:
5 | tags: [ 'v*' ]
6 |
7 | env:
8 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
9 |
10 | jobs:
11 | test:
12 | name: Test
13 | runs-on: ubuntu-latest
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | - name: Docker Lint
18 | id: docker-lint
19 | run: |
20 | docker run --rm -i ghcr.io/hadolint/hadolint hadolint \
21 | --ignore DL3008 \
22 | --ignore DL3059 \
23 | - < Dockerfile
24 | - name: Run tests
25 | id: smoketest
26 | run: >-
27 | BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
28 | RELEASE=$(cat VERSION)
29 | VERSION=${{ github.sha }}
30 | docker compose
31 | -f tests/docker-compose.test.mongodb.yml
32 | up
33 | --build
34 | --quiet-pull
35 | --exit-code-from tester
36 | - uses: act10ns/slack@v2
37 | with:
38 | status: ${{ job.status }}
39 | steps: ${{ toJson(steps) }}
40 | if: failure()
41 |
42 | push:
43 | name: Docker Push
44 | needs: test
45 | runs-on: ubuntu-latest
46 | if: github.event_name == 'push'
47 |
48 | env:
49 | REPOSITORY_URL: registry.hub.docker.com
50 | IMAGE_NAME: alerta/alerta-web
51 | PLATFORM: 3.9-buster-uwsgi
52 |
53 | steps:
54 | - uses: actions/checkout@v4
55 | - name: Build Image
56 | id: docker-build
57 | run: >-
58 | docker build
59 | --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
60 | --build-arg RELEASE=$(cat VERSION)
61 | --build-arg VERSION=${{ github.sha }}
62 | -t $IMAGE_NAME
63 | -t $REPOSITORY_URL/$IMAGE_NAME:$(cat VERSION)
64 | -t $REPOSITORY_URL/$IMAGE_NAME:$(git rev-parse --short HEAD)
65 | -t $REPOSITORY_URL/$IMAGE_NAME:$PLATFORM
66 | -t $REPOSITORY_URL/$IMAGE_NAME:latest .
67 | - name: Docker Login
68 | uses: docker/login-action@v3
69 | with:
70 | registry: ${{ env.REPOSITORY_URL }}
71 | username: ${{ github.actor }}
72 | password: ${{ secrets.DOCKERHUB_TOKEN }}
73 | - name: Publish Image
74 | id: docker-push
75 | run: docker push --all-tags $REPOSITORY_URL/$IMAGE_NAME
76 |
77 | - uses: act10ns/slack@v2
78 | with:
79 | status: ${{ job.status }}
80 | steps: ${{ toJson(steps) }}
81 | if: always()
82 |
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/values.yaml:
--------------------------------------------------------------------------------
1 | # Default values for alerta.
2 | # This is a YAML-formatted file.
3 | # Declare variables to be passed into your templates.
4 |
5 | replicaCount: 1
6 |
7 | image:
8 | repository: alerta/alerta-web
9 | # Override the image tag to deploy by setting this variable.
10 | # If no value is set, the chart's appVersion will be used.
11 | tag: ""
12 | pullPolicy: IfNotPresent
13 |
14 | nameOverride: ""
15 | fullnameOverride: ""
16 |
17 | service:
18 | type: ClusterIP
19 | port: 80
20 |
21 | ingress:
22 | enabled: false
23 | annotations: {}
24 | # kubernetes.io/ingress.class: nginx
25 | # kubernetes.io/tls-acme: "true"
26 | className: ""
27 | path: /
28 | hosts:
29 | - alerta.example.com
30 | tls: []
31 | # - secretName: chart-example-tls
32 | # hosts:
33 | # - chart-example.local
34 |
35 | resources: {}
36 | # We usually recommend not to specify default resources and to leave this as a conscious
37 | # choice for the user. This also increases chances charts run on environments with little
38 | # resources, such as Minikube. If you do want to specify resources, uncomment the following
39 | # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
40 | # limits:
41 | # cpu: 1
42 | # memory: 128Mi
43 | # requests:
44 | # cpu: 100m
45 | # memory: 128Mi
46 |
47 | nodeSelector: {}
48 |
49 | tolerations: []
50 |
51 | affinity: {}
52 |
53 | extraSecretMounts: []
54 | # - name: secret-files
55 | # mountPath: /etc/secrets
56 | # subPath: ""
57 | # secretName: alertmanager-secret-files
58 | # readOnly: true
59 |
60 | # alertaAdminPassword: "" # if not provided will be randomly generated
61 | # alertaAdminUsers: # list of email addresses
62 | # - "admin@alerta.io"
63 | # alertaAdminKey: ""
64 | # alertaApiKey: "" # you probably want to set this to the same value as 'alertaAdminKey'
65 |
66 | # Alerta plugins to install
67 | # alertaInstallPlugins:
68 | # - normalise
69 | # - enhance
70 |
71 | # ref: http://docs.alerta.io/en/latest/configuration.html
72 | # alertaConfig:
73 | # DEBUG: "True"
74 | # AUTH_REQUIRED: "True"
75 | # PLUGINS: "['normalise', 'enhance']"
76 | # DATABASE_URL: "" # provide db url here if you're not using the postgres chart
77 |
78 | # ref: http://docs.alerta.io/en/latest/webui.html
79 | # alertaWebUIConfig: |
80 | # // contents of config.js
81 | # 'use strict';
82 | # angular.module('config', [])
83 | # .constant('config', {
84 | # 'endpoint' : "/api",
85 | # 'provider' : "basic"
86 | # })
87 | # .constant('colors', {});
88 |
89 | extraEnvVars: []
90 | # ENV_VAR_1: ~
91 | # ENV_VAR_2: ~
92 | extraConfigs: []
93 | # - name: ~
94 | # subPath: ~
95 | # mountPath: ~
96 | # data: ~
97 | postgresql:
98 | enabled: true
99 | postgresqlUsername: alerta
100 | postgresqlDatabase: monitoring
101 | postgresqlPassword: "changeme" # provide a password here, otherwise it will be randomly generated inside postgresql helm chart and will not be available as a variable in the alerta helm chart
102 | persistence:
103 | enabled: true
104 | size: 10Gi
105 |
106 | # If deploying on OpenShift
107 | # volumePermissions:
108 | # securityContext:
109 | # runAsUser: "auto"
110 | # securityContext:
111 | # enabled: false
112 | # containerSecurityContext:
113 | # enabled: false,
114 | # shmVolume:
115 | # chmod:
116 | # enabled: false
117 |
--------------------------------------------------------------------------------
/examples/federated/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 | mom1:
5 | image: alerta/alerta-web
6 | volumes:
7 | - $PWD/config/alertad-mom1.conf:/app/alertad.conf
8 | - $PWD/config/logging.conf:/app/logging.conf
9 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
10 | # - $PWD/config/config.json.example:/web/config.json
11 | ports:
12 | - 8080
13 | depends_on:
14 | - db
15 | environment:
16 | # - DEBUG=1 # remove this line to turn DEBUG off
17 | - DATABASE_URL=postgres://postgres:postgres@db:5432/mom1
18 | - AUTH_REQUIRED=True
19 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
20 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
21 | networks:
22 | net:
23 | aliases:
24 | - mom1.local.alerta.io
25 | restart: always
26 |
27 | mom2:
28 | image: alerta/alerta-web
29 | volumes:
30 | - $PWD/config/alertad-mom2.conf:/app/alertad.conf
31 | - $PWD/config/logging.conf:/app/logging.conf
32 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
33 | # - $PWD/config/config.json.example:/web/config.json
34 | ports:
35 | - 8080
36 | depends_on:
37 | - db
38 | environment:
39 | # - DEBUG=1 # remove this line to turn DEBUG off
40 | - DATABASE_URL=postgres://postgres:postgres@db:5432/mom2
41 | - AUTH_REQUIRED=True
42 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
43 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
44 | networks:
45 | net:
46 | aliases:
47 | - mom2.local.alerta.io
48 | restart: always
49 |
50 | mlm1:
51 | image: alerta/alerta-web
52 | volumes:
53 | - $PWD/config/alertad-mlm1.conf:/app/alertad.conf
54 | - $PWD/config/logging.conf:/app/logging.conf
55 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
56 | # - $PWD/config/config.json.example:/web/config.json
57 | ports:
58 | - 8080
59 | depends_on:
60 | - db
61 | environment:
62 | # - DEBUG=1 # remove this line to turn DEBUG off
63 | - DATABASE_URL=postgres://postgres:postgres@db:5432/mlm1
64 | - AUTH_REQUIRED=True
65 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
66 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
67 | networks:
68 | net:
69 | aliases:
70 | - mlm1.local.alerta.io
71 | restart: always
72 |
73 | mlm2:
74 | image: alerta/alerta-web
75 | volumes:
76 | - $PWD/config/alertad-mlm2.conf:/app/alertad.conf
77 | - $PWD/config/logging.conf:/app/logging.conf
78 | # - $PWD/config/alerta.conf.example:/app/alerta.conf
79 | # - $PWD/config/config.json.example:/web/config.json
80 | ports:
81 | - 8080
82 | depends_on:
83 | - db
84 | environment:
85 | # - DEBUG=1 # remove this line to turn DEBUG off
86 | - DATABASE_URL=postgres://postgres:postgres@db:5432/mlm2
87 | - AUTH_REQUIRED=True
88 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io
89 | - ADMIN_KEY=demo-key # assigned to first user in ADMIN_USERS
90 | networks:
91 | net:
92 | aliases:
93 | - mlm2.local.alerta.io
94 | restart: always
95 |
96 | db:
97 | image: postgres
98 | volumes:
99 | - ./pg-data:/var/lib/postgresql/data
100 | - ./scripts/:/docker-entrypoint-initdb.d/
101 | environment:
102 | POSTGRES_USER: postgres
103 | POSTGRES_PASSWORD: postgres
104 | networks:
105 | - net
106 | restart: always
107 |
108 | networks:
109 | net:
110 |
--------------------------------------------------------------------------------
/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | JINJA2="import os, sys, jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read()).render(env=os.environ)+'\n')"
5 |
6 | ALERTA_CONF_FILE=${ALERTA_CONF_FILE:-/app/alerta.conf}
7 | ALERTA_SVR_CONF_FILE=${ALERTA_SVR_CONF_FILE:-/app/alertad.conf}
8 | ALERTA_WEB_CONF_FILE=${ALERTA_WEB_CONF_FILE:-/web/config.json}
9 | NGINX_CONF_FILE=/app/nginx.conf
10 | UWSGI_CONF_FILE=/app/uwsgi.ini
11 | SUPERVISORD_CONF_FILE=/app/supervisord.conf
12 |
13 | ADMIN_USER=${ADMIN_USERS%%,*}
14 | ADMIN_PASSWORD=${ADMIN_PASSWORD:-alerta}
15 | MAXAGE=${ADMIN_KEY_MAXAGE:-315360000} # default=10 years
16 |
17 | env | sort
18 |
19 | # Generate minimal server config, if not supplied
20 | if [ ! -f "${ALERTA_SVR_CONF_FILE}" ]; then
21 | echo "# Create server configuration file."
22 | export SECRET_KEY=${SECRET_KEY:-$(< /dev/urandom tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= | head -c 32)}
23 | python3 -c "${JINJA2}" < ${ALERTA_SVR_CONF_FILE}.j2 >${ALERTA_SVR_CONF_FILE}
24 | fi
25 |
26 | # Init admin users and API keys
27 | if [ -n "${ADMIN_USERS}" ]; then
28 | echo "# Create admin users."
29 | alertad user --all --password "${ADMIN_PASSWORD}" || true
30 | echo "# Create admin API keys."
31 | alertad key --all
32 |
33 | # Create user-defined API key, if required
34 | if [ -n "${ADMIN_KEY}" ]; then
35 | echo "# Create user-defined admin API key."
36 | alertad key --username "${ADMIN_USER}" --key "${ADMIN_KEY}" --duration "${MAXAGE}"
37 | fi
38 | fi
39 |
40 | # Generate minimal client config, if not supplied
41 | if [ ! -f "${ALERTA_CONF_FILE}" ]; then
42 | # Add API key to client config, if required
43 | if [ "${AUTH_REQUIRED,,}" == "true" ]; then
44 | echo "# Auth enabled; add admin API key to client configuration."
45 | HOUSEKEEPING_SCOPES="--scope read --scope write:alerts --scope admin:management"
46 | if grep -qE 'CUSTOMER_VIEWS.*=.*True' ${ALERTA_SVR_CONF_FILE};then
47 | HOUSEKEEPING_SCOPES="--scope admin:alerts ${HOUSEKEEPING_SCOPES}"
48 | fi
49 | export API_KEY=$(alertad key \
50 | --username "${ADMIN_USER}" \
51 | ${HOUSEKEEPING_SCOPES} \
52 | --duration "${MAXAGE}" \
53 | --text "Housekeeping")
54 | fi
55 | echo "# Create client configuration file."
56 | python3 -c "${JINJA2}" < ${ALERTA_CONF_FILE}.j2 >${ALERTA_CONF_FILE}
57 | fi
58 |
59 | # Generate supervisord config, if not supplied
60 | if [ ! -f "${SUPERVISORD_CONF_FILE}" ]; then
61 | echo "# Create supervisord configuration file."
62 | python3 -c "${JINJA2}" < ${SUPERVISORD_CONF_FILE}.j2 >${SUPERVISORD_CONF_FILE}
63 | fi
64 |
65 | # Generate nginx config, if not supplied.
66 | if [ ! -f "${NGINX_CONF_FILE}" ]; then
67 | echo "# Create nginx configuration file."
68 | python3 -c "${JINJA2}" < ${NGINX_CONF_FILE}.j2 >${NGINX_CONF_FILE}
69 | fi
70 | nginx -t -c ${NGINX_CONF_FILE}
71 |
72 | # Generate uWSGI config, if not supplied.
73 | if [ ! -f "${UWSGI_CONF_FILE}" ]; then
74 | echo "# Create uWSGI configuration file."
75 | python3 -c "${JINJA2}" < ${UWSGI_CONF_FILE}.j2 >${UWSGI_CONF_FILE}
76 | fi
77 |
78 | # Generate web config, if not supplied.
79 | if [ ! -f "${ALERTA_WEB_CONF_FILE}" ]; then
80 | echo "# Create web configuration file."
81 | python3 -c "${JINJA2}" < ${ALERTA_WEB_CONF_FILE}.j2 >${ALERTA_WEB_CONF_FILE}
82 | fi
83 |
84 | echo
85 | echo '# Checking versions.'
86 | echo Alerta Server ${SERVER_VERSION}
87 | echo Alerta Client ${CLIENT_VERSION}
88 | echo Alerta WebUI ${WEBUI_VERSION}
89 |
90 | nginx -v
91 | echo uwsgi $(uwsgi --version)
92 | mongo --version | grep MongoDB
93 | psql --version
94 | python3 --version
95 | /venv/bin/pip list
96 |
97 | echo
98 | echo 'Alerta init process complete; ready for start up.'
99 | echo
100 |
101 | exec "$@"
102 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9-slim-buster
2 |
3 | ENV PYTHONUNBUFFERED 1
4 | ENV PIP_DISABLE_PIP_VERSION_CHECK=1
5 | ENV PIP_NO_CACHE_DIR=1
6 |
7 | ARG BUILD_DATE
8 | ARG RELEASE
9 | ARG VERSION
10 |
11 | ENV SERVER_VERSION=${RELEASE}
12 | ENV CLIENT_VERSION=8.5.3
13 | ENV WEBUI_VERSION=8.7.1
14 |
15 | ENV NGINX_WORKER_PROCESSES=1
16 | ENV NGINX_WORKER_CONNECTIONS=1024
17 |
18 | ENV UWSGI_PROCESSES=5
19 | ENV UWSGI_LISTEN=100
20 | ENV UWSGI_BUFFER_SIZE=8192
21 | ENV UWSGI_MAX_WORKER_LIFETIME=30
22 | ENV UWSGI_WORKER_LIFETIME_DELTA=3
23 |
24 | ENV HEARTBEAT_SEVERITY=major
25 | ENV HK_EXPIRED_DELETE_HRS=2
26 | ENV HK_INFO_DELETE_HRS=12
27 |
28 | LABEL org.opencontainers.image.description="Alerta API (prod)" \
29 | org.opencontainers.image.created=$BUILD_DATE \
30 | org.opencontainers.image.url="https://github.com/alerta/alerta/pkgs/container/alerta-api" \
31 | org.opencontainers.image.source="https://github.com/alerta/alerta" \
32 | org.opencontainers.image.version=$RELEASE \
33 | org.opencontainers.image.revision=$VERSION \
34 | org.opencontainers.image.licenses=Apache-2.0
35 |
36 | SHELL ["/bin/bash", "-o", "pipefail", "-c"]
37 |
38 | RUN apt-get update && \
39 | apt-get upgrade -y && \
40 | apt-get install -y --no-install-recommends \
41 | build-essential \
42 | curl \
43 | git \
44 | gnupg2 \
45 | libldap2-dev \
46 | libpq-dev \
47 | libsasl2-dev \
48 | postgresql-client \
49 | python3-dev \
50 | supervisor \
51 | xmlsec1 && \
52 | apt-get -y clean && \
53 | apt-get -y autoremove && \
54 | rm -rf /var/lib/apt/lists/*
55 |
56 | RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
57 | echo "deb https://nginx.org/packages/debian/ buster nginx" | tee /etc/apt/sources.list.d/nginx.list && \
58 | apt-get update && \
59 | apt-get install -y --no-install-recommends \
60 | nginx && \
61 | apt-get -y clean && \
62 | apt-get -y autoremove && \
63 | rm -rf /var/lib/apt/lists/*
64 |
65 | # hadolint ignore=DL3008
66 | RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - && \
67 | echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list && \
68 | apt-get update && \
69 | apt-get install -y --no-install-recommends \
70 | mongodb-org-shell && \
71 | apt-get -y clean && \
72 | apt-get -y autoremove && \
73 | rm -rf /var/lib/apt/lists/*
74 |
75 | COPY requirements*.txt /app/
76 |
77 | # hadolint ignore=DL3013
78 | RUN pip install --no-cache-dir pip virtualenv jinja2 && \
79 | python3 -m venv /venv && \
80 | /venv/bin/pip install --no-cache-dir --upgrade setuptools && \
81 | /venv/bin/pip install --no-cache-dir --requirement /app/requirements.txt && \
82 | /venv/bin/pip install --no-cache-dir --requirement /app/requirements-docker.txt
83 | ENV PATH $PATH:/venv/bin
84 |
85 | RUN /venv/bin/pip install alerta==${CLIENT_VERSION} alerta-server==${SERVER_VERSION}
86 | COPY install-plugins.sh /app/install-plugins.sh
87 | COPY plugins.txt /app/plugins.txt
88 | RUN /app/install-plugins.sh
89 |
90 | ADD https://github.com/alerta/alerta-webui/releases/download/v${WEBUI_VERSION}/alerta-webui.tar.gz /tmp/webui.tar.gz
91 | RUN tar zxvf /tmp/webui.tar.gz -C /tmp && \
92 | mv /tmp/dist /web
93 |
94 | ENV ALERTA_SVR_CONF_FILE /app/alertad.conf
95 | ENV ALERTA_CONF_FILE /app/alerta.conf
96 | ENV ALERTA_WEB_CONF_FILE /web/config.json
97 |
98 | COPY config/templates/app/ /app
99 | COPY config/templates/web/ /web
100 |
101 | RUN ln -sf /dev/stdout /var/log/nginx/access.log \
102 | && ln -sf /dev/stderr /var/log/nginx/error.log
103 |
104 | RUN chgrp -R 0 /app /venv /web && \
105 | chmod -R g=u /app /venv /web && \
106 | useradd -u 1001 -g 0 -d /app alerta
107 |
108 | USER 1001
109 |
110 | COPY docker-entrypoint.sh /usr/local/bin/
111 |
112 | ENTRYPOINT ["docker-entrypoint.sh"]
113 |
114 | EXPOSE 8080 1717
115 | CMD ["supervisord", "-c", "/app/supervisord.conf"]
116 |
--------------------------------------------------------------------------------
/examples/keycloak/config/demo-realm.json:
--------------------------------------------------------------------------------
1 | {
2 | "realm": "demo",
3 | "enabled": true,
4 | "groups": [
5 | {
6 | "name": "devops",
7 | "path": "/devops",
8 | "attributes": {
9 | "Team": [
10 | "DevOps"
11 | ]
12 | },
13 | "realmRoles": [
14 | "admin"
15 | ],
16 | "clientRoles": {},
17 | "subGroups": []
18 | }
19 | ],
20 | "users": [
21 | {
22 | "username": "alice",
23 | "enabled": true,
24 | "credentials": [
25 | {
26 | "type": "password",
27 | "value": "alice"
28 | }
29 | ],
30 | "realmRoles": [
31 | "user"
32 | ]
33 | },
34 | {
35 | "username": "jdoe",
36 | "enabled": true,
37 | "credentials": [
38 | {
39 | "type": "password",
40 | "value": "jdoe"
41 | }
42 | ],
43 | "realmRoles": [
44 | "user",
45 | "user_premium"
46 | ]
47 | },
48 | {
49 | "username": "admin",
50 | "enabled": true,
51 | "credentials": [
52 | {
53 | "type": "password",
54 | "value": "admin"
55 | }
56 | ],
57 | "realmRoles": [
58 | "user",
59 | "admin"
60 | ],
61 | "clientRoles": {
62 | "realm-management": [
63 | "realm-admin"
64 | ]
65 | }
66 | },
67 | {
68 | "username" : "user",
69 | "enabled": true,
70 | "email" : "sample-user@example.com",
71 | "firstName": "Sample",
72 | "lastName": "User",
73 | "credentials" : [
74 | { "type" : "password",
75 | "value" : "password" }
76 | ],
77 | "realmRoles": [ "user" ]
78 | }
79 | ],
80 | "roles": {
81 | "realm": [
82 | {
83 | "name": "user",
84 | "description": "User privileges"
85 | },
86 | {
87 | "name": "admin",
88 | "description": "Administrator privileges"
89 | },
90 | {
91 | "name": "user_premium",
92 | "description": "User Premium privileges"
93 | }
94 | ]
95 | },
96 | "clients": [
97 | {
98 | "id": "16e7f9f8-abba-4bb1-8d66-85f95e011c2e",
99 | "clientId": "alerta-webui",
100 | "rootUrl": "http://host.docker.internal:8000",
101 | "adminUrl": "http://host.docker.internal:8000",
102 | "surrogateAuthRequired": false,
103 | "enabled": true,
104 | "clientAuthenticatorType": "client-secret",
105 | "secret": "fa134126-222b-4fc3-a8dd-070a28f39e88",
106 | "redirectUris": [
107 | "http://host.docker.internal:8000/*"
108 | ],
109 | "webOrigins": [
110 | "http://host.docker.internal:8000"
111 | ],
112 | "notBefore": 0,
113 | "bearerOnly": false,
114 | "consentRequired": false,
115 | "standardFlowEnabled": true,
116 | "implicitFlowEnabled": false,
117 | "directAccessGrantsEnabled": true,
118 | "serviceAccountsEnabled": false,
119 | "publicClient": false,
120 | "frontchannelLogout": false,
121 | "protocol": "openid-connect",
122 | "attributes": {
123 | "saml.assertion.signature": "false",
124 | "saml.force.post.binding": "false",
125 | "saml.multivalued.roles": "false",
126 | "saml.encrypt": "false",
127 | "saml.server.signature": "false",
128 | "saml.server.signature.keyinfo.ext": "false",
129 | "exclude.session.state.from.auth.response": "false",
130 | "saml_force_name_id_format": "false",
131 | "saml.client.signature": "false",
132 | "tls.client.certificate.bound.access.tokens": "false",
133 | "saml.authnstatement": "false",
134 | "display.on.consent.screen": "false",
135 | "saml.onetimeuse.condition": "false"
136 | },
137 | "authenticationFlowBindingOverrides": {},
138 | "fullScopeAllowed": true,
139 | "nodeReRegistrationTimeout": -1,
140 | "defaultClientScopes": [
141 | "web-origins",
142 | "role_list",
143 | "profile",
144 | "roles",
145 | "email"
146 | ],
147 | "optionalClientScopes": [
148 | "address",
149 | "phone",
150 | "offline_access",
151 | "microprofile-jwt"
152 | ]
153 | }
154 | ]
155 | }
--------------------------------------------------------------------------------
/contrib/kubernetes/helm/alerta/templates/deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: {{ include "alerta.fullname" . }}
5 | labels:
6 | app: {{ include "alerta.name" . }}
7 | chart: {{ include "alerta.chart" . }}
8 | release: {{ .Release.Name }}
9 | heritage: {{ .Release.Service }}
10 | spec:
11 | replicas: {{ .Values.replicaCount }}
12 | selector:
13 | matchLabels:
14 | app: {{ include "alerta.name" . }}
15 | release: {{ .Release.Name }}
16 | template:
17 | metadata:
18 | labels:
19 | app: {{ include "alerta.name" . }}
20 | release: {{ .Release.Name }}
21 | annotations:
22 | checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
23 | checksum/secrets: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
24 | spec:
25 | containers:
26 | - name: {{ .Chart.Name }}
27 | image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
28 | imagePullPolicy: {{ .Values.image.pullPolicy }}
29 | env:
30 | {{- if .Values.alertaAdminUsers }}
31 | - name: ADMIN_USERS
32 | value: {{ .Values.alertaAdminUsers | join "," }}
33 | {{- end }}
34 | - name: ADMIN_PASSWORD
35 | valueFrom:
36 | secretKeyRef:
37 | name: {{ template "alerta.fullname" . }}
38 | key: alerta-admin-password
39 | {{- if .Values.alertaAdminKey }}
40 | - name: ADMIN_KEY
41 | valueFrom:
42 | secretKeyRef:
43 | name: {{ template "alerta.fullname" . }}
44 | key: alerta-admin-key
45 | - name: ALERTA_API_KEY
46 | valueFrom:
47 | secretKeyRef:
48 | name: {{ template "alerta.fullname" . }}
49 | key: alerta-api-key
50 | {{- end }}
51 | {{- if .Values.alertaInstallPlugins }}
52 | - name: INSTALL_PLUGINS
53 | value: {{ .Values.alertaInstallPlugins | join "," }}
54 | {{- end }}
55 | {{- if .Values.extraEnvVars }}
56 | {{- range $key, $value := .Values.extraEnvVars }}
57 | - name: {{ $key | quote}}
58 | value: {{ $value | quote}}
59 | {{- end }}
60 | {{- end }}
61 | ports:
62 | - name: http
63 | containerPort: 8080
64 | protocol: TCP
65 | livenessProbe:
66 | httpGet:
67 | path: /
68 | port: http
69 | initialDelaySeconds: 300
70 | readinessProbe:
71 | httpGet:
72 | path: /
73 | port: http
74 | initialDelaySeconds: 5
75 | volumeMounts:
76 | {{- range .Values.extraSecretMounts }}
77 | - name: {{ .name }}
78 | mountPath: {{ .mountPath }}
79 | subPath: {{ .subPath }}
80 | readOnly: {{ .readOnly }}
81 | {{- end }}
82 | - name: alerta-config
83 | mountPath: /app/alertad.conf
84 | subPath: alertad.conf
85 | {{- if .Values.alertaWebUIConfig }}
86 | - name: alerta-config
87 | mountPath: /app/config.js
88 | subPath: config.js
89 | {{- end }}
90 | {{- if .Values.extraConfigs }}
91 | {{- range .Values.extraConfigs }}
92 | - name: alerta-config
93 | mountPath: {{ .mountPath }}
94 | subPath: {{ .subPath }}
95 | {{- end }}
96 | {{- end }}
97 | resources:
98 | {{ toYaml .Values.resources | indent 12 }}
99 | volumes:
100 | - name: alerta-config
101 | configMap:
102 | name: {{ include "alerta.fullname" . }}
103 | {{- range .Values.extraSecretMounts }}
104 | - name: {{ .name }}
105 | secret:
106 | secretName: {{ .secretName }}
107 | {{- end }}
108 | {{- with .Values.nodeSelector }}
109 | nodeSelector:
110 | {{ toYaml . | indent 8 }}
111 | {{- end }}
112 | {{- with .Values.affinity }}
113 | affinity:
114 | {{ toYaml . | indent 8 }}
115 | {{- end }}
116 | {{- with .Values.tolerations }}
117 | tolerations:
118 | {{ toYaml . | indent 8 }}
119 | {{- end }}
120 |
--------------------------------------------------------------------------------
/tests/spec/helpers/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rspec --init` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # The `.rspec` file also contains a few flags that are not defaults but that
16 | # users commonly want.
17 | #
18 | # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
19 | RSpec.configure do |config|
20 | # rspec-expectations config goes here. You can use an alternate
21 | # assertion/expectation library such as wrong or the stdlib/minitest
22 | # assertions if you prefer.
23 | config.expect_with :rspec do |expectations|
24 | # This option will default to `true` in RSpec 4. It makes the `description`
25 | # and `failure_message` of custom matchers include text for helper methods
26 | # defined using `chain`, e.g.:
27 | # be_bigger_than(2).and_smaller_than(4).description
28 | # # => "be bigger than 2 and smaller than 4"
29 | # ...rather than:
30 | # # => "be bigger than 2"
31 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
32 | end
33 |
34 | # rspec-mocks config goes here. You can use an alternate test double
35 | # library (such as bogus or mocha) by changing the `mock_with` option here.
36 | config.mock_with :rspec do |mocks|
37 | # Prevents you from mocking or stubbing a method that does not exist on
38 | # a real object. This is generally recommended, and will default to
39 | # `true` in RSpec 4.
40 | mocks.verify_partial_doubles = true
41 | end
42 |
43 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
44 | # have no way to turn it off -- the option exists only for backwards
45 | # compatibility in RSpec 3). It causes shared context metadata to be
46 | # inherited by the metadata hash of host groups and examples, rather than
47 | # triggering implicit auto-inclusion in groups with matching metadata.
48 | config.shared_context_metadata_behavior = :apply_to_host_groups
49 |
50 | config.formatter = :documentation
51 |
52 | # The settings below are suggested to provide a good initial experience
53 | # with RSpec, but feel free to customize to your heart's content.
54 | =begin
55 | # This allows you to limit a spec run to individual examples or groups
56 | # you care about by tagging them with `:focus` metadata. When nothing
57 | # is tagged with `:focus`, all examples get run. RSpec also provides
58 | # aliases for `it`, `describe`, and `context` that include `:focus`
59 | # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
60 | config.filter_run_when_matching :focus
61 |
62 | # Allows RSpec to persist some state between runs in order to support
63 | # the `--only-failures` and `--next-failure` CLI options. We recommend
64 | # you configure your source control system to ignore this file.
65 | config.example_status_persistence_file_path = "spec/examples.txt"
66 |
67 | # Limits the available syntax to the non-monkey patched syntax that is
68 | # recommended. For more details, see:
69 | # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
70 | # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71 | # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
72 | config.disable_monkey_patching!
73 |
74 | # This setting enables warnings. It's recommended, but in some cases may
75 | # be too noisy due to issues in dependencies.
76 | config.warnings = true
77 |
78 | # Many RSpec users commonly either run the entire suite or an individual
79 | # file, and it's useful to allow more verbose output when running an
80 | # individual spec file.
81 | if config.files_to_run.one?
82 | # Use the documentation formatter for detailed output,
83 | # unless a formatter has already been configured
84 | # (e.g. via a command-line flag).
85 | config.default_formatter = 'doc'
86 | end
87 |
88 | # Print the 10 slowest examples and example groups at the
89 | # end of the spec run, to help surface which specs are running
90 | # particularly slow.
91 | config.profile_examples = 10
92 |
93 | # Run specs in random order to surface order dependencies. If you find an
94 | # order dependency and want to debug it, you can fix the order by providing
95 | # the seed, which is printed after each run.
96 | # --seed 1234
97 | config.order = :random
98 |
99 | # Seed global randomization in this process using the `--seed` CLI option.
100 | # Setting this allows you to use `--seed` to deterministically reproduce
101 | # test failures related to randomization by passing the same `--seed` value
102 | # as the one that triggered the failure.
103 | Kernel.srand config.seed
104 | =end
105 | end
106 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | What is Alerta?
2 | ===============
3 |
4 | The alerta monitoring system is a tool used to consolidate and
5 | de-duplicate alerts from multiple sources for quick ‘at-a-glance’
6 | visualisation. With just one system you can monitor alerts from
7 | many other monitoring tools on a single screen.
8 |
9 | How to use this image
10 | =====================
11 |
12 | To use this image run either a `mongo` or `postgres` container first:
13 |
14 | $ docker run --name alerta-db -d mongo
15 |
16 | Then link to the database container when running the `alerta-web` container:
17 |
18 | $ export DATABASE_URL=mongodb://db:27017/monitoring
19 | $ docker run --name alerta-web -e DATABASE_URL=$DATABASE_URL --link alerta-db:db \
20 | -d -p :8080 alerta/alerta-web
21 |
22 | The API endpoint is at:
23 |
24 | http://:/api
25 |
26 | Browse to the alerta console at:
27 |
28 | http://:/
29 |
30 | Environment Variables
31 | ---------------------
32 |
33 | The following environment variables are supported for configuring
34 | the `alerta-web` container specifically for Docker deployments:
35 |
36 | `ADMIN_PASSWORD`
37 | - sets the password of all admins. Should be changed at first login. default: alerta
38 |
39 | `ADMIN_KEY`
40 | - sets an admin API key.
41 |
42 | `ADMIN_KEY_MAXAGE`
43 | - sets the duration of the admin key (seconds) default: 10 years
44 |
45 | `HEARTBEAT_SEVERITY`
46 | - severity used to create alerts for stale heartbeats
47 |
48 | The following environment variables are supported by the Alerta
49 | API to ease deployment more generally:
50 |
51 | `DEBUG`
52 | - debug mode for increased logging. equivalent of setting `LOG_LEVEL=debug` (eg. `DEBUG=1`)
53 |
54 | `LOG_LEVEL`
55 | - log level of Alerta application and nginx (default:`warn`)
56 |
57 | `SUPERVISORD_LOG_LEVEL`
58 | - log level of supervisord, must be `debug` or lower to see appliation logs (default:`debug`)
59 |
60 | `SECRET_KEY`
61 | - a unique, randomly generated sequence of ASCII characters.
62 |
63 | `DATABASE_URL`
64 | - database connection URI string. Only MongoDB and Postgres allowed.
65 |
66 | `DATABASE_NAME`
67 | - used to override database name in `DATABASE_URL`.
68 |
69 | `AUTH_REQUIRED`
70 | - require users to authenticate when using web UI or `alerta` CLI.
71 |
72 | `AUTH_PROVIDER`
73 | - authentication provider eg. basic, ldap, openid, saml2, keycloak
74 |
75 | `ADMIN_USERS`
76 | - comma-separated list of logins that will be created with "admin" role.
77 |
78 | `CUSTOMER_VIEWS`
79 | - enable alert views partitioned by customer. (default:``False``)
80 |
81 | `OAUTH2_CLIENT_ID`
82 | - client ID required by OAuth2 provider
83 |
84 | `OAUTH2_CLIENT_SECRET`
85 | - client secret required by OAuth2 provider
86 |
87 | `ALLOWED_EMAIL_DOMAINS`
88 | - list of authorised email domains when using Google
89 |
90 | `GITHUB_URL`
91 | - GitHub Enteprise URL for privately run GitHub server
92 |
93 | `ALLOWED_GITHUB_ORGS`
94 | - list of authorised GitHub organisations when using GitHub
95 |
96 | `GITLAB_URL`
97 | - GitLab website URL for public or privately run GitLab server
98 |
99 | `ALLOWED_GITLAB_GROUPS`
100 | - list of authorised GitLab groups when using GitLab
101 |
102 | `KEYCLOAK_URL`
103 | - Keycloak URL
104 |
105 | `KEYCLOAK_REALM`
106 | - Keycloak realm
107 |
108 | `ALLOWED_KEYCLOAK_ROLES`
109 | - Keycloak roles
110 |
111 | `CORS_ORIGINS`
112 | - list of URL origins that can access the API
113 |
114 | `MAIL_FROM`
115 | - valid email address from which verification emails are sent
116 |
117 | `SMTP_PASSWORD`
118 | - password for ``MAIL_FROM`` email account
119 |
120 | `PLUGINS`
121 | - list of plugins to enable.
122 |
123 | `NGINX_WORKER_PROCESSES`
124 | - number of worker processes (default:`1`)
125 |
126 | `NGINX_WORKER_CONNECTIONS`
127 | - maximum number of simultaneous connections that can be opened by a worker process (default:`1024`)
128 |
129 | `UWSGI_PROCESSES`
130 | - number of processes for uWSGI (default:`5`)
131 |
132 | `UWSGI_LISTEN`
133 | - max number of concurrent connections (default:`100`)
134 |
135 | `UWSGI_BUFFER_SIZE`
136 | - size of the unix socket buffer (default:`8192`)
137 |
138 | `UWSGI_MAX_WORKER_LIFETIME`
139 | - reload worker after this many seconds (default:`30`)
140 |
141 | `UWSGI_WORKER_LIFETIME_DELTA`
142 | - time in seconds to stagger UWSGI worker respawns (default:`3`)
143 |
144 | Configuration Files
145 | -------------------
146 |
147 | To set configuration settings not supported by environment variables use
148 | configuration files instead. For example:
149 |
150 | $ docker run -v $PWD/config/alertad.conf:/app/alertad.conf \
151 | -v $PWD/config/config.json:/web/config.json \
152 | -p :8080 alerta/alerta-web
153 |
154 | For a full list of server configuration options see https://docs.alerta.io.
155 |
156 | Plugins
157 | -------
158 |
159 | All built-in and contributed plugins are installed at image build time. Only
160 | plugins listed in `PLUGINS` environment variabled will be enabled.
161 |
162 | In the example below, of all the plugins installed only those listed will
163 | be enabled at container start time:
164 |
165 | PLUGINS=remote_ip,reject,heartbeat,blackout,slack,prometheus
166 |
167 | Custom plugins should be installed as an additional image layer.
168 |
169 | Authentication
170 | --------------
171 |
172 | To make it easy to get going with Alerta on docker quickly, the default image
173 | will use Basic Auth for user logins and login will be optional.
174 |
175 | To allow users to login using Google OAuth, go to the [Google Developer Console][1]
176 | and create a new client ID for a web application. Then set the `CLIENT_ID`
177 | and `CLIENT_SECRET` environment variables on the command line as follows:
178 |
179 | $ export CLIENT_ID=379647311730-6tfdcopl5fodke08el52nnoj3x8mpl3.apps.googleusercontent.com
180 | $ export CLIENT_SECRET=UpJxs02c_bx9GlI3X8MPL3-p
181 |
182 | Now pass in the defined environment variables to the `docker run` command:
183 |
184 | $ docker run --name alerta-web -e AUTH_PROVIDER=google -e CLIENT_ID=$CLIENT_ID \
185 | -e CLIENT_SECRET=$CLIENT_SECRET -d -p :8080 alerta/alerta-web
186 |
187 | This will allow users to login but will only make it optional. To enforce
188 | users to login you must also set the `AUTH_REQUIRED` environment variable to
189 | `True` when starting the docker image:
190 |
191 | $ docker run --name alerta-web -e AUTH_REQUIRED=True -e ...
192 |
193 | To restrict logins to a certain email domain set the `ALLOWED_EMAIL_DOMAIN`
194 | environment variable as follows:
195 |
196 | $ docker run --name alerta-web -e ALLOWED_EMAIL_DOMAIN=example.com ...
197 |
198 | GitHub and GitLab can also be used as the OAuth2 providers by setting the
199 | `AUTH_PROVIDER` environment variable to `github` and `gitlab` respectively. For
200 | more information on using GitHub, GitHub Enterprise or GitLab as th OAuth2
201 | provider see https://docs.alerta.io
202 |
203 | Docker Compose
204 | --------------
205 |
206 | Use `docker-compose` to create and start Alerta and Postgres with
207 | one command:
208 |
209 | $ docker-compose up
210 |
211 | **Example Docker Compose File**
212 |
213 | ```yaml
214 | version: '2.1'
215 | services:
216 | web:
217 | image: alerta/alerta-web
218 | ports:
219 | - "8080:8080"
220 | depends_on:
221 | - db
222 | environment:
223 | - DEBUG=1 # remove this line to turn DEBUG off
224 | - DATABASE_URL=postgres://postgres:postgres@db:5432/monitoring
225 | - AUTH_REQUIRED=True
226 | - ADMIN_USERS=admin@alerta.io,devops@alerta.io #default password: alerta
227 | - ADMIN_KEY=demo-key
228 | - PLUGINS=reject,blackout,normalise,enhance
229 | restart: always
230 | db:
231 | image: postgres
232 | volumes:
233 | - ./pg-data:/var/lib/postgresql/data
234 | environment:
235 | POSTGRES_DB: monitoring
236 | POSTGRES_USER: postgres
237 | POSTGRES_PASSWORD: postgres
238 | restart: always
239 | ```
240 |
241 | Command-line Tool
242 | -----------------
243 |
244 | A command-line tool for alerta is available. To install it run:
245 |
246 | $ pip install alerta
247 |
248 | Configuration file `$HOME/.alerta.conf`:
249 |
250 | [DEFAULT]
251 | endpoint = http://:/api
252 |
253 | If authentication is enabled (ie. `AUTH_REQUIRED` is `True`), then create
254 | a new API key in the Alerta console and add the key to the configuration
255 | file. For example:
256 |
257 | [DEFAULT]
258 | endpoint = ...
259 | key = 4nHAAslsGjLQ9P0QxmAlKIapLTSDfEfMDSy8BT+0
260 |
261 | Further Reading
262 | ---------------
263 |
264 | More information about Alerta can be found at http://docs.alerta.io
265 |
266 | License
267 | -------
268 |
269 | Copyright (c) 2014-2020 Nick Satterly. Available under the MIT License.
270 |
271 | [1]: "Google Developer Console"
272 |
--------------------------------------------------------------------------------
/examples/apache/proxy/httpd.conf:
--------------------------------------------------------------------------------
1 | #
2 | # This is the main Apache HTTP server configuration file. It contains the
3 | # configuration directives that give the server its instructions.
4 | # See for detailed information.
5 | # In particular, see
6 | #
7 | # for a discussion of each configuration directive.
8 | #
9 | # Do NOT simply read the instructions in here without understanding
10 | # what they do. They're here only as hints or reminders. If you are unsure
11 | # consult the online docs. You have been warned.
12 | #
13 | # Configuration and logfile names: If the filenames you specify for many
14 | # of the server's control files begin with "/" (or "drive:/" for Win32), the
15 | # server will use that explicit path. If the filenames do *not* begin
16 | # with "/", the value of ServerRoot is prepended -- so "logs/access_log"
17 | # with ServerRoot set to "/usr/local/apache2" will be interpreted by the
18 | # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log"
19 | # will be interpreted as '/logs/access_log'.
20 |
21 | #
22 | # ServerRoot: The top of the directory tree under which the server's
23 | # configuration, error, and log files are kept.
24 | #
25 | # Do not add a slash at the end of the directory path. If you point
26 | # ServerRoot at a non-local disk, be sure to specify a local disk on the
27 | # Mutex directive, if file-based mutexes are used. If you wish to share the
28 | # same ServerRoot for multiple httpd daemons, you will need to change at
29 | # least PidFile.
30 | #
31 | ServerRoot "/usr/local/apache2"
32 |
33 | #
34 | # Mutex: Allows you to set the mutex mechanism and mutex file directory
35 | # for individual mutexes, or change the global defaults
36 | #
37 | # Uncomment and change the directory if mutexes are file-based and the default
38 | # mutex file directory is not on a local disk or is not appropriate for some
39 | # other reason.
40 | #
41 | # Mutex default:logs
42 |
43 | #
44 | # Listen: Allows you to bind Apache to specific IP addresses and/or
45 | # ports, instead of the default. See also the
46 | # directive.
47 | #
48 | # Change this to Listen on specific IP addresses as shown below to
49 | # prevent Apache from glomming onto all bound IP addresses.
50 | #
51 | #Listen 12.34.56.78:80
52 | Listen 80
53 |
54 | #
55 | # Dynamic Shared Object (DSO) Support
56 | #
57 | # To be able to use the functionality of a module which was built as a DSO you
58 | # have to place corresponding `LoadModule' lines at this location so the
59 | # directives contained in it are actually available _before_ they are used.
60 | # Statically compiled modules (those listed by `httpd -l') do not need
61 | # to be loaded here.
62 | #
63 | # Example:
64 | # LoadModule foo_module modules/mod_foo.so
65 | #
66 | LoadModule mpm_event_module modules/mod_mpm_event.so
67 | #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
68 | #LoadModule mpm_worker_module modules/mod_mpm_worker.so
69 | LoadModule authn_file_module modules/mod_authn_file.so
70 | #LoadModule authn_dbm_module modules/mod_authn_dbm.so
71 | #LoadModule authn_anon_module modules/mod_authn_anon.so
72 | #LoadModule authn_dbd_module modules/mod_authn_dbd.so
73 | #LoadModule authn_socache_module modules/mod_authn_socache.so
74 | LoadModule authn_core_module modules/mod_authn_core.so
75 | LoadModule authz_host_module modules/mod_authz_host.so
76 | LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
77 | LoadModule authz_user_module modules/mod_authz_user.so
78 | #LoadModule authz_dbm_module modules/mod_authz_dbm.so
79 | #LoadModule authz_owner_module modules/mod_authz_owner.so
80 | #LoadModule authz_dbd_module modules/mod_authz_dbd.so
81 | LoadModule authz_core_module modules/mod_authz_core.so
82 | #LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
83 | #LoadModule authnz_fcgi_module modules/mod_authnz_fcgi.so
84 | LoadModule access_compat_module modules/mod_access_compat.so
85 | LoadModule auth_basic_module modules/mod_auth_basic.so
86 | #LoadModule auth_form_module modules/mod_auth_form.so
87 | #LoadModule auth_digest_module modules/mod_auth_digest.so
88 | #LoadModule allowmethods_module modules/mod_allowmethods.so
89 | #LoadModule isapi_module modules/mod_isapi.so
90 | #LoadModule file_cache_module modules/mod_file_cache.so
91 | #LoadModule cache_module modules/mod_cache.so
92 | #LoadModule cache_disk_module modules/mod_cache_disk.so
93 | #LoadModule cache_socache_module modules/mod_cache_socache.so
94 | #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
95 | #LoadModule socache_dbm_module modules/mod_socache_dbm.so
96 | #LoadModule socache_memcache_module modules/mod_socache_memcache.so
97 | #LoadModule socache_redis_module modules/mod_socache_redis.so
98 | #LoadModule watchdog_module modules/mod_watchdog.so
99 | #LoadModule macro_module modules/mod_macro.so
100 | #LoadModule dbd_module modules/mod_dbd.so
101 | #LoadModule bucketeer_module modules/mod_bucketeer.so
102 | #LoadModule dumpio_module modules/mod_dumpio.so
103 | #LoadModule echo_module modules/mod_echo.so
104 | #LoadModule example_hooks_module modules/mod_example_hooks.so
105 | #LoadModule case_filter_module modules/mod_case_filter.so
106 | #LoadModule case_filter_in_module modules/mod_case_filter_in.so
107 | #LoadModule example_ipc_module modules/mod_example_ipc.so
108 | #LoadModule buffer_module modules/mod_buffer.so
109 | #LoadModule data_module modules/mod_data.so
110 | #LoadModule ratelimit_module modules/mod_ratelimit.so
111 | LoadModule reqtimeout_module modules/mod_reqtimeout.so
112 | #LoadModule ext_filter_module modules/mod_ext_filter.so
113 | #LoadModule request_module modules/mod_request.so
114 | #LoadModule include_module modules/mod_include.so
115 | LoadModule filter_module modules/mod_filter.so
116 | #LoadModule reflector_module modules/mod_reflector.so
117 | #LoadModule substitute_module modules/mod_substitute.so
118 | #LoadModule sed_module modules/mod_sed.so
119 | #LoadModule charset_lite_module modules/mod_charset_lite.so
120 | #LoadModule deflate_module modules/mod_deflate.so
121 | #LoadModule xml2enc_module modules/mod_xml2enc.so
122 | #LoadModule proxy_html_module modules/mod_proxy_html.so
123 | #LoadModule brotli_module modules/mod_brotli.so
124 | LoadModule mime_module modules/mod_mime.so
125 | #LoadModule ldap_module modules/mod_ldap.so
126 | LoadModule log_config_module modules/mod_log_config.so
127 | #LoadModule log_debug_module modules/mod_log_debug.so
128 | #LoadModule log_forensic_module modules/mod_log_forensic.so
129 | #LoadModule logio_module modules/mod_logio.so
130 | #LoadModule lua_module modules/mod_lua.so
131 | LoadModule env_module modules/mod_env.so
132 | #LoadModule mime_magic_module modules/mod_mime_magic.so
133 | #LoadModule cern_meta_module modules/mod_cern_meta.so
134 | #LoadModule expires_module modules/mod_expires.so
135 | LoadModule headers_module modules/mod_headers.so
136 | #LoadModule ident_module modules/mod_ident.so
137 | #LoadModule usertrack_module modules/mod_usertrack.so
138 | #LoadModule unique_id_module modules/mod_unique_id.so
139 | LoadModule setenvif_module modules/mod_setenvif.so
140 | LoadModule version_module modules/mod_version.so
141 | #LoadModule remoteip_module modules/mod_remoteip.so
142 | LoadModule proxy_module modules/mod_proxy.so
143 | #LoadModule proxy_connect_module modules/mod_proxy_connect.so
144 | #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
145 | LoadModule proxy_http_module modules/mod_proxy_http.so
146 | #LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
147 | #LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
148 | #LoadModule proxy_uwsgi_module modules/mod_proxy_uwsgi.so
149 | #LoadModule proxy_fdpass_module modules/mod_proxy_fdpass.so
150 | #LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
151 | #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
152 | #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
153 | #LoadModule proxy_express_module modules/mod_proxy_express.so
154 | #LoadModule proxy_hcheck_module modules/mod_proxy_hcheck.so
155 | #LoadModule session_module modules/mod_session.so
156 | #LoadModule session_cookie_module modules/mod_session_cookie.so
157 | #LoadModule session_crypto_module modules/mod_session_crypto.so
158 | #LoadModule session_dbd_module modules/mod_session_dbd.so
159 | #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
160 | #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
161 | #LoadModule ssl_module modules/mod_ssl.so
162 | #LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
163 | #LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
164 | #LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
165 | #LoadModule optional_fn_export_module modules/mod_optional_fn_export.so
166 | #LoadModule dialup_module modules/mod_dialup.so
167 | #LoadModule http2_module modules/mod_http2.so
168 | #LoadModule proxy_http2_module modules/mod_proxy_http2.so
169 | #LoadModule md_module modules/mod_md.so
170 | #LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so
171 | #LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so
172 | #LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so
173 | #LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so
174 | LoadModule unixd_module modules/mod_unixd.so
175 | #LoadModule heartbeat_module modules/mod_heartbeat.so
176 | #LoadModule heartmonitor_module modules/mod_heartmonitor.so
177 | #LoadModule dav_module modules/mod_dav.so
178 | LoadModule status_module modules/mod_status.so
179 | LoadModule autoindex_module modules/mod_autoindex.so
180 | #LoadModule asis_module modules/mod_asis.so
181 | #LoadModule info_module modules/mod_info.so
182 | #LoadModule suexec_module modules/mod_suexec.so
183 |
184 | #LoadModule cgid_module modules/mod_cgid.so
185 |
186 |
187 | #LoadModule cgi_module modules/mod_cgi.so
188 |
189 | #LoadModule dav_fs_module modules/mod_dav_fs.so
190 | #LoadModule dav_lock_module modules/mod_dav_lock.so
191 | #LoadModule vhost_alias_module modules/mod_vhost_alias.so
192 | #LoadModule negotiation_module modules/mod_negotiation.so
193 | LoadModule dir_module modules/mod_dir.so
194 | #LoadModule imagemap_module modules/mod_imagemap.so
195 | #LoadModule actions_module modules/mod_actions.so
196 | #LoadModule speling_module modules/mod_speling.so
197 | #LoadModule userdir_module modules/mod_userdir.so
198 | LoadModule alias_module modules/mod_alias.so
199 | #LoadModule rewrite_module modules/mod_rewrite.so
200 |
201 |
202 | #
203 | # If you wish httpd to run as a different user or group, you must run
204 | # httpd as root initially and it will switch.
205 | #
206 | # User/Group: The name (or #number) of the user/group to run httpd as.
207 | # It is usually good practice to create a dedicated user and group for
208 | # running httpd, as with most system services.
209 | #
210 | User daemon
211 | Group daemon
212 |
213 |
214 |
215 | # 'Main' server configuration
216 | #
217 | # The directives in this section set up the values used by the 'main'
218 | # server, which responds to any requests that aren't handled by a
219 | # definition. These values also provide defaults for
220 | # any containers you may define later in the file.
221 | #
222 | # All of these directives may appear inside containers,
223 | # in which case these default settings will be overridden for the
224 | # virtual host being defined.
225 | #
226 |
227 | #
228 | # ServerAdmin: Your address, where problems with the server should be
229 | # e-mailed. This address appears on some server-generated pages, such
230 | # as error documents. e.g. admin@your-domain.com
231 | #
232 | ServerAdmin you@example.com
233 |
234 | #
235 | # ServerName gives the name and port that the server uses to identify itself.
236 | # This can often be determined automatically, but we recommend you specify
237 | # it explicitly to prevent problems during startup.
238 | #
239 | # If your host doesn't have a registered DNS name, enter its IP address here.
240 | #
241 | #ServerName www.example.com:80
242 |
243 | #
244 | # Deny access to the entirety of your server's filesystem. You must
245 | # explicitly permit access to web content directories in other
246 | # blocks below.
247 | #
248 |
249 | AllowOverride none
250 | Require all denied
251 |
252 |
253 | #
254 | # Note that from this point forward you must specifically allow
255 | # particular features to be enabled - so if something's not working as
256 | # you might expect, make sure that you have specifically enabled it
257 | # below.
258 | #
259 |
260 | #
261 | # DocumentRoot: The directory out of which you will serve your
262 | # documents. By default, all requests are taken from this directory, but
263 | # symbolic links and aliases may be used to point to other locations.
264 | #
265 | DocumentRoot "/usr/local/apache2/htdocs"
266 |
267 | #
268 | # Possible values for the Options directive are "None", "All",
269 | # or any combination of:
270 | # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
271 | #
272 | # Note that "MultiViews" must be named *explicitly* --- "Options All"
273 | # doesn't give it to you.
274 | #
275 | # The Options directive is both complicated and important. Please see
276 | # http://httpd.apache.org/docs/2.4/mod/core.html#options
277 | # for more information.
278 | #
279 | Options Indexes FollowSymLinks
280 |
281 | #
282 | # AllowOverride controls what directives may be placed in .htaccess files.
283 | # It can be "All", "None", or any combination of the keywords:
284 | # AllowOverride FileInfo AuthConfig Limit
285 | #
286 | AllowOverride None
287 |
288 | #
289 | # Controls who can get stuff from this server.
290 | #
291 | Require all granted
292 |
293 |
294 | #
295 | # DirectoryIndex: sets the file that Apache will serve if a directory
296 | # is requested.
297 | #
298 |
299 | DirectoryIndex index.html
300 |
301 |
302 | #
303 | # The following lines prevent .htaccess and .htpasswd files from being
304 | # viewed by Web clients.
305 | #
306 |
307 | Require all denied
308 |
309 |
310 | #
311 | # ErrorLog: The location of the error log file.
312 | # If you do not specify an ErrorLog directive within a
313 | # container, error messages relating to that virtual host will be
314 | # logged here. If you *do* define an error logfile for a
315 | # container, that host's errors will be logged there and not here.
316 | #
317 | ErrorLog /proc/self/fd/2
318 |
319 | #
320 | # LogLevel: Control the number of messages logged to the error_log.
321 | # Possible values include: debug, info, notice, warn, error, crit,
322 | # alert, emerg.
323 | #
324 | LogLevel warn
325 |
326 |
327 | #
328 | # The following directives define some format nicknames for use with
329 | # a CustomLog directive (see below).
330 | #
331 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
332 | LogFormat "%h %l %u %t \"%r\" %>s %b" common
333 |
334 |
335 | # You need to enable mod_logio.c to use %I and %O
336 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
337 |
338 |
339 | #
340 | # The location and format of the access logfile (Common Logfile Format).
341 | # If you do not define any access logfiles within a
342 | # container, they will be logged here. Contrariwise, if you *do*
343 | # define per- access logfiles, transactions will be
344 | # logged therein and *not* in this file.
345 | #
346 | CustomLog /proc/self/fd/1 common
347 |
348 | #
349 | # If you prefer a logfile with access, agent, and referer information
350 | # (Combined Logfile Format) you can use the following directive.
351 | #
352 | #CustomLog "logs/access_log" combined
353 |
354 |
355 |
356 | #
357 | # Redirect: Allows you to tell clients about documents that used to
358 | # exist in your server's namespace, but do not anymore. The client
359 | # will make a new request for the document at its new location.
360 | # Example:
361 | # Redirect permanent /foo http://www.example.com/bar
362 |
363 | #
364 | # Alias: Maps web paths into filesystem paths and is used to
365 | # access content that does not live under the DocumentRoot.
366 | # Example:
367 | # Alias /webpath /full/filesystem/path
368 | #
369 | # If you include a trailing / on /webpath then the server will
370 | # require it to be present in the URL. You will also likely
371 | # need to provide a section to allow access to
372 | # the filesystem path.
373 |
374 | #
375 | # ScriptAlias: This controls which directories contain server scripts.
376 | # ScriptAliases are essentially the same as Aliases, except that
377 | # documents in the target directory are treated as applications and
378 | # run by the server when requested rather than as documents sent to the
379 | # client. The same rules about trailing "/" apply to ScriptAlias
380 | # directives as to Alias.
381 | #
382 | ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"
383 |
384 |
385 |
386 |
387 | #
388 | # ScriptSock: On threaded servers, designate the path to the UNIX
389 | # socket used to communicate with the CGI daemon of mod_cgid.
390 | #
391 | #Scriptsock cgisock
392 |
393 |
394 | #
395 | # "/usr/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
396 | # CGI directory exists, if you have that configured.
397 | #
398 |
399 | AllowOverride None
400 | Options None
401 | Require all granted
402 |
403 |
404 |
405 | #
406 | # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied
407 | # backend servers which have lingering "httpoxy" defects.
408 | # 'Proxy' request header is undefined by the IETF, not listed by IANA
409 | #
410 | RequestHeader unset Proxy early
411 |
412 |
413 |
414 | #
415 | # TypesConfig points to the file containing the list of mappings from
416 | # filename extension to MIME-type.
417 | #
418 | TypesConfig conf/mime.types
419 |
420 | #
421 | # AddType allows you to add to or override the MIME configuration
422 | # file specified in TypesConfig for specific file types.
423 | #
424 | #AddType application/x-gzip .tgz
425 | #
426 | # AddEncoding allows you to have certain browsers uncompress
427 | # information on the fly. Note: Not all browsers support this.
428 | #
429 | #AddEncoding x-compress .Z
430 | #AddEncoding x-gzip .gz .tgz
431 | #
432 | # If the AddEncoding directives above are commented-out, then you
433 | # probably should define those extensions to indicate media types:
434 | #
435 | AddType application/x-compress .Z
436 | AddType application/x-gzip .gz .tgz
437 |
438 | #
439 | # AddHandler allows you to map certain file extensions to "handlers":
440 | # actions unrelated to filetype. These can be either built into the server
441 | # or added with the Action directive (see below)
442 | #
443 | # To use CGI scripts outside of ScriptAliased directories:
444 | # (You will also need to add "ExecCGI" to the "Options" directive.)
445 | #
446 | #AddHandler cgi-script .cgi
447 |
448 | # For type maps (negotiated resources):
449 | #AddHandler type-map var
450 |
451 | #
452 | # Filters allow you to process content before it is sent to the client.
453 | #
454 | # To parse .shtml files for server-side includes (SSI):
455 | # (You will also need to add "Includes" to the "Options" directive.)
456 | #
457 | #AddType text/html .shtml
458 | #AddOutputFilter INCLUDES .shtml
459 |
460 |
461 | #
462 | # The mod_mime_magic module allows the server to use various hints from the
463 | # contents of the file itself to determine its type. The MIMEMagicFile
464 | # directive tells the module where the hint definitions are located.
465 | #
466 | #MIMEMagicFile conf/magic
467 |
468 | #
469 | # Customizable error responses come in three flavors:
470 | # 1) plain text 2) local redirects 3) external redirects
471 | #
472 | # Some examples:
473 | #ErrorDocument 500 "The server made a boo boo."
474 | #ErrorDocument 404 /missing.html
475 | #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
476 | #ErrorDocument 402 http://www.example.com/subscription_info.html
477 | #
478 |
479 | #
480 | # MaxRanges: Maximum number of Ranges in a request before
481 | # returning the entire resource, or one of the special
482 | # values 'default', 'none' or 'unlimited'.
483 | # Default setting is to accept 200 Ranges.
484 | #MaxRanges unlimited
485 |
486 | #
487 | # EnableMMAP and EnableSendfile: On systems that support it,
488 | # memory-mapping or the sendfile syscall may be used to deliver
489 | # files. This usually improves server performance, but must
490 | # be turned off when serving from networked-mounted
491 | # filesystems or if support for these functions is otherwise
492 | # broken on your system.
493 | # Defaults: EnableMMAP On, EnableSendfile Off
494 | #
495 | #EnableMMAP off
496 | #EnableSendfile on
497 |
498 | # Supplemental configuration
499 | #
500 | # The configuration files in the conf/extra/ directory can be
501 | # included to add extra features or to modify the default configuration of
502 | # the server, or you may simply copy their contents here and change as
503 | # necessary.
504 |
505 | # Server-pool management (MPM specific)
506 | #Include conf/extra/httpd-mpm.conf
507 |
508 | # Multi-language error messages
509 | #Include conf/extra/httpd-multilang-errordoc.conf
510 |
511 | # Fancy directory listings
512 | #Include conf/extra/httpd-autoindex.conf
513 |
514 | # Language settings
515 | #Include conf/extra/httpd-languages.conf
516 |
517 | # User home directories
518 | #Include conf/extra/httpd-userdir.conf
519 |
520 | # Real-time info on requests and configuration
521 | #Include conf/extra/httpd-info.conf
522 |
523 | # Virtual hosts
524 | #Include conf/extra/httpd-vhosts.conf
525 |
526 | # Local access to the Apache HTTP Server Manual
527 | #Include conf/extra/httpd-manual.conf
528 |
529 | # Distributed authoring and versioning (WebDAV)
530 | #Include conf/extra/httpd-dav.conf
531 |
532 | # Various default settings
533 | #Include conf/extra/httpd-default.conf
534 |
535 | # Configure mod_proxy_html to understand HTML4/XHTML1
536 |
537 | Include conf/extra/proxy-html.conf
538 |
539 |
540 | # Secure (SSL/TLS) connections
541 | #Include conf/extra/httpd-ssl.conf
542 | #
543 | # Note: The following must must be present to support
544 | # starting without SSL on platforms with no /dev/random equivalent
545 | # but a statically compiled-in mod_ssl.
546 | #
547 |
548 | SSLRandomSeed startup builtin
549 | SSLRandomSeed connect builtin
550 |
551 |
552 |
553 | Include conf/extra/proxy.conf
554 |
555 |
556 | ServerName local.alerta.io
557 |
--------------------------------------------------------------------------------