Commit 5e46a229 authored by EKbfh's avatar EKbfh 🐼
Browse files

Merge branch 'ansible-add-ui-service' into 'master'

Add UI service

See merge request !5443
parents 2cedce7d 7f17d708
Pipeline #32123 passed with stages
in 95 minutes and 52 seconds
command:
{{ noc_root }}/noc ctl status |grep ui:
exit-status: 0
stdout:
- /ui:.+RUNNING/
stderr: []
timeout: 10000
---
forms:
ui:
description: >
<strong>Service type</strong>: Internal <br/>
<strong>Short description</strong>: Web 2.0 API interface<br/>
<strong>Long description</strong>: Nginx upstream to provide API for new web interface<br/>
<strong>Scale Recommendations</strong>: At least two per system. <br/>
<strong>docs</strong>: <a href=http://docs.getnoc.com/en/latest/services/ui/ target=_blank>Web</a><br/>
<strong>Placement constraint</strong>: On node with service Nginx <br/>
power:
default: 2
label: "Instances"
type: int
max: 32
min: 0
loglevel:
default: info
label: Loglevel
type: list
options:
- disabled
- debug
- info
- warning
- error
- critical
services:
ui:
level: global
category: internal
supervisord:
command: "./services/ui/service.py"
process_name: "%(program_name)s-%(process_num)02d"
oom_score_adj: 300
priority: 50
startretries: 999
stopwaitsecs: 2
stdout_logfile_maxbytes: 10MB
stdout_logfile_backups: 3
depends:
- noc
- nginx
---
- name: fail if noc is not selected
fail:
msg: "UI role have to be set with noc role to get own sources."
when:
- has_svc_ui is defined
- has_svc_noc is not defined
tags:
- checks
---
- name: "Include OS-specific tasks"
include_tasks: "os/{{ ansible_distribution }}_{{ ansible_distribution_major_version }}/main.yml"
......@@ -12,6 +12,11 @@ upstream login {
{{ else }}server 127.0.0.1:65535; # check consul for login service{{ end }}
}
upstream ui {
{{ range service "ui" }}server {{ .Address }}:{{ .Port }} weight={{ keyOrDefault (printf "noc/nginx/%s/web/weight" .Node) "1" }} max_fails=3 fail_timeout=10;
{{ else }}server 127.0.0.1:65535; # check consul for ui service{{ end }}
}
upstream card {
{{ range service "card" }}server {{ .Address }}:{{ .Port }} weight={{ keyOrDefault (printf "noc/nginx/%s/card/weight" .Node) "1" }} max_fails=3 fail_timeout=10;
{{ else }}server 127.0.0.1:65535; # check consul for card service{{ end }}
......
......@@ -127,6 +127,17 @@ server {
}
{% endif %}
{% if 'svc-ui-exec' in groups and groups['svc-ui-exec'] | length > 0 %}
location /api/ui/ {
proxy_pass http://ui;
auth_request /api/auth/auth/;
auth_request_set $user $upstream_http_remote_user;
auth_request_set $groups $upstream_http_remote_groups;
}
{% endif %}
{% if 'svc-card-exec' in groups and groups['svc-card-exec'] | length > 0 %}
# Card service api
location /api/card/ {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment