summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Lennox <jlennox@redhat.com>2013-09-17 12:07:48 +1000
committerJamie Lennox <jamielennox@redhat.com>2013-09-24 10:48:01 +1000
commit5470701e10ee68c80860d4cf7e0fa5d8a913c288 (patch)
tree93194851ace00b4dcab8018c42e877f602134187
parentd24674ed22687159ced65613c714a075d9804279 (diff)
Fix swift httpd on fedora
Implements a fedora equivalent of ubuntu's sites-enabled and moves enabling of mod_wsgi to the installation period so that it doesn't have to be handled in a platform dependant way later. Fixes: bug 1226363 Change-Id: I85325179f1792d985b0375572abfe8c8a82fecc3
Notes
Notes (review): Verified+2: Jenkins Approved+1: Dean Troyer <dtroyer@gmail.com> Code-Review+2: Dean Troyer <dtroyer@gmail.com> Code-Review+1: ayoung <ayoung@redhat.com> Code-Review+2: Sean Dague <sean@dague.net> Submitted-by: Jenkins Submitted-at: Tue, 24 Sep 2013 21:59:05 +0000 Reviewed-on: https://review.openstack.org/46865 Project: openstack-dev/devstack Branch: refs/heads/master
-rw-r--r--lib/apache27
-rw-r--r--lib/horizon5
-rw-r--r--lib/swift16
3 files changed, 33 insertions, 15 deletions
diff --git a/lib/apache b/lib/apache
index d811f87..3a1f6f1 100644
--- a/lib/apache
+++ b/lib/apache
@@ -6,6 +6,8 @@
6# is_apache_enabled_service 6# is_apache_enabled_service
7# install_apache_wsgi 7# install_apache_wsgi
8# config_apache_wsgi 8# config_apache_wsgi
9# enable_apache_site
10# disable_apache_site
9# start_apache_server 11# start_apache_server
10# stop_apache_server 12# stop_apache_server
11# restart_apache_server 13# restart_apache_server
@@ -57,16 +59,41 @@ function install_apache_wsgi() {
57 if is_ubuntu; then 59 if is_ubuntu; then
58 # Install apache2, which is NOPRIME'd 60 # Install apache2, which is NOPRIME'd
59 install_package apache2 libapache2-mod-wsgi 61 install_package apache2 libapache2-mod-wsgi
62 # WSGI isn't enabled by default, enable it
63 sudo a2enmod wsgi
60 elif is_fedora; then 64 elif is_fedora; then
61 sudo rm -f /etc/httpd/conf.d/000-* 65 sudo rm -f /etc/httpd/conf.d/000-*
62 install_package httpd mod_wsgi 66 install_package httpd mod_wsgi
63 elif is_suse; then 67 elif is_suse; then
64 install_package apache2 apache2-mod_wsgi 68 install_package apache2 apache2-mod_wsgi
69 # WSGI isn't enabled by default, enable it
70 sudo a2enmod wsgi
65 else 71 else
66 exit_distro_not_supported "apache installation" 72 exit_distro_not_supported "apache installation"
67 fi 73 fi
68} 74}
69 75
76# enable_apache_site() - Enable a particular apache site
77function enable_apache_site() {
78 local site=$@
79 if is_ubuntu; then
80 sudo a2ensite ${site}
81 elif is_fedora; then
82 # fedora conf.d is only imported if it ends with .conf so this is approx the same
83 sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site} /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf
84 fi
85}
86
87# disable_apache_site() - Disable a particular apache site
88function disable_apache_site() {
89 local site=$@
90 if is_ubuntu; then
91 sudo a2dissite ${site}
92 elif is_fedora; then
93 sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}
94 fi
95}
96
70# start_apache_server() - Start running apache server 97# start_apache_server() - Start running apache server
71function start_apache_server() { 98function start_apache_server() {
72 start_service $APACHE_NAME 99 start_service $APACHE_NAME
diff --git a/lib/horizon b/lib/horizon
index e55bc15..5973eb2 100644
--- a/lib/horizon
+++ b/lib/horizon
@@ -123,8 +123,6 @@ function init_horizon() {
123 # Be a good citizen and use the distro tools here 123 # Be a good citizen and use the distro tools here
124 sudo touch $horizon_conf 124 sudo touch $horizon_conf
125 sudo a2ensite horizon.conf 125 sudo a2ensite horizon.conf
126 # WSGI isn't enabled by default, enable it
127 sudo a2enmod wsgi
128 elif is_fedora; then 126 elif is_fedora; then
129 if [[ "$os_RELEASE" -ge "18" ]]; then 127 if [[ "$os_RELEASE" -ge "18" ]]; then
130 # fedora 18 has Require all denied in its httpd.conf 128 # fedora 18 has Require all denied in its httpd.conf
@@ -132,9 +130,6 @@ function init_horizon() {
132 HORIZON_REQUIRE='Require all granted' 130 HORIZON_REQUIRE='Require all granted'
133 fi 131 fi
134 sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf 132 sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
135 elif is_suse; then
136 # WSGI isn't enabled by default, enable it
137 sudo a2enmod wsgi
138 else 133 else
139 exit_distro_not_supported "apache configuration" 134 exit_distro_not_supported "apache configuration"
140 fi 135 fi
diff --git a/lib/swift b/lib/swift
index 8741e55..9c80802 100644
--- a/lib/swift
+++ b/lib/swift
@@ -115,11 +115,11 @@ function cleanup_swift() {
115# _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file 115# _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
116function _cleanup_swift_apache_wsgi() { 116function _cleanup_swift_apache_wsgi() {
117 sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi 117 sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi
118 ! is_fedora && sudo a2dissite proxy-server 118 disable_apache_site proxy-server
119 for node_number in ${SWIFT_REPLICAS_SEQ}; do 119 for node_number in ${SWIFT_REPLICAS_SEQ}; do
120 for type in object container account; do 120 for type in object container account; do
121 site_name=${type}-server-${node_number} 121 site_name=${type}-server-${node_number}
122 ! is_fedora && sudo a2dissite ${site_name} 122 disable_apache_site ${site_name}
123 sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site_name} 123 sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site_name}
124 done 124 done
125 done 125 done
@@ -140,13 +140,13 @@ function _config_swift_apache_wsgi() {
140 s/%APACHE_NAME%/${APACHE_NAME}/g; 140 s/%APACHE_NAME%/${APACHE_NAME}/g;
141 s/%USER%/${STACK_USER}/g; 141 s/%USER%/${STACK_USER}/g;
142 " -i ${apache_vhost_dir}/proxy-server 142 " -i ${apache_vhost_dir}/proxy-server
143 enable_apache_site proxy-server
143 144
144 sudo cp ${SWIFT_DIR}/examples/wsgi/proxy-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi 145 sudo cp ${SWIFT_DIR}/examples/wsgi/proxy-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
145 sudo sed -e " 146 sudo sed -e "
146 /^#/d;/^$/d; 147 /^#/d;/^$/d;
147 s/%SERVICECONF%/proxy-server.conf/g; 148 s/%SERVICECONF%/proxy-server.conf/g;
148 " -i ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi 149 " -i ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
149 ! is_fedora && sudo a2ensite proxy-server
150 150
151 # copy apache vhost file and set name and port 151 # copy apache vhost file and set name and port
152 for node_number in ${SWIFT_REPLICAS_SEQ}; do 152 for node_number in ${SWIFT_REPLICAS_SEQ}; do
@@ -161,7 +161,7 @@ function _config_swift_apache_wsgi() {
161 s/%APACHE_NAME%/${APACHE_NAME}/g; 161 s/%APACHE_NAME%/${APACHE_NAME}/g;
162 s/%USER%/${STACK_USER}/g; 162 s/%USER%/${STACK_USER}/g;
163 " -i ${apache_vhost_dir}/object-server-${node_number} 163 " -i ${apache_vhost_dir}/object-server-${node_number}
164 ! is_fedora && sudo a2ensite object-server-${node_number} 164 enable_apache_site object-server-${node_number}
165 165
166 sudo cp ${SWIFT_DIR}/examples/wsgi/object-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi 166 sudo cp ${SWIFT_DIR}/examples/wsgi/object-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi
167 sudo sed -e " 167 sudo sed -e "
@@ -177,7 +177,7 @@ function _config_swift_apache_wsgi() {
177 s/%APACHE_NAME%/${APACHE_NAME}/g; 177 s/%APACHE_NAME%/${APACHE_NAME}/g;
178 s/%USER%/${STACK_USER}/g; 178 s/%USER%/${STACK_USER}/g;
179 " -i ${apache_vhost_dir}/container-server-${node_number} 179 " -i ${apache_vhost_dir}/container-server-${node_number}
180 ! is_fedora && sudo a2ensite container-server-${node_number} 180 enable_apache_site container-server-${node_number}
181 181
182 sudo cp ${SWIFT_DIR}/examples/wsgi/container-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi 182 sudo cp ${SWIFT_DIR}/examples/wsgi/container-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi
183 sudo sed -e " 183 sudo sed -e "
@@ -193,18 +193,14 @@ function _config_swift_apache_wsgi() {
193 s/%APACHE_NAME%/${APACHE_NAME}/g; 193 s/%APACHE_NAME%/${APACHE_NAME}/g;
194 s/%USER%/${STACK_USER}/g; 194 s/%USER%/${STACK_USER}/g;
195 " -i ${apache_vhost_dir}/account-server-${node_number} 195 " -i ${apache_vhost_dir}/account-server-${node_number}
196 ! is_fedora && sudo a2ensite account-server-${node_number} 196 enable_apache_site account-server-${node_number}
197 197
198 sudo cp ${SWIFT_DIR}/examples/wsgi/account-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi 198 sudo cp ${SWIFT_DIR}/examples/wsgi/account-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
199 sudo sed -e " 199 sudo sed -e "
200 /^#/d;/^$/d; 200 /^#/d;/^$/d;
201 s/%SERVICECONF%/account-server\/${node_number}.conf/g; 201 s/%SERVICECONF%/account-server\/${node_number}.conf/g;
202 " -i ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi 202 " -i ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
203
204 done 203 done
205
206 # WSGI isn't enabled by default, enable it
207 ! is_fedora && sudo a2enmod wsgi
208} 204}
209 205
210# configure_swift() - Set config files, create data dirs and loop image 206# configure_swift() - Set config files, create data dirs and loop image