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
This commit is contained in:
parent
d24674ed22
commit
5470701e10
27
lib/apache
27
lib/apache
@ -6,6 +6,8 @@
|
|||||||
# is_apache_enabled_service
|
# is_apache_enabled_service
|
||||||
# install_apache_wsgi
|
# install_apache_wsgi
|
||||||
# config_apache_wsgi
|
# config_apache_wsgi
|
||||||
|
# enable_apache_site
|
||||||
|
# disable_apache_site
|
||||||
# start_apache_server
|
# start_apache_server
|
||||||
# stop_apache_server
|
# stop_apache_server
|
||||||
# restart_apache_server
|
# restart_apache_server
|
||||||
@ -57,16 +59,41 @@ function install_apache_wsgi() {
|
|||||||
if is_ubuntu; then
|
if is_ubuntu; then
|
||||||
# Install apache2, which is NOPRIME'd
|
# Install apache2, which is NOPRIME'd
|
||||||
install_package apache2 libapache2-mod-wsgi
|
install_package apache2 libapache2-mod-wsgi
|
||||||
|
# WSGI isn't enabled by default, enable it
|
||||||
|
sudo a2enmod wsgi
|
||||||
elif is_fedora; then
|
elif is_fedora; then
|
||||||
sudo rm -f /etc/httpd/conf.d/000-*
|
sudo rm -f /etc/httpd/conf.d/000-*
|
||||||
install_package httpd mod_wsgi
|
install_package httpd mod_wsgi
|
||||||
elif is_suse; then
|
elif is_suse; then
|
||||||
install_package apache2 apache2-mod_wsgi
|
install_package apache2 apache2-mod_wsgi
|
||||||
|
# WSGI isn't enabled by default, enable it
|
||||||
|
sudo a2enmod wsgi
|
||||||
else
|
else
|
||||||
exit_distro_not_supported "apache installation"
|
exit_distro_not_supported "apache installation"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# enable_apache_site() - Enable a particular apache site
|
||||||
|
function enable_apache_site() {
|
||||||
|
local site=$@
|
||||||
|
if is_ubuntu; then
|
||||||
|
sudo a2ensite ${site}
|
||||||
|
elif is_fedora; then
|
||||||
|
# fedora conf.d is only imported if it ends with .conf so this is approx the same
|
||||||
|
sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site} /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# disable_apache_site() - Disable a particular apache site
|
||||||
|
function disable_apache_site() {
|
||||||
|
local site=$@
|
||||||
|
if is_ubuntu; then
|
||||||
|
sudo a2dissite ${site}
|
||||||
|
elif is_fedora; then
|
||||||
|
sudo mv /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}.conf /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# start_apache_server() - Start running apache server
|
# start_apache_server() - Start running apache server
|
||||||
function start_apache_server() {
|
function start_apache_server() {
|
||||||
start_service $APACHE_NAME
|
start_service $APACHE_NAME
|
||||||
|
@ -123,8 +123,6 @@ function init_horizon() {
|
|||||||
# Be a good citizen and use the distro tools here
|
# Be a good citizen and use the distro tools here
|
||||||
sudo touch $horizon_conf
|
sudo touch $horizon_conf
|
||||||
sudo a2ensite horizon.conf
|
sudo a2ensite horizon.conf
|
||||||
# WSGI isn't enabled by default, enable it
|
|
||||||
sudo a2enmod wsgi
|
|
||||||
elif is_fedora; then
|
elif is_fedora; then
|
||||||
if [[ "$os_RELEASE" -ge "18" ]]; then
|
if [[ "$os_RELEASE" -ge "18" ]]; then
|
||||||
# fedora 18 has Require all denied in its httpd.conf
|
# fedora 18 has Require all denied in its httpd.conf
|
||||||
@ -132,9 +130,6 @@ function init_horizon() {
|
|||||||
HORIZON_REQUIRE='Require all granted'
|
HORIZON_REQUIRE='Require all granted'
|
||||||
fi
|
fi
|
||||||
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
|
sudo sed '/^Listen/s/^.*$/Listen 0.0.0.0:80/' -i /etc/httpd/conf/httpd.conf
|
||||||
elif is_suse; then
|
|
||||||
# WSGI isn't enabled by default, enable it
|
|
||||||
sudo a2enmod wsgi
|
|
||||||
else
|
else
|
||||||
exit_distro_not_supported "apache configuration"
|
exit_distro_not_supported "apache configuration"
|
||||||
fi
|
fi
|
||||||
|
16
lib/swift
16
lib/swift
@ -115,11 +115,11 @@ function cleanup_swift() {
|
|||||||
# _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
|
# _cleanup_swift_apache_wsgi() - Remove wsgi files, disable and remove apache vhost file
|
||||||
function _cleanup_swift_apache_wsgi() {
|
function _cleanup_swift_apache_wsgi() {
|
||||||
sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi
|
sudo rm -f $SWIFT_APACHE_WSGI_DIR/*.wsgi
|
||||||
! is_fedora && sudo a2dissite proxy-server
|
disable_apache_site proxy-server
|
||||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||||
for type in object container account; do
|
for type in object container account; do
|
||||||
site_name=${type}-server-${node_number}
|
site_name=${type}-server-${node_number}
|
||||||
! is_fedora && sudo a2dissite ${site_name}
|
disable_apache_site ${site_name}
|
||||||
sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site_name}
|
sudo rm -f /etc/$APACHE_NAME/$APACHE_CONF_DIR/${site_name}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@ -140,13 +140,13 @@ function _config_swift_apache_wsgi() {
|
|||||||
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
||||||
s/%USER%/${STACK_USER}/g;
|
s/%USER%/${STACK_USER}/g;
|
||||||
" -i ${apache_vhost_dir}/proxy-server
|
" -i ${apache_vhost_dir}/proxy-server
|
||||||
|
enable_apache_site proxy-server
|
||||||
|
|
||||||
sudo cp ${SWIFT_DIR}/examples/wsgi/proxy-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
|
sudo cp ${SWIFT_DIR}/examples/wsgi/proxy-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
|
||||||
sudo sed -e "
|
sudo sed -e "
|
||||||
/^#/d;/^$/d;
|
/^#/d;/^$/d;
|
||||||
s/%SERVICECONF%/proxy-server.conf/g;
|
s/%SERVICECONF%/proxy-server.conf/g;
|
||||||
" -i ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
|
" -i ${SWIFT_APACHE_WSGI_DIR}/proxy-server.wsgi
|
||||||
! is_fedora && sudo a2ensite proxy-server
|
|
||||||
|
|
||||||
# copy apache vhost file and set name and port
|
# copy apache vhost file and set name and port
|
||||||
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
for node_number in ${SWIFT_REPLICAS_SEQ}; do
|
||||||
@ -161,7 +161,7 @@ function _config_swift_apache_wsgi() {
|
|||||||
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
||||||
s/%USER%/${STACK_USER}/g;
|
s/%USER%/${STACK_USER}/g;
|
||||||
" -i ${apache_vhost_dir}/object-server-${node_number}
|
" -i ${apache_vhost_dir}/object-server-${node_number}
|
||||||
! is_fedora && sudo a2ensite object-server-${node_number}
|
enable_apache_site object-server-${node_number}
|
||||||
|
|
||||||
sudo cp ${SWIFT_DIR}/examples/wsgi/object-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi
|
sudo cp ${SWIFT_DIR}/examples/wsgi/object-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/object-server-${node_number}.wsgi
|
||||||
sudo sed -e "
|
sudo sed -e "
|
||||||
@ -177,7 +177,7 @@ function _config_swift_apache_wsgi() {
|
|||||||
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
||||||
s/%USER%/${STACK_USER}/g;
|
s/%USER%/${STACK_USER}/g;
|
||||||
" -i ${apache_vhost_dir}/container-server-${node_number}
|
" -i ${apache_vhost_dir}/container-server-${node_number}
|
||||||
! is_fedora && sudo a2ensite container-server-${node_number}
|
enable_apache_site container-server-${node_number}
|
||||||
|
|
||||||
sudo cp ${SWIFT_DIR}/examples/wsgi/container-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi
|
sudo cp ${SWIFT_DIR}/examples/wsgi/container-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/container-server-${node_number}.wsgi
|
||||||
sudo sed -e "
|
sudo sed -e "
|
||||||
@ -193,18 +193,14 @@ function _config_swift_apache_wsgi() {
|
|||||||
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
s/%APACHE_NAME%/${APACHE_NAME}/g;
|
||||||
s/%USER%/${STACK_USER}/g;
|
s/%USER%/${STACK_USER}/g;
|
||||||
" -i ${apache_vhost_dir}/account-server-${node_number}
|
" -i ${apache_vhost_dir}/account-server-${node_number}
|
||||||
! is_fedora && sudo a2ensite account-server-${node_number}
|
enable_apache_site account-server-${node_number}
|
||||||
|
|
||||||
sudo cp ${SWIFT_DIR}/examples/wsgi/account-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
|
sudo cp ${SWIFT_DIR}/examples/wsgi/account-server.wsgi.template ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
|
||||||
sudo sed -e "
|
sudo sed -e "
|
||||||
/^#/d;/^$/d;
|
/^#/d;/^$/d;
|
||||||
s/%SERVICECONF%/account-server\/${node_number}.conf/g;
|
s/%SERVICECONF%/account-server\/${node_number}.conf/g;
|
||||||
" -i ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
|
" -i ${SWIFT_APACHE_WSGI_DIR}/account-server-${node_number}.wsgi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# WSGI isn't enabled by default, enable it
|
|
||||||
! is_fedora && sudo a2enmod wsgi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# configure_swift() - Set config files, create data dirs and loop image
|
# configure_swift() - Set config files, create data dirs and loop image
|
||||||
|
Loading…
Reference in New Issue
Block a user