Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -489,22 +489,30 @@ ipv6_disabled: false
# - hostname
host_aliases: ''

# receptor default values
receptor_log_level: info

# common default values
client_request_timeout: 30

# UWSGI default values
uwsgi_processes: 5
# NOTE: to increase this value, net.core.somaxconn must also be increased
# see https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/#setting-sysctls-for-a-pod
# Also see https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/#enabling-unsafe-sysctls for how
# to allow setting this sysctl, which requires kubelet configuration to add to allowlist
uwsgi_listen_queue_size: 128
uwsgi_timeout: "{{ (([(client_request_timeout | int), 10] | max) / 3) | int }}"
uwsgi_timeout_grace_period: 2


# NGINX default values
nginx_worker_processes: 1
nginx_worker_connections: "{{ uwsgi_listen_queue_size }}"
nginx_worker_cpu_affinity: 'auto'
nginx_listen_queue_size: "{{ uwsgi_listen_queue_size }}"
nginx_client_max_body_size: 5
nginx_read_timeout: "{{ (([(client_request_timeout | int), 10] | max) / 2) | int }}" # used in nginx config

extra_settings_files: {}

Expand Down
25 changes: 21 additions & 4 deletions roles/installer/templates/configmaps/config.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ data:
allow 127.0.0.1;
deny all;
}

location {{ (ingress_path + '/static').replace('//', '/') }} {
alias /var/lib/awx/public/static/;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ data:
location {{ ingress_path }} {
# Add trailing / if missing
rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent;
uwsgi_read_timeout 125s;
uwsgi_read_timeout {{ nginx_read_timeout }}s;
uwsgi_pass uwsgi;
include /etc/nginx/uwsgi_params;
include /etc/nginx/conf.d/*.conf;
Expand All @@ -243,6 +243,23 @@ data:
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Expires "0";
add_header Pragma "no-cache";
# Return 503 Service Unavailable with JSON response if uWSGI fails to respond
error_page 504 =503 /json_503;
error_page 502 =503 /json_503; # Optional, in case uWSGI is completely down
}

location = /json_503 {
# Custom JSON response for 503 Service Unavailable
internal;
add_header Content-Type application/json;

# Check if X-Request-ID is set and include it in the response
if ($http_x_request_id) {
return 503 '{"status": "error", "message": "Service Unavailable", "code": 503, "request_id": "$http_x_request_id"}';
}

# If X-Request-ID is not set, just return the basic JSON response
return 503 '{"status": "error", "message": "Service Unavailable", "code": 503}';
}
}
}
Expand Down Expand Up @@ -304,8 +321,8 @@ data:
max-requests = 1000
buffer-size = 32768

harakiri = 120
harakiri-graceful-timeout = 115
harakiri = {{ uwsgi_timeout }}
harakiri-graceful-timeout = {{ uwsgi_timeout_grace_period }}
harakiri-graceful-signal = 6
py-call-osafterfork = true

Expand Down
Loading