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

Merge pull request #72 in ASAPO/asapo from deployment to develop

* commit '6b21ee4a':
  update python test for consumer api
  update deployment scripts for orc template
parents f9426be8 6b21ee4a
Branches
Tags
No related merge requests found
job_scripts_dir = "/var/run/asapo"
consul_dns_port = 8600
grafana_total_memory_size = "256"
grafana_port = 3000
grafana_version="latest"
nginx_total_memory_size = 256
......@@ -12,11 +9,9 @@ nginx_port_stream = 8402
nginx_version = "1.14"
influxdb_total_memory_size = "256"
influxdb_port = 8086
influxdb_version = "latest"
telegraf_total_memory_size = "256"
telegraf_port_stream = 8125
telegraf_version = "latest"
monitoring = true
......@@ -39,13 +39,16 @@ job "monitoring" {
env {
PRE_CREATE_DB="asapo_receivers;asapo_brokers"
INFLUXDB_BIND_ADDRESS="127.0.0.1:$${NOMAD_PORT_influxdb_rpc}"
INFLUXDB_HTTP_BIND_ADDRESS=":$${NOMAD_PORT_influxdb}"
}
resources {
memory = "${influxdb_total_memory_size}"
network {
port "influxdb" {
static = "${influxdb_port}"
}
port "influxdb_rpc" {
}
}
}
......@@ -94,7 +97,6 @@ job "monitoring" {
memory = "${grafana_total_memory_size}"
network {
port "grafana" {
static = "${grafana_port}"
}
}
}
......@@ -156,7 +158,6 @@ job "monitoring" {
memory = "${telegraf_total_memory_size}"
network {
port "telegraf_stream" {
static = "${telegraf_port_stream}"
}
}
}
......@@ -167,16 +168,16 @@ job "monitoring" {
check {
name = "telegraf-alive"
type = "script"
command = "/bin/ps"
args = ["-fC","telegraf"]
command = "/bin/pidof"
args = ["telegraf"]
interval = "10s"
timeout = "2s"
}
check_restart {
limit = 2
grace = "15s"
ignore_warnings = false
}
# check_restart {
# limit = 2
# grace = "15s"
# ignore_warnings = false
# }
}
template {
......
......@@ -7,57 +7,69 @@ events {
error_log "/dev/stdout";
pid "/tmp/nginx.pid";
http {
# include mime.types;
# default_type application/octet-stream;
# sendfile on;
# tcp_nopush on;
# keepalive_timeout 0;
# keepalive_timeout 65;
access_log off;
{{ $grafana := false -}}
{{ $influxdb := false -}}
{{ $telegraf := false -}}
{{ range service "grafana" -}} {{ $grafana = true }}{{ end -}}
{{ range service "influxdb" -}} {{ $influxdb = true }}{{ end -}}
{{ range service "telegraf" -}} {{ $telegraf = true }}{{ end -}}
http {
access_log off;
client_body_temp_path "/tmp/client_body" 1 2;
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;
{{ if $grafana }}
upstream grafana {
{{- range service "grafana" }}
server {{ .Address }}:{{ .Port }};
{{ end -}}
}
{{ end -}}
{{- if $influxdb}}
upstream influxdb {
{{- range service "influxdb" }}
server {{ .Address }}:{{ .Port }};
{{ end -}}
}
{{- end }}
resolver 127.0.0.1:{{ env "NOMAD_META_consul_dns_port" }} valid=1s;
server {
listen {{ env "NOMAD_PORT_nginx" }} reuseport;
set $grafana_endpoint grafana.service.asapo;
set $influxdb_endpoint influxdb.service.asapo;
location /influxdb/ {
{{- if $influxdb }}
location /influxdb/ {
rewrite ^/influxdb(/.*) $1 break;
proxy_pass http://$influxdb_endpoint:{{ env "NOMAD_META_influxdb_port" }}$uri$is_args$args;
proxy_pass http://influxdb$uri$is_args$args;
}
{{ end -}}
{{- if $grafana }}
location /monitoring/ {
rewrite ^/monitoring(/.*) $1 break;
proxy_pass http://$grafana_endpoint:{{ env "NOMAD_META_grafana_port" }}$uri$is_args$args;
proxy_pass http://grafana$uri$is_args$args;
}
{{- end }}
location /nginx-health {
return 200 "healthy\n";
}
}
}
}
{{ if $telegraf -}}
stream {
resolver 127.0.0.1:{{ env "NOMAD_META_consul_dns_port" }} valid=1s;
map $remote_addr $upstream {
default telegraf.service.asapo;
upstream telegraf {
{{- range service "telegraf" }}
server {{ .Address }}:{{ .Port }};
{{- end }}
}
server {
listen {{ env "NOMAD_PORT_nginx_stream" }} udp;
proxy_pass $upstream:{{ env "NOMAD_META_telegraf_port_stream" }};
proxy_pass telegraf;
}
}
{{ end -}}
......@@ -18,20 +18,13 @@ job "asapo-nginx" {
user = "${asapo_user}"
meta {
telegraf_port_stream = "${telegraf_port_stream}"
grafana_port = "${grafana_port}"
influxdb_port = "${influxdb_port}"
consul_dns_port = "${consul_dns_port}"
}
config {
network_mode = "host"
security_opt = ["no-new-privileges"]
userns_mode = "host"
image = "nginx:${nginx_version}"
volumes = [
"local/nginx.conf:/etc/nginx/nginx.conf"
"local:/etc/nginx"
]
}
......@@ -70,7 +63,8 @@ job "asapo-nginx" {
template {
source = "${scripts_dir}/nginx.conf.tpl"
destination = "local/nginx.conf"
change_mode = "restart"
change_mode = "signal"
change_signal = "SIGHUP"
}
}
}
......
......@@ -5,16 +5,12 @@ data "template_file" "monitoring_template" {
service_dir = "${var.service_dir}"
grafana_version = "${var.grafana_version}"
grafana_total_memory_size = "${var.grafana_total_memory_size}"
grafana_port = "${var.grafana_port}"
grafana_version = "${var.grafana_version}"
grafana_total_memory_size = "${var.grafana_total_memory_size}"
grafana_port = "${var.grafana_port}"
influxdb_version = "${var.influxdb_version}"
influxdb_total_memory_size = "${var.influxdb_total_memory_size}"
influxdb_port = "${var.influxdb_port}"
telegraf_version = "${var.telegraf_version}"
telegraf_total_memory_size = "${var.telegraf_total_memory_size}"
telegraf_port_stream = "${var.telegraf_port_stream}"
nginx_port = "${var.nginx_port}"
asapo_user = "${var.asapo_user}"
scripts_dir = "${var.job_scripts_dir}"
......@@ -29,11 +25,7 @@ data "template_file" "nginx_template" {
nginx_version = "${var.nginx_version}"
nginx_port = "${var.nginx_port}"
nginx_port_stream = "${var.nginx_port_stream}"
telegraf_port_stream = "${var.telegraf_port_stream}"
grafana_port = "${var.grafana_port}"
influxdb_port = "${var.influxdb_port}"
asapo_user = "${var.asapo_user}"
consul_dns_port = "${var.consul_dns_port}"
}
}
......@@ -12,17 +12,12 @@ variable "service_dir" {}
variable "data_dir" {}
variable "grafana_total_memory_size" {}
variable "grafana_port" {}
variable "telegraf_port_stream" {}
variable "telegraf_total_memory_size" {}
variable "influxdb_total_memory_size" {}
variable "influxdb_port" {}
variable "nginx_total_memory_size" {}
variable "nginx_port" {}
variable "nginx_port_stream" {}
variable "consul_dns_port" {}
......@@ -136,14 +136,14 @@ def check_single(broker,group_id_new):
else:
exit_on_noerr("wrong query")
broker = asapo_consumer.create_server_broker("bla",path, beamtime,"",token,60000)
try:
broker.get_last(group_id_new, meta_only=True)
except asapo_consumer.AsapoUnavailableServiceError as err:
print(err)
pass
else:
exit_on_noerr("AsapoBrokerServersNotFound")
# broker = asapo_consumer.create_server_broker("bla",path, beamtime,"",token,60000)
# try:
# broker.get_last(group_id_new, meta_only=True)
# except asapo_consumer.AsapoUnavailableServiceError as err:
# print(err)
# pass
# else:
# exit_on_noerr("AsapoBrokerServersNotFound")
......@@ -201,3 +201,5 @@ if mode == "single":
if mode == "datasets":
check_dataset(broker,group_id_new)
print ("tests done")
sys.exit(0)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment