From 6c2ae8dec0822f9060836c8d2ca18caa0a802e8e Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Sat, 30 Dec 2023 12:12:24 +0000 Subject: [PATCH] Update OTEL_COLLECTOR_HOSTNAME variable name --- .../Public/oneuptime/templates/_helpers.tpl | 2 +- Nginx/default.conf.template | 42 ++++++++++++++++++- config.example.env | 5 ++- docker-compose.base.yml | 2 +- 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/HelmChart/Public/oneuptime/templates/_helpers.tpl b/HelmChart/Public/oneuptime/templates/_helpers.tpl index 25fb1a84f4..f48f11f79c 100644 --- a/HelmChart/Public/oneuptime/templates/_helpers.tpl +++ b/HelmChart/Public/oneuptime/templates/_helpers.tpl @@ -31,7 +31,7 @@ value: {{ $.Release.Name }}-ingestor.{{ $.Release.Namespace }}.svc.{{ $.Values.global.clusterDomain }} - name: SERVER_TEST_SERVER_HOSTNAME value: {{ $.Release.Name }}-test-server.{{ $.Release.Namespace }}.svc.{{ $.Values.global.clusterDomain }} -- name: OTEL_COLLECTOR_HOSTNAME +- name: SERVER_OTEL_COLLECTOR_HOSTNAME value: {{ $.Release.Name }}-otel-collector.{{ $.Release.Namespace }}.svc.{{ $.Values.global.clusterDomain }} - name: SERVER_WORKERS_HOSTNAME value: {{ $.Release.Name }}-workers.{{ $.Release.Namespace }}.svc.{{ $.Values.global.clusterDomain }} diff --git a/Nginx/default.conf.template b/Nginx/default.conf.template index b724cf32c8..590a31e463 100644 --- a/Nginx/default.conf.template +++ b/Nginx/default.conf.template @@ -33,9 +33,47 @@ upstream workers { upstream otel-collector { - server ${OTEL_COLLECTOR_HOSTNAME}:${OTEL_COLLECTOR_PORT} weight=10 max_fails=3 fail_timeout=30s; + server ${SERVER_OTEL_COLLECTOR_HOSTNAME}:${OTEL_COLLECTOR_PORT} weight=10 max_fails=3 fail_timeout=30s; } +# Otel Collector + +server { + + gzip on; + gzip_types text/plain application/xml text/html application/javascript text/javascript text/css application/json; + gzip_proxied no-cache no-store private expired auth; + gzip_min_length 1000; + + listen 80 default_server; + + server_name oneuptime-otel-collector ${OTEL_COLLECTOR_HOST}; + + proxy_busy_buffers_size 512k; + proxy_buffers 4 512k; + proxy_buffer_size 256k; + + fastcgi_buffers 16 16k; + fastcgi_buffer_size 32k; + + location / { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + proxy_pass http://otel-collector; + } + +} + +# Status Pages + server { gzip on; @@ -122,6 +160,8 @@ server { } +# + server { gzip on; diff --git a/config.example.env b/config.example.env index f26b120ff1..03f9770dba 100644 --- a/config.example.env +++ b/config.example.env @@ -16,6 +16,9 @@ GLOBAL_PROBE_1_KEY=please-change-this-to-random-value GLOBAL_PROBE_2_KEY=please-change-this-to-random-value INTERNAL_SMTP_PASSWORD=please-change-this-to-random-value +# OTEL HOST - if you like the collector to be hosted on a different server then change this to the IP of the server. +OTEL_COLLECTOR_HOST= + # OneUptime Port. This is the port where OneUptime will be hosted on. ONEUPTIME_HTTP_PORT=80 ONEUPTIME_HTTPS_PORT=443 @@ -85,7 +88,7 @@ SERVER_WORKERS_HOSTNAME=workers SERVER_STATUS_PAGE_HOSTNAME=status-page SERVER_DASHBOARD_HOSTNAME=dashboard SERVER_ADMIN_DASHBOARD_HOSTNAME=admin-dashboard -OTEL_COLLECTOR_HOSTNAME=otel-collector +SERVER_OTEL_COLLECTOR_HOSTNAME=otel-collector #Ports. Usually they don't need to change. diff --git a/docker-compose.base.yml b/docker-compose.base.yml index 5b22fe0c81..2033284301 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -26,7 +26,7 @@ x-common-variables: &common-variables SERVER_STATUS_PAGE_HOSTNAME: status-page SERVER_DASHBOARD_HOSTNAME: dashboard SERVER_ADMIN_DASHBOARD_HOSTNAME: admin-dashboard - OTEL_COLLECTOR_HOSTNAME: otel-collector + SERVER_OTEL_COLLECTOR_HOSTNAME: otel-collector #Ports. Usually they don't need to change.