mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Add server names hash tuning options to nginx configuration
This commit is contained in:
@@ -111,6 +111,14 @@ spec:
|
||||
value: {{ $.Values.nginx.listenAddress | quote }}
|
||||
- name: NGINX_LISTEN_OPTIONS
|
||||
value: {{ $.Values.nginx.listenOptions | quote }}
|
||||
{{- if $.Values.nginx.serverNamesHash.bucketSize }}
|
||||
- name: SERVER_NAMES_HASH_BUCKET_SIZE
|
||||
value: {{ $.Values.nginx.serverNamesHash.bucketSize | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.nginx.serverNamesHash.maxSize }}
|
||||
- name: SERVER_NAMES_HASH_MAX_SIZE
|
||||
value: {{ $.Values.nginx.serverNamesHash.maxSize | quote }}
|
||||
{{- end }}
|
||||
- name: ONEUPTIME_HTTP_PORT
|
||||
value: {{ $.Values.nginx.ports.http | quote }}
|
||||
- name: PORT
|
||||
|
||||
@@ -43,6 +43,9 @@ nginx:
|
||||
disableAutoscaler: false
|
||||
listenAddress: ""
|
||||
listenOptions: ""
|
||||
serverNamesHash:
|
||||
bucketSize: ""
|
||||
maxSize: ""
|
||||
ports:
|
||||
http: 80
|
||||
https: 443
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
## Hash tuning for many/long server names. Can be overridden via env vars.
|
||||
## Defaults are provided by envsubst-on-templates.sh if not set.
|
||||
server_names_hash_bucket_size ${SERVER_NAMES_HASH_BUCKET_SIZE};
|
||||
server_names_hash_max_size ${SERVER_NAMES_HASH_MAX_SIZE};
|
||||
|
||||
upstream accounts {
|
||||
server ${SERVER_ACCOUNTS_HOSTNAME}:${ACCOUNTS_PORT} weight=10 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
@@ -25,8 +25,22 @@ auto_envsubst() {
|
||||
subdir=$(dirname "$relative_path")
|
||||
# create a subdirectory where the template file exists
|
||||
mkdir -p "$output_dir/$subdir"
|
||||
|
||||
# Make a temp copy to allow conditional line removal
|
||||
tmpfile=$(mktemp)
|
||||
cp "$template" "$tmpfile"
|
||||
|
||||
# If hash tuning envs are not set, remove their lines from the template
|
||||
if [ -z "${SERVER_NAMES_HASH_BUCKET_SIZE}" ]; then
|
||||
sed -i '/^[[:space:]]*server_names_hash_bucket_size[[:space:]]/d' "$tmpfile"
|
||||
fi
|
||||
if [ -z "${SERVER_NAMES_HASH_MAX_SIZE}" ]; then
|
||||
sed -i '/^[[:space:]]*server_names_hash_max_size[[:space:]]/d' "$tmpfile"
|
||||
fi
|
||||
|
||||
echo "$ME: Running envsubst on $template to $output_path"
|
||||
envsubst "$defined_envs" < "$template" > "$output_path"
|
||||
envsubst "$defined_envs" < "$tmpfile" > "$output_path"
|
||||
rm -f "$tmpfile"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user