feat(monitoring): general fixup
- added healthcheck for every service
- added nginx second "server" block for monitoring
all monitoring services are now behind this nginx reverse proxy
- fixed logging driver not present for chat service
This commit is contained in:
parent
67c8a9cbd1
commit
8a3481ea8b
10 changed files with 209 additions and 48 deletions
|
|
@ -27,3 +27,9 @@ COPY ./15-local-resolvers.envsh /docker-entrypoint.d/
|
|||
COPY ./17-add-template-prefix.sh /docker-entrypoint.d/
|
||||
|
||||
COPY ./conf /etc/nginx/templates
|
||||
COPY ./monitoring.index.html /var/share/www/monitoring/
|
||||
|
||||
RUN chmod -R +r /var/share/www/monitoring/;
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=3s \
|
||||
CMD curl -f -s http://localhost:8080/ok?docker || exit 1;
|
||||
|
|
@ -1,10 +1,15 @@
|
|||
# please make sure you want to edit this file...
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# this allows the redirection of `http://domain/URL` to `https://domain/URL`
|
||||
server {
|
||||
charset UTF-8;
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
#listen [::]:80;
|
||||
resolver $NGINX_RESOLVERS;
|
||||
server_name $NGINX_DOMAIN;
|
||||
|
||||
|
|
@ -14,16 +19,18 @@ server {
|
|||
|
||||
server {
|
||||
charset UTF-8;
|
||||
listen [::]:443 ssl;
|
||||
#listen [::]:443 ssl;
|
||||
listen 443 ssl;
|
||||
resolver $NGINX_RESOLVERS;
|
||||
server_name $NGINX_DOMAIN;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||
ssl_protocols TLSv1.3;
|
||||
|
||||
ssl_protocols TLSv1.3;
|
||||
|
||||
proxy_set_header X-Forwarded true;
|
||||
error_page 497 https://$http_host$request_uri;
|
||||
error_page 497 https://$http_host$request_uri;
|
||||
include conf.d/locations/*.conf;
|
||||
}
|
||||
|
||||
include conf.d/monitoring/server.conf;
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
location /monitoring/ok {
|
||||
add_header Content-Type text/plain;
|
||||
return 200 'healthy';
|
||||
}
|
||||
39
nginx/conf/monitoring/locations.conf
Normal file
39
nginx/conf/monitoring/locations.conf
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# This is required to proxy Grafana Live WebSocket connections.
|
||||
location /kibana {
|
||||
proxy_set_header Host $host;
|
||||
set $upstream_kibana kibana:5601;
|
||||
proxy_pass http://$upstream_kibana;
|
||||
}
|
||||
|
||||
location /cadvisor {
|
||||
proxy_set_header Host $host;
|
||||
set $upstream_cadvisor cadvisor:8080;
|
||||
proxy_pass http://$upstream_cadvisor;
|
||||
}
|
||||
|
||||
location /grafana {
|
||||
proxy_set_header Host $host;
|
||||
rewrite ^/grafana/?(.*) /$1 break;
|
||||
set $upstream_grafana grafana:3000;
|
||||
proxy_pass http://$upstream_grafana;
|
||||
}
|
||||
# Proxy Grafana Live WebSocket connections.
|
||||
location /grafana/api/live/ {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
rewrite ^/grafana/?(.*) /$1 break;
|
||||
set $upstream_grafana grafana:3000;
|
||||
proxy_pass http://$upstream_grafana;
|
||||
}
|
||||
|
||||
location /ok {
|
||||
add_header Content-Type text/plain;
|
||||
return 200 'healthy';
|
||||
}
|
||||
|
||||
location / {
|
||||
root /var/share/www/monitoring/;
|
||||
index monitoring.index.html;
|
||||
}
|
||||
26
nginx/conf/monitoring/server.conf
Normal file
26
nginx/conf/monitoring/server.conf
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
server {
|
||||
charset UTF-8;
|
||||
listen 8080;
|
||||
#listen [::]:8080;
|
||||
resolver $NGINX_RESOLVERS;
|
||||
server_name $NGINX_DOMAIN;
|
||||
|
||||
include conf.d/monitoring/locations.conf;
|
||||
}
|
||||
|
||||
|
||||
server {
|
||||
charset UTF-8;
|
||||
#listen [::]:10443 ssl;
|
||||
listen 8443 ssl;
|
||||
resolver $NGINX_RESOLVERS;
|
||||
server_name $NGINX_DOMAIN;
|
||||
|
||||
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
|
||||
ssl_protocols TLSv1.3;
|
||||
|
||||
error_page 497 https://$http_host$request_uri;
|
||||
|
||||
include conf.d/monitoring/locations.conf;
|
||||
}
|
||||
64
nginx/monitoring.index.html
Normal file
64
nginx/monitoring.index.html
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Service Dashboard</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color: #f4f6f8;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 400px;
|
||||
margin: 100px auto;
|
||||
padding: 20px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 20px;
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
display: block;
|
||||
padding: 12px;
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
background-color: #e9ecef;
|
||||
border-radius: 4px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
background-color: #dfe3e6;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Services</h1>
|
||||
<ul>
|
||||
<li><a href="/kibana">Kibana</a></li>
|
||||
<li><a href="/cadvisor">cAdvisor</a></li>
|
||||
<li><a href="/grafana">Grafana</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue