Skip to content
Snippets Groups Projects
Commit fc30a10b authored by Sergey Yakubov's avatar Sergey Yakubov
Browse files

add monitoring proxy and ui to deployment

parent 45463431
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ job "asapo-nginx" {
consul_dns_port = "${consul_dns_port}"
prometheus_port = "${prometheus_port}"
alertmanager_port = "${alertmanager_port}"
monitoring_ui_port = "${monitoring_ui_port}"
}
config {
......
......@@ -14,6 +14,9 @@ job "asapo-perfmetrics" {
delay = "15s"
mode = "delay"
}
network {
port "monitoring_server" {}
}
task "influxdb" {
driver = "docker"
......@@ -64,8 +67,6 @@ job "asapo-perfmetrics" {
} #influxdb
task "grafana" {
driver = "docker"
user = "${asapo_user}"
......@@ -140,9 +141,6 @@ job "asapo-perfmetrics" {
resources {
memory = "${monitoring_server_total_memory_size}"
network {
port "monitoring_server" {}
}
}
service {
......@@ -165,6 +163,101 @@ job "asapo-perfmetrics" {
}
} # monitoring server
task "monitoring-proxy" {
driver = "docker"
user = "${asapo_user}"
config {
ulimit {
memlock = "-1:-1"
}
network_mode = "host"
security_opt = ["no-new-privileges"]
userns_mode = "host"
privileged = true
image = "envoyproxy/envoy:v1.21.0"
volumes = ["local/envoy.yaml:/etc/envoy/envoy.yaml"]
command = "/usr/local/bin/envoy"
args=["-c","/etc/envoy/envoy.yaml","-l","trace"]
}
resources {
memory = "${monitoring_proxy_total_memory_size}"
network {
port "monitoring_proxy_admin" {}
port "monitoring_proxy" {
static = "${monitoring_proxy_port}"
}
}
}
service {
name = "asapo-monitoring-proxy"
port = "monitoring_proxy"
check {
name = "asapo-monitoring-proxy-alive"
port = "monitoring_proxy_admin"
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
initial_status = "passing"
}
}
template {
source = "${scripts_dir}/monitoring_proxy.yaml.tpl"
destination = "local/envoy.yaml"
change_mode = "restart"
}
} # monitoring proxy
task "monitoring-ui" {
driver = "docker"
user = "${asapo_user}"
config {
ulimit {
memlock = "-1:-1"
}
network_mode = "host"
security_opt = ["no-new-privileges"]
userns_mode = "host"
privileged = true
image = "${docker_repository}/asapo-monitoring-ui${image_suffix}"
force_pull = ${force_pull_images}
volumes = ["local/nginx.conf:/etc/nginx/nginx.conf"]
}
resources {
memory = "${monitoring_ui_total_memory_size}"
network {
port "monitoring_ui" {
static = "${monitoring_ui_port}"
}
}
}
service {
name = "asapo-monitoring-ui"
port = "monitoring_ui"
check {
name = "asapo-monitoring-ui-alive"
port = "monitoring_ui"
type = "http"
path = "/"
interval = "10s"
timeout = "2s"
initial_status = "passing"
}
}
template {
source = "${scripts_dir}/monitoring_ui_nginx.conf.tpl"
destination = "local/nginx.conf"
change_mode = "restart"
}
} # monitoring ui
}
......
......@@ -43,6 +43,8 @@ discovery_total_memory_size = 256
prometheus_total_memory_size = 256
alertmanager_total_memory_size = 256
monitoring_server_total_memory_size = 256
monitoring_proxy_total_memory_size = 256
monitoring_ui_total_memory_size = 256
ldap_uri = "ldap://localhost:389"
......@@ -57,6 +59,8 @@ kibana_port = 5601
discovery_port = 5006
authorizer_port = 5007
monitoring_proxy_port = 5008
monitoring_ui_port = 5009
consul_dns_port = 8600
prometheus_port = 9090
......
admin:
access_log_path: /tmp/admin_access.log
address:
socket_address: { address: 0.0.0.0, port_value: {{ env "NOMAD_PORT_monitoring_proxy_admin" }} }
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: {{ env "NOMAD_PORT_monitoring_proxy" }} }
filter_chains:
- filters:
- name: envoy.filters.network.http_connection_manager
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
codec_type: auto
stat_prefix: ingress_http
route_config:
name: local_route
virtual_hosts:
- name: local_service
domains: ["*"]
routes:
- match: { prefix: "/" }
route:
cluster: echo_service
timeout: 0s
max_stream_duration:
grpc_timeout_header_max: 0s
cors:
allow_origin_string_match:
- prefix: "*"
allow_methods: GET, PUT, DELETE, POST, OPTIONS
allow_headers: keep-alive,user-agent,cache-control,content-type,content-transfer-encoding,custom-header-1,x-accept-content-transfer-encoding,x-accept-response-streaming,x-user-agent,x-grpc-web,grpc-timeout
max_age: "1728000"
expose_headers: custom-header-1,grpc-status,grpc-message
http_filters:
- name: envoy.filters.http.grpc_web
- name: envoy.filters.http.cors
- name: envoy.filters.http.router
clusters:
- name: echo_service
connect_timeout: 0.25s
type: logical_dns
http2_protocol_options: {}
lb_policy: round_robin
load_assignment:
cluster_name: cluster_0
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: 127.0.0.1
port_value: {{ env "NOMAD_PORT_monitoring_server" }}
worker_processes 1;
events {
worker_connections 1024;
}
error_log "/tmp/nginx_error.log";
pid "/tmp/nginx.pid";
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_body_temp_path "/tmp/client_body" 1 2;
client_max_body_size 10M;
proxy_temp_path "/tmp/proxy" 1 2;
fastcgi_temp_path "/tmp/fastcgi" 1 2;
scgi_temp_path "/tmp/scgi" 1 2;
uwsgi_temp_path "/tmp/uwsgi" 1 2;
server {
listen {{ env "NOMAD_PORT_monitoring_ui" }} default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
#include /etc/nginx/default.d/*.conf;
index index.html;
etag on;
location /js/ {
add_header Cache-Control max-age=31536000;
}
location / {
try_files $uri $uri/ /index.html;
}
location /index.html {
add_header Cache-Control no-cache;
}
}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ http {
listen {{ env "NOMAD_PORT_nginx" }};
set $discovery_endpoint asapo-discovery.service.asapo;
set $authorizer_endpoint asapo-authorizer.service.asapo;
set $monitoring_ui_endpoint asapo-monitoring-ui.service.asapo;
set $fluentd_endpoint fluentd.service.asapo;
set $kibana_endpoint kibana.service.asapo;
set $grafana_endpoint grafana.service.asapo;
......@@ -79,6 +80,11 @@ http {
proxy_pass http://$grafana_endpoint:{{ env "NOMAD_META_grafana_port" }}$uri$is_args$args;
}
location /tv/ {
rewrite ^/tv(/.*) $1 break;
proxy_pass http://$monitoring_ui_endpoint:{{ env "NOMAD_META_monitoring_ui_port" }}$uri$is_args$args;
}
location /asapo-authorizer/ {
rewrite ^/asapo-authorizer(/.*) $1 break;
proxy_pass http://$authorizer_endpoint:{{ env "NOMAD_META_authorizer_port" }}$uri$is_args$args;
......
......@@ -71,9 +71,22 @@ resource "null_resource" "asapo-monitoring-server" {
provisioner "local-exec" {
command = "asapo-wait-service asapo-monitoring"
}
depends_on = [nomad_job.asapo-monitoring]
depends_on = [nomad_job.asapo-perfmetrics]
}
resource "null_resource" "asapo-monitoring-proxy" {
provisioner "local-exec" {
command = "asapo-wait-service asapo-monitoring-proxy"
}
depends_on = [nomad_job.asapo-perfmetrics]
}
resource "null_resource" "asapo-monitoring-ui" {
provisioner "local-exec" {
command = "asapo-wait-service asapo-monitoring-ui"
}
depends_on = [nomad_job.asapo-perfmetrics]
}
resource "null_resource" "asapo-fts" {
provisioner "local-exec" {
......
......@@ -16,6 +16,7 @@ data "template_file" "nginx" {
consul_dns_port = "${var.consul_dns_port}"
prometheus_port = "${var.prometheus_port}"
alertmanager_port = "${var.alertmanager_port}"
monitoring_ui_port = "${var.monitoring_ui_port}"
}
}
......@@ -108,6 +109,10 @@ data "template_file" "asapo_perfmetrics" {
influxdb_rpc_port = "${var.influxdb_rpc_port}"
perf_monitor = "${var.perf_monitor}"
monitoring_server_total_memory_size = "${var.monitoring_server_total_memory_size}"
monitoring_proxy_total_memory_size = "${var.monitoring_proxy_total_memory_size}"
monitoring_ui_total_memory_size = "${var.monitoring_ui_total_memory_size}"
monitoring_proxy_port = "${var.monitoring_proxy_port}"
monitoring_ui_port = "${var.monitoring_ui_port}"
force_pull_images = "${var.force_pull_images}"
nomad_logs = "${var.nomad_logs}"
scripts_dir = "${var.job_scripts_dir}"
......
......@@ -86,6 +86,10 @@ variable "alertmanager_total_memory_size" {}
variable "monitoring_server_total_memory_size" {}
variable "monitoring_proxy_total_memory_size" {}
variable "monitoring_ui_total_memory_size" {}
variable "grafana_port" {}
variable "influxdb_port" {}
......@@ -112,6 +116,10 @@ variable "authorizer_port" {}
variable "consul_dns_port" {}
variable "monitoring_proxy_port" {}
variable "monitoring_ui_port" {}
variable "n_receivers" {}
variable "n_brokers" {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment