commit 6f4143d9967f6f2e53df5092c2aaa9aea9f6f93e Author: Renich Bon Ćirić Date: Wed Sep 2 19:15:29 2020 -0500 Clean up apache deployment docs docs: Removing the use of NameVirtualHost from the apache examples It's not used anymore. It's deprecated in fact: https://httpd.apache.org/docs/2.4/mod/core.html#namevirtualhost Change-Id: I76999cfacc10a244024ee0cca66dda95a0169a67 docs: Added more spacing to the apache2 examples They're easier to read and a bit less bloated. Change-Id: I5e21a66018b7ef309918fbbde93f2494286d291e docs: Switching to /srv/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 docs: Added user, group and display name in WSGI examples This properly sets the user and group for the wsgi processes in the examples; as well as adding a display name for easier identification. Change-Id: Ie5783081e4054e5b2fbf3a856716101a1aaf61b8 docs: Replace apachectl for systemctl commands It's safe to asume that all modern distros; supported by OpenStack, will have systemd implemented. It's better to favor systemctl in those cases. Change-Id: Ic0d2e47c1ac53502ce638d6fc2424ab9df037262 docs: Emphasis to file paths and command options I've enclosed configuration options or parameters in interpreted text quotes. Also, I've enclosed fiel paths with inline literal quotes. Change-Id: Iec54b7758bce01fc8e8daff48498383cb70c62ce docs: Fixed wording used to indicate the restart of apache Just a little commit to make it clearer of what we're gonna do. Change-Id: Id5ab3e94519bcfe1832b92e456a1d1fa81dd54e3 diff --git a/doc/source/apache_deployment_guide.rst b/doc/source/apache_deployment_guide.rst index 2e6ef9d..e0b3ed4 100644 --- a/doc/source/apache_deployment_guide.rst +++ b/doc/source/apache_deployment_guide.rst @@ -48,125 +48,144 @@ with Apache2 installed. Install mod-wsgi using:: sudo apt-get install libapache2-mod-wsgi -First, change the User and Group IDs of Apache2 to be those used by Swift. For -example in /etc/apache2/envvars use:: - - export APACHE_RUN_USER=swift - export APACHE_RUN_GROUP=swift - Create a directory for the Apache2 wsgi files:: sudo mkdir /srv/www/swift -Create a file for each service under /srv/www/swift. +Create a working directory for the wsgi processes:: + + sudo mkdir -m 2770 /var/lib/swift + sudo chown swift:swift /var/lib/swift -For a proxy service create /srv/www/swift/proxy-server.wsgi:: +Create a file for each service under ``/srv/www/swift``. + +For a proxy service create ``/srv/www/swift/proxy-server.wsgi``:: from swift.common.wsgi import init_request_processor application, conf, logger, log_name = \ init_request_processor('/etc/swift/proxy-server.conf','proxy-server') -For an account service create /srv/www/swift/account-server.wsgi:: +For an account service create ``/srv/www/swift/account-server.wsgi``:: from swift.common.wsgi import init_request_processor application, conf, logger, log_name = \ init_request_processor('/etc/swift/account-server.conf', 'account-server') -For an container service create /srv/www/swift/container-server.wsgi:: +For an container service create ``/srv/www/swift/container-server.wsgi``:: from swift.common.wsgi import init_request_processor application, conf, logger, log_name = \ init_request_processor('/etc/swift/container-server.conf', 'container-server') -For an object service create /srv/www/swift/object-server.wsgi:: +For an object service create ``/srv/www/swift/object-server.wsgi``:: from swift.common.wsgi import init_request_processor application, conf, logger, log_name = \ init_request_processor('/etc/swift/object-server.conf', 'object-server') -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:: +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:: - #Proxy - NameVirtualHost *:8080 + # Proxy Listen 8080 + ServerName proxy-server + LimitRequestBody 5368709122 - WSGIDaemonProcess proxy-server processes=5 threads=1 + LimitRequestFields 200 + + WSGIDaemonProcess proxy-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP} WSGIProcessGroup proxy-server WSGIScriptAlias / /srv/www/swift/proxy-server.wsgi - LimitRequestFields 200 - ErrorLog /var/log/apache2/proxy-server LogLevel debug CustomLog /var/log/apache2/proxy.log combined + ErrorLog /var/log/apache2/proxy-server Notice that when using Apache the limit on the maximal object size should be -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 - NameVirtualHost *:6200 +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 Listen 6200 + ServerName object-server - WSGIDaemonProcess object-server processes=5 threads=1 + + LimitRequestFields 200 + + WSGIDaemonProcess object-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP} WSGIProcessGroup object-server WSGIScriptAlias / /srv/www/swift/object-server.wsgi - LimitRequestFields 200 - ErrorLog /var/log/apache2/object-server LogLevel debug CustomLog /var/log/apache2/access.log combined + ErrorLog /var/log/apache2/object-server - #Container Service - NameVirtualHost *:6201 + # Container Service Listen 6201 + ServerName container-server - WSGIDaemonProcess container-server processes=5 threads=1 + + LimitRequestFields 200 + + WSGIDaemonProcess container-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP} WSGIProcessGroup container-server WSGIScriptAlias / /srv/www/swift/container-server.wsgi - LimitRequestFields 200 - ErrorLog /var/log/apache2/container-server LogLevel debug CustomLog /var/log/apache2/access.log combined + ErrorLog /var/log/apache2/container-server - #Account Service - NameVirtualHost *:6202 + # Account Service Listen 6202 + ServerName account-server - WSGIDaemonProcess account-server processes=5 threads=1 + + LimitRequestFields 200 + + WSGIDaemonProcess account-server processes=5 threads=1 user=swift group=swift display-name=%{GROUP} WSGIProcessGroup account-server WSGIScriptAlias / /srv/www/swift/account-server.wsgi - LimitRequestFields 200 - ErrorLog /var/log/apache2/account-server LogLevel debug CustomLog /var/log/apache2/access.log combined + ErrorLog /var/log/apache2/account-server -Next stop the Apache2 and start it again (apache2ctl restart is not enough):: +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 - apache2ctl stop - apache2ctl start Edit the tests config file and add:: web_front_end = apache2 normalized_urls = True -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. +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. We are done. You may run functional tests to test - e.g.::