Alex Lourie has uploaded a new change for review.

Change subject: packaging: Updating apache templates with explicit values
......................................................................

packaging: Updating apache templates with explicit values

Currently we use an ovirt-engine-proxy template to redirect
root path of the apache to the jboss application (engine).

This patch brings the following changes:

* Considers the "root" of engine at /ovirt-engine path instead
of /
* Adds a list of proxy items to explicitly provide proxying.
* Adds an additional template file, ovirt-engine-root-redirect.conf.in
that if deployed, will redirect root apache path (/) to
/ovirt-engine/.
* Adds an interactive question for the user asking whether to perform
the redirection; defaulting to yes (and keeping the current state).
* Updates the final URL link shown accordingly to selected redirection
choice.

This could be used for cases where engine application is not the only
one served by the local apache server.

Change-Id: I89a47a99e28de0905183dc502cb0b35c80f77e6d
Signed-off-by: Alex Lourie <[email protected]>
---
M packaging/fedora/setup/basedefs.py
M packaging/fedora/setup/engine-setup.py
M packaging/fedora/setup/output_messages.py
M packaging/fedora/setup/ovirt-engine-proxy.conf.in
A packaging/fedora/setup/ovirt-engine-root-redirect.conf.in
5 files changed, 58 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/18/13318/1

diff --git a/packaging/fedora/setup/basedefs.py 
b/packaging/fedora/setup/basedefs.py
index 2957fb7..1459e52 100644
--- a/packaging/fedora/setup/basedefs.py
+++ b/packaging/fedora/setup/basedefs.py
@@ -101,7 +101,9 @@
 FILE_LOGCOLLECTOR_CONF="/etc/ovirt-engine/logcollector.conf"
 FILE_PSQL_CONF="/var/lib/pgsql/data/postgresql.conf"
 FILE_OVIRT_HTTPD_CONF_TEMPLATE="%s/conf/ovirt-engine-proxy.conf.in" % 
DIR_ENGINE
+FILE_OVIRT_HTTPD_CONF_ROOT_TEMPLATE="%s/conf/ovirt-engine-root-redirect.conf.in"
 % DIR_ENGINE
 FILE_OVIRT_HTTPD_CONF="/etc/httpd/conf.d/ovirt-engine.conf"
+FILE_OVIRT_HTTPD_CONF_ROOT="/etc/httpd/conf.d/ovirt-engine-root-redirect.conf"
 FILE_HTTPD_SSL_CONFIG="/etc/httpd/conf.d/ssl.conf"
 FILE_HTTPD_CONF="/etc/httpd/conf/httpd.conf"
 FILE_IMAGE_UPLOADER_CONF="/etc/ovirt-engine/imageuploader.conf"
diff --git a/packaging/fedora/setup/engine-setup.py 
b/packaging/fedora/setup/engine-setup.py
index 7373c3d..bff9004 100755
--- a/packaging/fedora/setup/engine-setup.py
+++ b/packaging/fedora/setup/engine-setup.py
@@ -246,6 +246,19 @@
                 "NEED_CONFIRM"    : False,
                 "CONDITION"       : False},
 
+            {   "CMD_OPTION"      :"override-httpd-root",
+                "USAGE"           
:output_messages.INFO_CONF_PARAMS_OVERRIDE_HTTPD_ROOT_USAGE,
+                "PROMPT"          
:output_messages.INFO_CONF_PARAMS_OVERRIDE_HTTPD_ROOT_PROMPT,
+                "OPTION_LIST"     :["yes","no"],
+                "VALIDATION_FUNC" :validate.validateOptions,
+                "DEFAULT_VALUE"   :"yes",
+                "MASK_INPUT"      : False,
+                "LOOSE_VALIDATION": False,
+                "CONF_NAME"       : "OVERRIDE_HTTPD_ROOT",
+                "USE_DEFAULT"     : True,
+                "NEED_CONFIRM"    : False,
+                "CONDITION"       : False},
+
             {   "CMD_OPTION"      :"http-port",
                 "USAGE"           
:output_messages.INFO_CONF_PARAMS_HTTP_PORT_USAGE,
                 "PROMPT"          
:output_messages.INFO_CONF_PARAMS_HTTP_PORT_PROMPT,
@@ -752,6 +765,15 @@
             '@JBOSS_AJP_PORT@': basedefs.JBOSS_AJP_PORT,
         }
     )
+
+
+    # if redirection of root required, copy a file into the conf.d folder.
+    if controller.CONF["OVERRIDE_HTTPD_ROOT"]:
+        utils.copyFile(
+            basedefs.FILE_OVIRT_HTTPD_CONF_ROOT_TEMPLATE,
+            basedefs.FILE_OVIRT_HTTPD_CONF_ROOT,
+        )
+
 
 def _configureHttpdPort():
     try:
@@ -2188,11 +2210,18 @@
         utils.lockRpmVersion(miniyum, basedefs.RPM_LOCK_LIST.split())
 
         # Print info
+        enginePath = '/ovirt-engine/'
+        if controller.CONF["OVERRIDE_HTTPD_ROOT"]:
+            enginePath = ''
         _addFinalInfoMsg()
         print output_messages.INFO_INSTALL_SUCCESS
         print output_messages.INFO_RHEVM_URL % (
-            "http://%s:%s"; % (controller.CONF["HOST_FQDN"],
-            controller.CONF["HTTP_PORT"]))
+            "http://{fqdn}:{port}{enginePath}".format(
+                fqdn=controller.CONF["HOST_FQDN"],
+                port=controller.CONF["HTTP_PORT"],
+                enginePath=enginePath,
+            )
+        )
         _printAdditionalMessages()
 
     finally:
diff --git a/packaging/fedora/setup/output_messages.py 
b/packaging/fedora/setup/output_messages.py
index e5a5ccd..97d511d 100644
--- a/packaging/fedora/setup/output_messages.py
+++ b/packaging/fedora/setup/output_messages.py
@@ -117,8 +117,10 @@
 Alternatively you can use JBoss directly (on ports higher than 1024)\n\
 Do you wish to override current httpd configuration and restart the service?" 
% basedefs.APP_NAME
 
-
-
+INFO_CONF_PARAMS_OVERRIDE_HTTPD_ROOT_USAGE = "Configure the apache root 
redirection"
+INFO_CONF_PARAMS_OVERRIDE_HTTPD_ROOT_PROMPT = "oVirt Engine is being set up at 
/ovirt-engine URL path. \
+Should the setup configure apache root path redirection, so engine could be 
also available at /?\
+This will override any other site in the server."
 INFO_CONF_PARAMS_HTTP_PORT_USAGE="Configures HTTP service port"
 INFO_CONF_PARAMS_HTTP_PORT_PROMPT="HTTP Port"
 INFO_CONF_PARAMS_HTTPS_PORT_USAGE="Configures HTTPS service port"
diff --git a/packaging/fedora/setup/ovirt-engine-proxy.conf.in 
b/packaging/fedora/setup/ovirt-engine-proxy.conf.in
index 2a7d71d..30497f2 100644
--- a/packaging/fedora/setup/ovirt-engine-proxy.conf.in
+++ b/packaging/fedora/setup/ovirt-engine-proxy.conf.in
@@ -17,12 +17,27 @@
 # finish before the web server aborts the request as the default timeout
 # (controlled by the Timeout directive in httpd.conf) is 60 seconds.
 #
-ProxyPass / ajp://localhost:@JBOSS_AJP_PORT@/ retry=5 timeout=3600
+#
+ProxyPass /ovirt-engine ajp://localhost:@JBOSS_AJP_PORT@ retry=5 timeout=3600
+ProxyPass /UserPortal ajp://localhost:@JBOSS_AJP_PORT@/UserPortal retry=5 
timeout=3600
+ProxyPass /OvirtEngineWeb ajp://localhost:@JBOSS_AJP_PORT@/OvirtEngineWeb 
retry=5 timeout=3600
+ProxyPass /Components ajp://localhost:@JBOSS_AJP_PORT@/Components retry=5 
timeout=3600
+ProxyPass /webadmin ajp://localhost:@JBOSS_AJP_PORT@/webadmin retry=5 
timeout=3600
+ProxyPass /web-conf.js ajp://localhost:@JBOSS_AJP_PORT@/web-conf.js retry=5 
timeout=3600
+ProxyPass /ca.crt ajp://localhost:@JBOSS_AJP_PORT@/ca.crt retry=5 timeout=3600
+ProxyPass /engine.ssh.key.txt 
ajp://localhost:@JBOSS_AJP_PORT@/engine.ssh.key.txt retry=5 timeout=3600
+ProxyPass /rhevm.ssh.key.txt 
ajp://localhost:@JBOSS_AJP_PORT@/rhevm.ssh.key.txt retry=5 timeout=3600
+ProxyPass /docs/* ajp://localhost:@JBOSS_AJP_PORT@/docs/* retry=5 timeout=3600
+ProxyPass /spice ajp://localhost:@JBOSS_AJP_PORT@/spice retry=5 timeout=3600
+ProxyPass /error ajp://localhost:@JBOSS_AJP_PORT@/error retry=5 timeout=3600
 
 #
 # Remove the Expect headers from API requests (this is needed to fix a
 # problem with some API clients):
 #
-<IfModule mod_headers.c>
-  RequestHeader unset Expect early
-</IfModule>
+<Location /api>
+    ProxyPass ajp://localhost:@JBOSS_AJP_PORT@/api retry=5 timeout=3600
+    <IfModule mod_headers.c>
+      RequestHeader unset Expect early
+    </IfModule>
+</Location>
diff --git a/packaging/fedora/setup/ovirt-engine-root-redirect.conf.in 
b/packaging/fedora/setup/ovirt-engine-root-redirect.conf.in
new file mode 100644
index 0000000..91d8836
--- /dev/null
+++ b/packaging/fedora/setup/ovirt-engine-root-redirect.conf.in
@@ -0,0 +1,2 @@
+# Redirecting / to /ovirt-engine
+Redirect / /ovirt-engine/


--
To view, visit http://gerrit.ovirt.org/13318
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I89a47a99e28de0905183dc502cb0b35c80f77e6d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to