2013-03-04 23:38:48 +02:00
|
|
|
=======================
|
|
|
|
Apache Deployment Guide
|
|
|
|
=======================
|
|
|
|
|
|
|
|
----------------------------
|
|
|
|
Web Front End Considerations
|
|
|
|
----------------------------
|
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
Swift can be configured to work both using an integral web front-end and using a
|
|
|
|
full-fledged Web Server such as the Apache2 (HTTPD) web server. The integral
|
|
|
|
web front-end is a wsgi mini "Web Server" which opens up its own socket and
|
|
|
|
serves http requests directly. The incoming requests accepted by the integral
|
|
|
|
web front-end are then forwarded to a wsgi application (the core swift) for
|
|
|
|
further handling, possibly via wsgi middleware sub-components.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
client<---->'integral web front-end'<---->middleware<---->'core swift'
|
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
To gain full advantage of Apache2, Swift can alternatively be configured to work
|
|
|
|
as a request processor of the Apache2 server. This alternative deployment
|
|
|
|
scenario uses mod_wsgi of Apache2 to forward requests to the swift wsgi
|
|
|
|
application and middleware.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
client<---->'Apache2 with mod_wsgi'<----->middleware<---->'core swift'
|
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
The integral web front-end offers simplicity and requires minimal configuration.
|
|
|
|
It is also the web front-end most commonly used with Swift. Additionally, the
|
|
|
|
integral web front-end includes support for receiving chunked transfer encoding
|
|
|
|
from a client, presently not supported by Apache2 in the operation mode
|
|
|
|
described here.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
The use of Apache2 offers new ways to extend Swift and integrate it with
|
2020-09-02 19:12:37 -05:00
|
|
|
existing authentication, administration and control systems. A single Apache2
|
|
|
|
server can serve as the web front end of any number of swift servers residing on
|
|
|
|
a swift node. For example when a storage node offers account, container and
|
|
|
|
object services, a single Apache2 server can serve as the web front end of all
|
|
|
|
three services.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
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
|
2020-09-02 19:12:37 -05:00
|
|
|
performance to that offered by the integral web front-end. Alternative to
|
|
|
|
Apache2, other web servers may be used, but were never tested.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
-------------
|
|
|
|
Apache2 Setup
|
|
|
|
-------------
|
2020-09-02 19:12:37 -05:00
|
|
|
Both Apache2 and mod-wsgi needs to be installed on the system. Ubuntu comes
|
|
|
|
with Apache2 installed. Install mod-wsgi using::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
sudo apt-get install libapache2-mod-wsgi
|
|
|
|
|
|
|
|
Create a directory for the Apache2 wsgi files::
|
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
sudo mkdir /srv/www/swift
|
2013-03-04 23:38:48 +02:00
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
Create a working directory for the wsgi processes::
|
|
|
|
|
|
|
|
sudo mkdir -m 2770 /var/lib/swift
|
|
|
|
sudo chown swift:swift /var/lib/swift
|
2013-03-04 23:38:48 +02:00
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
Create a file for each service under ``/srv/www/swift``.
|
|
|
|
|
|
|
|
For a proxy service create ``/srv/www/swift/proxy-server.wsgi``::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
from swift.common.wsgi import init_request_processor
|
|
|
|
application, conf, logger, log_name = \
|
|
|
|
init_request_processor('/etc/swift/proxy-server.conf','proxy-server')
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
For an account service create ``/srv/www/swift/account-server.wsgi``::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
from swift.common.wsgi import init_request_processor
|
|
|
|
application, conf, logger, log_name = \
|
|
|
|
init_request_processor('/etc/swift/account-server.conf',
|
|
|
|
'account-server')
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
For an container service create ``/srv/www/swift/container-server.wsgi``::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
from swift.common.wsgi import init_request_processor
|
|
|
|
application, conf, logger, log_name = \
|
|
|
|
init_request_processor('/etc/swift/container-server.conf',
|
|
|
|
'container-server')
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
For an object service create ``/srv/www/swift/object-server.wsgi``::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
from swift.common.wsgi import init_request_processor
|
|
|
|
application, conf, logger, log_name = \
|
|
|
|
init_request_processor('/etc/swift/object-server.conf',
|
|
|
|
'object-server')
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
Create a ``/etc/apache2/conf.d/swift_wsgi.conf`` configuration file that will
|
|
|
|
define a port and Virtual Host per each local service. For example an Apache2
|
|
|
|
serving as a web front end of a proxy service::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
# Proxy
|
2013-03-04 23:38:48 +02:00
|
|
|
Listen 8080
|
2020-09-02 19:15:29 -05:00
|
|
|
|
2013-03-04 23:38:48 +02:00
|
|
|
<VirtualHost *:8080>
|
|
|
|
ServerName proxy-server
|
2020-09-02 19:15:29 -05:00
|
|
|
|
2013-03-04 23:38:48 +02:00
|
|
|
LimitRequestBody 5368709122
|
2020-09-02 19:15:29 -05:00
|
|
|
LimitRequestFields 200
|
|
|
|
|
|
|
|
WSGIDaemonProcess proxy-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP}
|
2013-03-04 23:38:48 +02:00
|
|
|
WSGIProcessGroup proxy-server
|
2020-09-02 19:12:37 -05:00
|
|
|
WSGIScriptAlias / /srv/www/swift/proxy-server.wsgi
|
2013-03-04 23:38:48 +02:00
|
|
|
LogLevel debug
|
|
|
|
CustomLog /var/log/apache2/proxy.log combined
|
2020-09-02 19:15:29 -05:00
|
|
|
ErrorLog /var/log/apache2/proxy-server
|
2013-03-04 23:38:48 +02:00
|
|
|
</VirtualHost>
|
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
Notice that when using Apache the limit on the maximal object size should be
|
2020-09-02 19:15:29 -05:00
|
|
|
imposed by Apache using the `LimitRequestBody` rather by the swift proxy. Note
|
|
|
|
also that the `LimitRequestBody` should indicate the same value as indicated by
|
|
|
|
`max_file_size` located in both ``/etc/swift/swift.conf`` and in
|
|
|
|
``/etc/swift/test.conf``. The Swift default value for `max_file_size` (when not
|
|
|
|
present) is `5368709122`. For example an Apache2 serving as a web front end of a
|
|
|
|
storage node::
|
|
|
|
|
|
|
|
# Object Service
|
2016-02-01 18:06:54 +00:00
|
|
|
Listen 6200
|
2020-09-02 19:15:29 -05:00
|
|
|
|
2016-02-01 18:06:54 +00:00
|
|
|
<VirtualHost *:6200>
|
2013-03-04 23:38:48 +02:00
|
|
|
ServerName object-server
|
2020-09-02 19:15:29 -05:00
|
|
|
|
|
|
|
LimitRequestFields 200
|
|
|
|
|
|
|
|
WSGIDaemonProcess object-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP}
|
2013-03-04 23:38:48 +02:00
|
|
|
WSGIProcessGroup object-server
|
2020-09-02 19:12:37 -05:00
|
|
|
WSGIScriptAlias / /srv/www/swift/object-server.wsgi
|
2013-03-04 23:38:48 +02:00
|
|
|
LogLevel debug
|
|
|
|
CustomLog /var/log/apache2/access.log combined
|
2020-09-02 19:15:29 -05:00
|
|
|
ErrorLog /var/log/apache2/object-server
|
2013-03-04 23:38:48 +02:00
|
|
|
</VirtualHost>
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
# Container Service
|
2016-02-01 18:06:54 +00:00
|
|
|
Listen 6201
|
2020-09-02 19:15:29 -05:00
|
|
|
|
2016-02-01 18:06:54 +00:00
|
|
|
<VirtualHost *:6201>
|
2013-03-04 23:38:48 +02:00
|
|
|
ServerName container-server
|
2020-09-02 19:15:29 -05:00
|
|
|
|
|
|
|
LimitRequestFields 200
|
|
|
|
|
|
|
|
WSGIDaemonProcess container-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP}
|
2013-03-04 23:38:48 +02:00
|
|
|
WSGIProcessGroup container-server
|
2020-09-02 19:12:37 -05:00
|
|
|
WSGIScriptAlias / /srv/www/swift/container-server.wsgi
|
2013-03-04 23:38:48 +02:00
|
|
|
LogLevel debug
|
|
|
|
CustomLog /var/log/apache2/access.log combined
|
2020-09-02 19:15:29 -05:00
|
|
|
ErrorLog /var/log/apache2/container-server
|
2013-03-04 23:38:48 +02:00
|
|
|
</VirtualHost>
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
# Account Service
|
2016-02-01 18:06:54 +00:00
|
|
|
Listen 6202
|
2020-09-02 19:15:29 -05:00
|
|
|
|
2016-02-01 18:06:54 +00:00
|
|
|
<VirtualHost *:6202>
|
2013-03-04 23:38:48 +02:00
|
|
|
ServerName account-server
|
2020-09-02 19:15:29 -05:00
|
|
|
|
|
|
|
LimitRequestFields 200
|
|
|
|
|
|
|
|
WSGIDaemonProcess account-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP}
|
2013-03-04 23:38:48 +02:00
|
|
|
WSGIProcessGroup account-server
|
2020-09-02 19:12:37 -05:00
|
|
|
WSGIScriptAlias / /srv/www/swift/account-server.wsgi
|
2013-03-04 23:38:48 +02:00
|
|
|
LogLevel debug
|
|
|
|
CustomLog /var/log/apache2/access.log combined
|
2020-09-02 19:15:29 -05:00
|
|
|
ErrorLog /var/log/apache2/account-server
|
2013-03-04 23:38:48 +02:00
|
|
|
</VirtualHost>
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
Enable the newly configured Virtual Hosts::
|
|
|
|
|
|
|
|
a2ensite swift_wsgi.conf
|
|
|
|
|
|
|
|
Next, stop, test and start Apache2 again::
|
|
|
|
|
|
|
|
# stop it
|
|
|
|
systemctl stop apache2.service
|
|
|
|
|
|
|
|
# test the configuration
|
|
|
|
apache2ctl -t
|
|
|
|
|
|
|
|
# start it if the test succeeds
|
|
|
|
systemctl start apache2.service
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
Edit the tests config file and add::
|
|
|
|
|
|
|
|
web_front_end = apache2
|
|
|
|
normalized_urls = True
|
|
|
|
|
2020-09-02 19:15:29 -05:00
|
|
|
Also check to see that the file includes `max_file_size` of the same value as
|
|
|
|
used for the `LimitRequestBody` in the apache config file above.
|
2013-03-04 23:38:48 +02:00
|
|
|
|
2020-09-02 19:12:37 -05:00
|
|
|
We are done. You may run functional tests to test - e.g.::
|
2013-03-04 23:38:48 +02:00
|
|
|
|
|
|
|
cd ~swift/swift
|
|
|
|
./.functests
|