Skip to content
Snippets Groups Projects
Commit ddbbe15f authored by jurgenhaas's avatar jurgenhaas
Browse files

#1 Finalize first version of alerta installation

parent 1e840f64
Branches
No related tags found
No related merge requests found
- name: "Restart uwsgi"
service:
name: 'uwsgi'
state: 'restarted'
......@@ -2,3 +2,4 @@
dependencies:
- { role: mongodb }
- { role: nginx }
---
# file: roles/alerta/tasks/alerta.yml
$ pip install alerta-server
$ alertad run --port 8080
- name: "Ensure packages"
apt:
pkg: '{{ item }}'
state: 'present'
with_items:
- 'python-pip'
- 'python-dev'
$ wget -O alerta-web.tgz https://github.com/alerta/angular-alerta-webui/tarball/master
$ tar zxvf alerta-web.tgz
$ cd alerta-angular-alerta-webui-*/app
$ python -m SimpleHTTPServer 8000
- name: "Ensure PIP packages"
pip:
name: '{{ item }}'
state: 'present'
with_items:
- 'alerta-server'
- 'alerta'
- 'uwsgi'
>> browse to http://localhost:8000
- name: "Download and extract web UI"
unarchive:
src: 'https://github.com/alerta/angular-alerta-webui/tarball/master'
dest: '/tmp/alerta-master'
remote_src: yes
- name: "Remove directory for web UI"
file:
path: '/var/www/alerta'
state: 'absent'
- name: "Move new web UI"
command: 'mv /tmp/alerta-master/app /var/www/alerta'
- name: "Copy wsgi.py"
template:
src: 'wsgi.py'
dest: '/var/www/alerta/wsgi.py'
- name: "Copy uwsgi.ini"
template:
src: 'uwsgi.ini'
dest: '/etc/uwsgi.ini'
- name: "Copy uwsgi.service"
template:
src: 'uwsgi.service'
dest: '/etc/systemd/system/uwsgi.service'
- name: "Prepare uwsgi for autostart"
systemd:
name: 'uwsgi'
state: 'restarted'
enabled: yes
daemon_reload: yes
- name: "Copy nginx default config"
template:
src: 'nginx.default'
dest: '/etc/nginx/sites-enabled/default'
notify:
- "Restart nginx"
- name: "Copy config.js"
template:
src: 'config.js'
dest: '/var/www/alerta/config.js'
- name: "Copy alertad.conf"
template:
src: 'alertad.conf'
dest: '/etc/alertad.conf'
notify:
- "Restart uwsgi"
BASE_URL='/api'
AUTH_REQUIRED=True
SECRET_KEY='{{ alerta_secret_key }}'
ADMIN_USERS=['{{ alerta_admins|join("','") }}']
CUSTOMER_VIEWS=True
# Plugins
PLUGINS = ['reject']
ORIGIN_BLACKLIST = []
ALLOWED_ENVIRONMENTS = ['{{ alerts_environments|join("','") }}']
'use strict';
angular.module('config', [])
.constant('config', {
'endpoint' : "/api",
'provider' : "basic",
'colors' : {},
'severity' : {},
'audio' : {}
});
server {
listen 80 default_server;
listen [::]:80 default_server;
location /api { try_files $uri @api; }
location @api {
include uwsgi_params;
uwsgi_pass unix:/tmp/uwsgi.sock;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location / {
root /var/www/alerta;
}
}
[uwsgi]
chdir = /var/www/alerta
mount = /api=wsgi.py
callable = app
manage-script-name = true
master = true
processes = 5
logger = syslog:alertad
socket = /tmp/uwsgi.sock
chmod-socket = 664
uid = www-data
gid = www-data
vacuum = true
die-on-term = true
[Unit]
Description=uWSGI service
[Service]
ExecStart=/usr/local/bin/uwsgi --ini /etc/uwsgi.ini
[Install]
WantedBy=multi-user.target
from alerta import app
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment