From c843194cbda6eb5b268cffc20c916f48b93c2895 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Sun, 14 Nov 2021 04:26:24 +0000 Subject: [PATCH] Support running AWX at non-root path --- roles/installer/templates/config.yaml.j2 | 9 +++++---- roles/installer/templates/deployment.yaml.j2 | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/roles/installer/templates/config.yaml.j2 b/roles/installer/templates/config.yaml.j2 index 903994d1..8490dca9 100644 --- a/roles/installer/templates/config.yaml.j2 +++ b/roles/installer/templates/config.yaml.j2 @@ -25,6 +25,7 @@ data: ADMINS = () STATIC_ROOT = '/var/lib/awx/public/static' + STATIC_URL = '{{ (ingress_path + '/static/').replace('//', '/') }}' PROJECTS_ROOT = '/var/lib/awx/projects' JOBOUTPUT_ROOT = '/var/lib/awx/job_status' @@ -172,15 +173,15 @@ data: deny all; } - location /static/ { + location {{ (ingress_path + '/static').replace('//', '/') }} { alias /var/lib/awx/public/static/; } - location /favicon.ico { + location {{ (ingress_path + '/favicon.ico').replace('//', '/') }} { alias /var/lib/awx/public/static/media/favicon.ico; } - location /websocket { + location {{ (ingress_path + '/websocket').replace('//', '/') }} { # Pass request to the upstream alias proxy_pass http://daphne; # Require http version 1.1 to allow for upgrade requests @@ -202,7 +203,7 @@ data: proxy_set_header Connection $connection_upgrade; } - location / { + location {{ ingress_path }} { # Add trailing / if missing rewrite ^(.*)$http_host(.*[^/])$ $1$http_host$2/ permanent; uwsgi_read_timeout 120s; diff --git a/roles/installer/templates/deployment.yaml.j2 b/roles/installer/templates/deployment.yaml.j2 index 20e53d07..1045079f 100644 --- a/roles/installer/templates/deployment.yaml.j2 +++ b/roles/installer/templates/deployment.yaml.j2 @@ -169,6 +169,8 @@ spec: valueFrom: fieldRef: fieldPath: metadata.namespace + - name: UWSGI_MOUNT_PATH + value: "{{ ingress_path }}" {% if development_mode | bool %} - name: AWX_KUBE_DEVEL value: "1"