docs: Switching to /srv/www from /var/www to be more FHS 3.0 conformat

It's more modern and well supported to use /srv/www now in place of
/var/www.

Change-Id: Icd09ed4d5fb4e2b9b84ddead21313ea1c0a87c91
ref: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s17.html
This commit is contained in:
Renich Bon Ćirić
2020-09-02 19:12:37 -05:00
parent d17ee8ba14
commit 38ab4593f4

View File

@@ -6,92 +6,90 @@ Apache Deployment Guide
Web Front End Considerations Web Front End Considerations
---------------------------- ----------------------------
Swift can be configured to work both using an integral web front-end Swift can be configured to work both using an integral web front-end and using a
and using a full-fledged Web Server such as the Apache2 (HTTPD) web server. full-fledged Web Server such as the Apache2 (HTTPD) web server. The integral
The integral web front-end is a wsgi mini "Web Server" which opens web front-end is a wsgi mini "Web Server" which opens up its own socket and
up its own socket and serves http requests directly. serves http requests directly. The incoming requests accepted by the integral
The incoming requests accepted by the integral web front-end are then forwarded web front-end are then forwarded to a wsgi application (the core swift) for
to a wsgi application (the core swift) for further handling, possibly further handling, possibly via wsgi middleware sub-components.
via wsgi middleware sub-components.
client<---->'integral web front-end'<---->middleware<---->'core swift' client<---->'integral web front-end'<---->middleware<---->'core swift'
To gain full advantage of Apache2, Swift can alternatively be To gain full advantage of Apache2, Swift can alternatively be configured to work
configured to work as a request processor of the Apache2 server. as a request processor of the Apache2 server. This alternative deployment
This alternative deployment scenario uses mod_wsgi of Apache2 scenario uses mod_wsgi of Apache2 to forward requests to the swift wsgi
to forward requests to the swift wsgi application and middleware. application and middleware.
client<---->'Apache2 with mod_wsgi'<----->middleware<---->'core swift' client<---->'Apache2 with mod_wsgi'<----->middleware<---->'core swift'
The integral web front-end offers simplicity and requires The integral web front-end offers simplicity and requires minimal configuration.
minimal configuration. It is also the web front-end most commonly used It is also the web front-end most commonly used with Swift. Additionally, the
with Swift. integral web front-end includes support for receiving chunked transfer encoding
Additionally, the integral web front-end includes support for from a client, presently not supported by Apache2 in the operation mode
receiving chunked transfer encoding from a client, described here.
presently not supported by Apache2 in the operation mode described here.
The use of Apache2 offers new ways to extend Swift and integrate it with The use of Apache2 offers new ways to extend Swift and integrate it with
existing authentication, administration and control systems. existing authentication, administration and control systems. A single Apache2
A single Apache2 server can serve as the web front end of any number of swift server can serve as the web front end of any number of swift servers residing on
servers residing on a swift node. a swift node. For example when a storage node offers account, container and
For example when a storage node offers account, container and object services, object services, a single Apache2 server can serve as the web front end of all
a single Apache2 server can serve as the web front end of all three services. three services.
The apache variant described here was tested as part of an IBM research work. The apache variant described here was tested as part of an IBM research work.
It was found that following tuning, the Apache2 offer generally equivalent It was found that following tuning, the Apache2 offer generally equivalent
performance to that offered by the integral web front-end. performance to that offered by the integral web front-end. Alternative to
Alternative to Apache2, other web servers may be used, but were never tested. Apache2, other web servers may be used, but were never tested.
------------- -------------
Apache2 Setup Apache2 Setup
------------- -------------
Both Apache2 and mod-wsgi needs to be installed on the system. Both Apache2 and mod-wsgi needs to be installed on the system. Ubuntu comes
Ubuntu comes with Apache2 installed. Install mod-wsgi using:: with Apache2 installed. Install mod-wsgi using::
sudo apt-get install libapache2-mod-wsgi sudo apt-get install libapache2-mod-wsgi
First, change the User and Group IDs of Apache2 to be those used by Swift. First, change the User and Group IDs of Apache2 to be those used by Swift. For
For example in /etc/apache2/envvars use:: example in /etc/apache2/envvars use::
export APACHE_RUN_USER=swift export APACHE_RUN_USER=swift
export APACHE_RUN_GROUP=swift export APACHE_RUN_GROUP=swift
Create a directory for the Apache2 wsgi files:: Create a directory for the Apache2 wsgi files::
sudo mkdir /var/www/swift sudo mkdir /srv/www/swift
Create a file for each service under /var/www/swift. Create a file for each service under /srv/www/swift.
For a proxy service create /var/www/swift/proxy-server.wsgi:: For a proxy service create /srv/www/swift/proxy-server.wsgi::
from swift.common.wsgi import init_request_processor from swift.common.wsgi import init_request_processor
application, conf, logger, log_name = \ application, conf, logger, log_name = \
init_request_processor('/etc/swift/proxy-server.conf','proxy-server') init_request_processor('/etc/swift/proxy-server.conf','proxy-server')
For an account service create /var/www/swift/account-server.wsgi:: For an account service create /srv/www/swift/account-server.wsgi::
from swift.common.wsgi import init_request_processor from swift.common.wsgi import init_request_processor
application, conf, logger, log_name = \ application, conf, logger, log_name = \
init_request_processor('/etc/swift/account-server.conf', init_request_processor('/etc/swift/account-server.conf',
'account-server') 'account-server')
For an container service create /var/www/swift/container-server.wsgi:: For an container service create /srv/www/swift/container-server.wsgi::
from swift.common.wsgi import init_request_processor from swift.common.wsgi import init_request_processor
application, conf, logger, log_name = \ application, conf, logger, log_name = \
init_request_processor('/etc/swift/container-server.conf', init_request_processor('/etc/swift/container-server.conf',
'container-server') 'container-server')
For an object service create /var/www/swift/object-server.wsgi:: For an object service create /srv/www/swift/object-server.wsgi::
from swift.common.wsgi import init_request_processor from swift.common.wsgi import init_request_processor
application, conf, logger, log_name = \ application, conf, logger, log_name = \
init_request_processor('/etc/swift/object-server.conf', init_request_processor('/etc/swift/object-server.conf',
'object-server') 'object-server')
Create a /etc/apache2/conf.d/swift_wsgi.conf configuration file that will Create a /etc/apache2/conf.d/swift_wsgi.conf configuration file that will define
define a port and Virtual Host per each local service. a port and Virtual Host per each local service. For example an Apache2 serving
For example an Apache2 serving as a web front end of a proxy service:: as a web front end of a proxy service::
#Proxy #Proxy
NameVirtualHost *:8080 NameVirtualHost *:8080
@@ -101,20 +99,19 @@ For example an Apache2 serving as a web front end of a proxy service::
LimitRequestBody 5368709122 LimitRequestBody 5368709122
WSGIDaemonProcess proxy-server processes=5 threads=1 WSGIDaemonProcess proxy-server processes=5 threads=1
WSGIProcessGroup proxy-server WSGIProcessGroup proxy-server
WSGIScriptAlias / /var/www/swift/proxy-server.wsgi WSGIScriptAlias / /srv/www/swift/proxy-server.wsgi
LimitRequestFields 200 LimitRequestFields 200
ErrorLog /var/log/apache2/proxy-server ErrorLog /var/log/apache2/proxy-server
LogLevel debug LogLevel debug
CustomLog /var/log/apache2/proxy.log combined CustomLog /var/log/apache2/proxy.log combined
</VirtualHost> </VirtualHost>
Notice that when using Apache the limit on the maximal object size should Notice that when using Apache the limit on the maximal object size should be
be imposed by Apache using the LimitRequestBody rather by the swift proxy. imposed by Apache using the LimitRequestBody rather by the swift proxy. Note
Note also that the LimitRequestBody should indicate the same value also that the LimitRequestBody should indicate the same value as indicated by
as indicated by max_file_size located in both max_file_size located in both /etc/swift/swift.conf and in /etc/swift/test.conf.
/etc/swift/swift.conf and in /etc/swift/test.conf. The Swift default value for max_file_size (when not present) is 5368709122. For
The Swift default value for max_file_size (when not present) is 5368709122. example an Apache2 serving as a web front end of a storage node::
For example an Apache2 serving as a web front end of a storage node::
#Object Service #Object Service
NameVirtualHost *:6200 NameVirtualHost *:6200
@@ -123,7 +120,7 @@ For example an Apache2 serving as a web front end of a storage node::
ServerName object-server ServerName object-server
WSGIDaemonProcess object-server processes=5 threads=1 WSGIDaemonProcess object-server processes=5 threads=1
WSGIProcessGroup object-server WSGIProcessGroup object-server
WSGIScriptAlias / /var/www/swift/object-server.wsgi WSGIScriptAlias / /srv/www/swift/object-server.wsgi
LimitRequestFields 200 LimitRequestFields 200
ErrorLog /var/log/apache2/object-server ErrorLog /var/log/apache2/object-server
LogLevel debug LogLevel debug
@@ -137,7 +134,7 @@ For example an Apache2 serving as a web front end of a storage node::
ServerName container-server ServerName container-server
WSGIDaemonProcess container-server processes=5 threads=1 WSGIDaemonProcess container-server processes=5 threads=1
WSGIProcessGroup container-server WSGIProcessGroup container-server
WSGIScriptAlias / /var/www/swift/container-server.wsgi WSGIScriptAlias / /srv/www/swift/container-server.wsgi
LimitRequestFields 200 LimitRequestFields 200
ErrorLog /var/log/apache2/container-server ErrorLog /var/log/apache2/container-server
LogLevel debug LogLevel debug
@@ -151,7 +148,7 @@ For example an Apache2 serving as a web front end of a storage node::
ServerName account-server ServerName account-server
WSGIDaemonProcess account-server processes=5 threads=1 WSGIDaemonProcess account-server processes=5 threads=1
WSGIProcessGroup account-server WSGIProcessGroup account-server
WSGIScriptAlias / /var/www/swift/account-server.wsgi WSGIScriptAlias / /srv/www/swift/account-server.wsgi
LimitRequestFields 200 LimitRequestFields 200
ErrorLog /var/log/apache2/account-server ErrorLog /var/log/apache2/account-server
LogLevel debug LogLevel debug
@@ -168,11 +165,10 @@ Edit the tests config file and add::
web_front_end = apache2 web_front_end = apache2
normalized_urls = True normalized_urls = True
Also check to see that the file includes max_file_size of the same value as Also check to see that the file includes max_file_size of the same value as used
used for the LimitRequestBody in the apache config file above. for the LimitRequestBody in the apache config file above.
We are done. We are done. You may run functional tests to test - e.g.::
You may run functional tests to test - e.g.::
cd ~swift/swift cd ~swift/swift
./.functests ./.functests