codekingpro/portable-devtools
114k
1��X� �sphinx.addnodes��document���)��}�(� rawsource�� ��children�]�(�docutils.nodes��target���)��}�(h�.. _server_deployment:�h]��2attributes�}�(�ids�]��classes�]��names�]��dupnames�]��backrefs�]��refid��server-deployment�u�tagname�h3�line�K�parent�h� _document�h�source��lD:\a\pgadmin-packaging-foundation\pgadmin-packaging-foundation\pgadmin4-8.6\docs\en_US\server_deployment.rst�ubh �section���)��}�(hhh]�(h �title���)��}�(h�`Server Deployment`:index:�h]�(h �index���)��}�(hhh]�h}�(h]�h]�h]�h]�h]��entries�]�(�single��Server Deployment��index-0�hNt�auhh/h"h#hKh h+ubh)��}�(hhh]�h}�(h]�h>ah]�h]�h]�h]�uhh4h h+ubh �Text����Server Deployment�����}�(h h+h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhh)h h&h!hh"h#hKubh � paragraph���)��}�(h��pgAdmin may be deployed as a web application by configuring the app to run in5server mode and then deploying it either behind a webserver running as a reverse6proxy, or using the WSGI interface.�h]�hJ��pgAdmin may be deployed as a web application by configuring the app to run in7server mode and then deploying it either behind a webserver running as a reverse8proxy, or using the WSGI interface.�����}�(h hWh!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKh h&h!hubhV)��}�(h�JWhen deployed in server mode, there are two notable differences for users:�h]�hJ�JWhen deployed in server mode, there are two notable differences for users:�����}�(h heh!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKh h&h!hubh �bullet_list���)��}�(hhh]�(h � list_item���)��}�(h��Users must login before they can use pgAdmin. An initial superuser account9is created when server mode is initialised, and this user can add additional10superusers and non-superusers as required.�h]�hV)��}�(h��Users must login before they can use pgAdmin. An initial superuser account11is created when server mode is initialised, and this user can add additional12superusers and non-superusers as required.�h]�hJ��Users must login before they can use pgAdmin. An initial superuser account13is created when server mode is initialised, and this user can add additional14superusers and non-superusers as required.�����}�(h h~h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK
h hzubah}�(h]�h]�h]�h]�h]�uhhxh"h#hK
h huh!hubhy)��}�(h��File storage is restricted to a virtual root directory for each individual15user under the directory configured using the ``STORAGE_DIR`` configuration16parameter. Users do not have access to the complete filesystem of the server.17�h]�hV)��}�(h��File storage is restricted to a virtual root directory for each individual18user under the directory configured using the ``STORAGE_DIR`` configuration19parameter. Users do not have access to the complete filesystem of the server.�h]�(hJ�yFile storage is restricted to a virtual root directory for each individual20user under the directory configured using the �����}�(h h�h!hh"NhNubh �literal���)��}�(h�``STORAGE_DIR``�h]�hJ�STORAGE_DIR�����}�(h h�h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�\ configuration21parameter. Users do not have access to the complete filesystem of the server.�����}�(h h�h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKh h�ubah}�(h]�h]�h]�h]�h]�uhhxh"h#hKh huh!hubeh}�(h]�h]�h]�h]�h]��bullet��*�uhhsh"h#hK
h h&h!hubhV)��}�(h��The following instructions demonstrate how pgAdmin may be run as a WSGI22application under ``Apache HTTPD``, using ``mod_wsgi``, standalone using ``uWSGI``23or ``Gunicorn``, or under ``NGINX`` using using ``uWSGI`` or ``Gunicorn``.�h]�(hJ�ZThe following instructions demonstrate how pgAdmin may be run as a WSGI24application under �����}�(h h�h!hh"NhNubh�)��}�(h�``Apache HTTPD``�h]�hJ�Apache HTTPD�����}�(h h�h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�, using �����}�(h h�h!hh"NhNubh�)��}�(h�``mod_wsgi``�h]�hJ�mod_wsgi�����}�(h h�h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�, standalone using �����}�(h h�h!hh"NhNubh�)��}�(h� ``uWSGI``�h]�hJ�uWSGI�����}�(h h�h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�25or �����}�(h h�h!hh"NhNubh�)��}�(h�``Gunicorn``�h]�hJ�Gunicorn�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�, or under �����}�(h h�h!hh"NhNubh�)��}�(h� ``NGINX``�h]�hJ�NGINX�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�
using using �����}�(h h�h!hh"NhNubh�)��}�(h� ``uWSGI``�h]�hJ�uWSGI�����}�(h j( h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ� or �����}�(h h�h!hh"NhNubh�)��}�(h�``Gunicorn``�h]�hJ�Gunicorn�����}�(h j: h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h h�ubhJ�.�����}�(h h�h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKh h&h!hubh �seealso���)��}�(hX� For detailed instructions on building and configuring pgAdmin from26scratch, please see the README file in the top level directory of the source code.27For convenience, you can find the latest version of the file28`here <https://github.com/pgadmin-org/pgadmin4/blob/master/README.md>`_,29but be aware that this may differ from the version included with the source code30for a specific version of pgAdmin.�h]�hV)��}�(hX� For detailed instructions on building and configuring pgAdmin from31scratch, please see the README file in the top level directory of the source code.32For convenience, you can find the latest version of the file33`here <https://github.com/pgadmin-org/pgadmin4/blob/master/README.md>`_,34but be aware that this may differ from the version included with the source code35for a specific version of pgAdmin.�h]�(hJ��For detailed instructions on building and configuring pgAdmin from36scratch, please see the README file in the top level directory of the source code.37For convenience, you can find the latest version of the file38�����}�(h jX h!hh"NhNubh � reference���)��}�(h�G`here <https://github.com/pgadmin-org/pgadmin4/blob/master/README.md>`_�h]�hJ�here�����}�(h jb h!hh"NhNubah}�(h]�h]�h]�h]�h]��name��here��refuri��=https://github.com/pgadmin-org/pgadmin4/blob/master/README.md�uhj` h jX ubh)��}�(h�@ <https://github.com/pgadmin-org/pgadmin4/blob/master/README.md>�h]�h}�(h]��here�ah]�h]��here�ah]�h]��refuri�js uhh39�40referenced�Kh jX ubhJ�u,41but be aware that this may differ from the version included with the source code42for a specific version of pgAdmin.�����}�(h jX h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKh jT ubah}�(h]�h]�h]�h]�h]�uhjR h"h#hKh h&h!hubh%)��}�(hhh]�(h*)��}�(h�Requirements�h]�hJ�Requirements�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j� h!hh"h#hK!ubhV)��}�(hX **Important**: Some components of pgAdmin require the ability to maintain affinity43between client sessions and a specific database connection (for example, the44Query Tool in which the user might run a BEGIN command followed by a number of45DML SQL statements, and then a COMMIT). pgAdmin has been designed with built-in46connection management to handle this, however it requires that only a single47Python process is used because it is not easily possible to maintain affinity48between a client session and one of multiple WSGI worker processes.�h]�(h �strong���)��}�(h�
**Important**�h]�hJ� Important�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhj� h j� ubhJX : Some components of pgAdmin require the ability to maintain affinity49between client sessions and a specific database connection (for example, the50Query Tool in which the user might run a BEGIN command followed by a number of51DML SQL statements, and then a COMMIT). pgAdmin has been designed with built-in52connection management to handle this, however it requires that only a single53Python process is used because it is not easily possible to maintain affinity54between a client session and one of multiple WSGI worker processes.�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK#h j� h!hubhV)��}�(h��On Windows systems, the Apache HTTP server uses a single process, multi-threaded55architecture. WSGI applications run in ``embedded`` mode, which means that only56a single process will be present on this platform in all cases.�h]�(hJ�xOn Windows systems, the Apache HTTP server uses a single process, multi-threaded57architecture. WSGI applications run in �����}�(h j� h!hh"NhNubh�)��}�(h�``embedded``�h]�hJ�embedded�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�\ mode, which means that only58a single process will be present on this platform in all cases.�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK+h j� h!hubhV)��}�(hXG On Unix systems, the Apache HTTP server typically uses a multi-process, single59threaded architecture (this is dependent on the ``MPM`` that is chosen at60compile time). If ``embedded`` mode is chosen for the WSGI application, then61there will be one Python environment for each Apache process, each with it's own62connection manager which will lead to loss of connection affinity. Therefore63one should use ``mod_wsgi``'s ``daemon`` mode, configured to use a single64process. This will launch a single instance of the WSGI application which is65utilised by all the Apache worker processes.�h]�(hJ�On Unix systems, the Apache HTTP server typically uses a multi-process, single66threaded architecture (this is dependent on the �����}�(h j� h!hh"NhNubh�)��}�(h�``MPM``�h]�hJ�MPM�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�% that is chosen at67compile time). If �����}�(h j� h!hh"NhNubh�)��}�(h�``embedded``�h]�hJ�embedded�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�� mode is chosen for the WSGI application, then68there will be one Python environment for each Apache process, each with it’s own69connection manager which will lead to loss of connection affinity. Therefore70one should use �����}�(h j� h!hh"NhNubh�)��}�(h�``mod_wsgi``�h]�hJ�mod_wsgi�����}�(h j
h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�’s �����}�(h j� h!hh"NhNubh�)��}�(h�71``daemon``�h]�hJ�daemon�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�� mode, configured to use a single72process. This will launch a single instance of the WSGI application which is73utilised by all the Apache worker processes.�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK/h j� h!hubhV)��}�(h��Whilst it is true that this is a potential performance bottleneck, in reality74pgAdmin is not a web application that's ever likely to see heavy traffic75unlike a busy website, so in practice should not be an issue.�h]�hJ��Whilst it is true that this is a potential performance bottleneck, in reality76pgAdmin is not a web application that’s ever likely to see heavy traffic77unlike a busy website, so in practice should not be an issue.�����}�(h j7 h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK8h j� h!hubhV)��}�(h��Future versions of pgAdmin may introduce a shared connection manager process to78overcome this limitation, however that is a significant amount of work for79little practical gain.�h]�hJ��Future versions of pgAdmin may introduce a shared connection manager process to80overcome this limitation, however that is a significant amount of work for81little practical gain.�����}�(h jE h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK<h j� h!hubeh}�(h]��requirements�ah]�h]��requirements�ah]�h]�uhh$h h&h!hh"h#hK!ubh%)��}�(hhh]�(h*)��}�(h�
Configuration�h]�hJ�
Configuration�����}�(h j^ h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j[ h!hh"h#hKAubhV)��}�(h��In order to configure pgAdmin to run in server mode, it may be necessary to82configure the Python code to run in multi-user mode, and then to configure the83web server to find and execute the code.�h]�hJ��In order to configure pgAdmin to run in server mode, it may be necessary to84configure the Python code to run in multi-user mode, and then to configure the85web server to find and execute the code.�����}�(h jl h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKCh j[ h!hubhV)��}�(h�DSee :ref:`config_py` for more information on configuration settings.�h]�(hJ�See �����}�(h jz h!hh"NhNubh �pending_xref���)��}�(h�:ref:`config_py`�h]�h �inline���)��}�(hj� h]�hJ� config_py�����}�(h j� h!hh"NhNubah}�(h]�h]�(�xref��std��std-ref�eh]�h]�h]�uhj� h j� ubah}�(h]�h]�h]�h]�h]��refdoc��server_deployment�� refdomain�j� �reftype��ref��refexplicit���refwarn��� reftarget�� config_py�uhj� h"h#hKGh jz ubhJ�0 for more information on configuration settings.�����}�(h jz h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKGh j[ h!hubh%)��}�(hhh]�(h*)��}�(h�Python�h]�hJ�Python�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j� h!hh"h#hKJubhV)��}�(hX. From pgAdmin 4 v2 onwards, server mode is the default configuration. If running under86the desktop runtime, this is overridden automatically. There should typically be no87need to modify the configuration simply to enable server mode to work, however it may88be desirable to adjust some of the paths used.�h]�hJX. From pgAdmin 4 v2 onwards, server mode is the default configuration. If running under89the desktop runtime, this is overridden automatically. There should typically be no90need to modify the configuration simply to enable server mode to work, however it may91be desirable to adjust some of the paths used.�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKLh j� h!hubhV)��}�(h�:In order to configure the Python code, follow these steps:�h]�hJ�:In order to configure the Python code, follow these steps:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKQh j� h!hubh �enumerated_list���)��}�(hhh]�(hy)��}�(h�MCreate a ``config_local.py`` file alongside the existing ``config.py`` file.92�h]�hV)��}�(h�LCreate a ``config_local.py`` file alongside the existing ``config.py`` file.�h]�(hJ� Create a �����}�(h j� h!hh"NhNubh�)��}�(h�``config_local.py``�h]�hJ�config_local.py�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ� file alongside the existing �����}�(h j� h!hh"NhNubh�)��}�(h�
``config.py``�h]�hJ� config.py�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ� file.�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKSh j� ubah}�(h]�h]�h]�h]�h]�uhhxh"h#hKSh j� h!hubhy)��}�(hX� Edit ``config_local.py`` and add the following settings. In most cases, the default93file locations should be appropriate:94 95*NOTE: You must ensure the directories specified are writeable by96the user that the web server processes will be running as, e.g. apache or www-data.97You may specify DATA_DIR in order to create all required directories and files98under DATA_DIR folder.*99 100.. code-block:: python101 102 LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'103 SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'104 SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'105 STORAGE_DIR = '/var/lib/pgadmin4/storage'106 AZURE_CREDENTIAL_CACHE_DIR = '/var/lib/pgadmin4/azurecredentialcache'107 KERBEROS_CCACHE_DIR = '/var/lib/pgadmin4/kerberoscache'108�h]�(hV)��}�(h�yEdit ``config_local.py`` and add the following settings. In most cases, the default109file locations should be appropriate:�h]�(hJ�Edit �����}�(h j% h!hh"NhNubh�)��}�(h�``config_local.py``�h]�hJ�config_local.py�����}�(h j- h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j% ubhJ�a and add the following settings. In most cases, the default110file locations should be appropriate:�����}�(h j% h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKUh j! ubhV)��}�(h��*NOTE: You must ensure the directories specified are writeable by111the user that the web server processes will be running as, e.g. apache or www-data.112You may specify DATA_DIR in order to create all required directories and files113under DATA_DIR folder.*�h]�h �emphasis���)��}�(hjG h]�hJ��NOTE: You must ensure the directories specified are writeable by114the user that the web server processes will be running as, e.g. apache or www-data.115You may specify DATA_DIR in order to create all required directories and files116under DATA_DIR folder.�����}�(h jK h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhjI h jE ubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKXh j! ubh �
literal_block���)��}�(hX0 LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'117SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'118SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'119STORAGE_DIR = '/var/lib/pgadmin4/storage'120AZURE_CREDENTIAL_CACHE_DIR = '/var/lib/pgadmin4/azurecredentialcache'121KERBEROS_CCACHE_DIR = '/var/lib/pgadmin4/kerberoscache'�h]�hJX0 LOG_FILE = '/var/log/pgadmin4/pgadmin4.log'122SQLITE_PATH = '/var/lib/pgadmin4/pgadmin4.db'123SESSION_DB_PATH = '/var/lib/pgadmin4/sessions'124STORAGE_DIR = '/var/lib/pgadmin4/storage'125AZURE_CREDENTIAL_CACHE_DIR = '/var/lib/pgadmin4/azurecredentialcache'126KERBEROS_CCACHE_DIR = '/var/lib/pgadmin4/kerberoscache'�����}�h j` sbah}�(h]�h]�h]�h]�h]�� xml:space��preserve��force���language��python��highlight_args�}�uhj^ h"h#hK]h j! ubeh}�(h]�h]�h]�h]�h]�uhhxh"h#hKUh j� h!hubeh}�(h]�h]�h]�h]�h]��enumtype��arabic��prefix�h�suffix��.�uhj� h j� h!hh"h#hKSubj� )��}�(hhh]�(hy)��}�(h�vRun the following command to create the configuration database:127 128.. code-block:: bash129 130 # python setup.py setup-db131�h]�(hV)��}�(h�?Run the following command to create the configuration database:�h]�hJ�?Run the following command to create the configuration database:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKfh j� ubj_ )��}�(h�# python setup.py setup-db�h]�hJ�# python setup.py setup-db�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hKhh j� ubeh}�(h]�h]�h]�h]�h]�uhhxh"h#hKfh j� h!hubhy)��}�(hXO Change the ownership of the configuration database to the user that the web server132processes will run as, for example, assuming that the web server runs as user133www-data in group www-data, and that the SQLite path is ``/var/lib/pgadmin4/pgadmin4.db``:134 135.. code-block:: bash136 137 # chown www-data:www-data /var/lib/pgadmin4/pgadmin4.db138�h]�(hV)��}�(h��Change the ownership of the configuration database to the user that the web server139processes will run as, for example, assuming that the web server runs as user140www-data in group www-data, and that the SQLite path is ``/var/lib/pgadmin4/pgadmin4.db``:�h]�(hJ��Change the ownership of the configuration database to the user that the web server141processes will run as, for example, assuming that the web server runs as user142www-data in group www-data, and that the SQLite path is �����}�(h j� h!hh"NhNubh�)��}�(h�!``/var/lib/pgadmin4/pgadmin4.db``�h]�hJ�/var/lib/pgadmin4/pgadmin4.db�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�:�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hKlh j� ubj_ )��}�(h�7# chown www-data:www-data /var/lib/pgadmin4/pgadmin4.db�h]�hJ�7# chown www-data:www-data /var/lib/pgadmin4/pgadmin4.db�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hKph j� ubeh}�(h]�h]�h]�h]�h]�uhhxh"h#hKlh j� h!hubeh}�(h]�h]�h]�h]�h]�j� j� j� hj� j� �start�Kuhj� h j� h!hh"h#hKfubeh}�(h]��python�ah]�h]��python�ah]�h]�uhh$h j[ h!hh"h#hKJubeh}�(h]��
configuration�ah]�h]��
configuration�ah]�h]�uhh$h h&h!hh"h#hKAubh%)��}�(hhh]�(h*)��}�(h�Hosting�h]�hJ�Hosting�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j h!hh"h#hKuubhV)��}�(h�[There are many possible ways to host pgAdmin in server mode. Some examples are143given below:�h]�hJ�[There are many possible ways to host pgAdmin in server mode. Some examples are144given below:�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hKwh j h!hubh%)��}�(hhh]�(h*)��}�(h�$Apache HTTPD Configuration (Windows)�h]�hJ�$Apache HTTPD Configuration (Windows)�����}�(h j$ h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j! h!hh"h#hK{ubhV)��}�(h��Once Apache HTTP has been configured to support ``mod_wsgi``, the pgAdmin145application may be configured similarly to the example below:�h]�(hJ�0Once Apache HTTP has been configured to support �����}�(h j2 h!hh"NhNubh�)��}�(h�``mod_wsgi``�h]�hJ�mod_wsgi�����}�(h j: h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j2 ubhJ�K, the pgAdmin146application may be configured similarly to the example below:�����}�(h j2 h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK}h j! h!hubj_ )��}�(h��<VirtualHost *>147 ServerName pgadmin.example.com148 WSGIScriptAlias / "C:\Program Files\pgAdmin4\web\pgAdmin4.wsgi"149 <Directory "C:\Program Files\pgAdmin4\web">150 Order deny,allow151 Allow from all152 </Directory>153</VirtualHost>�h]�hJ��<VirtualHost *>154 ServerName pgadmin.example.com155 WSGIScriptAlias / "C:\Program Files\pgAdmin4\web\pgAdmin4.wsgi"156 <Directory "C:\Program Files\pgAdmin4\web">157 Order deny,allow158 Allow from all159 </Directory>160</VirtualHost>�����}�h jR sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �apache�js }�uhj^ h"h#hK�h j! h!hubhV)��}�(h��Now open the file ``C:\Program Files\pgAdmin4\web\pgAdmin4.wsgi`` with your favorite editor and add the code161below which will activate Python virtual environment when Apache server runs.�h]�(hJ�Now open the file �����}�(h jb h!hh"NhNubh�)��}�(h�/``C:\Program Files\pgAdmin4\web\pgAdmin4.wsgi``�h]�hJ�+C:\Program Files\pgAdmin4\web\pgAdmin4.wsgi�����}�(h jj h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h jb ubhJ�y with your favorite editor and add the code162below which will activate Python virtual environment when Apache server runs.�����}�(h jb h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j! h!hubj_ )��}�(h�jactivate_this = 'C:\Program Files\pgAdmin4\venv\Scripts\activate_this.py'163exec(open(activate_this).read())�h]�hJ�jactivate_this = 'C:\Program Files\pgAdmin4\venv\Scripts\activate_this.py'164exec(open(activate_this).read())�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �python�js }�uhj^ h"h#hK�h j! h!hubhV)��}�(h�p**Note:** The changes made in ``pgAdmin4.wsgi`` file will revert when pgAdmin4 is either upgraded or downgraded.�h]�(j� )��}�(h� **Note:**�h]�hJ�Note:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhj� h j� ubhJ� The changes made in �����}�(h j� h!hh"NhNubh�)��}�(h�``pgAdmin4.wsgi``�h]�hJ�
pgAdmin4.wsgi�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�A file will revert when pgAdmin4 is either upgraded or downgraded.�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j! h!hubeh}�(h]��"apache-httpd-configuration-windows�ah]�h]��$apache httpd configuration (windows)�ah]�h]�uhh$h j h!hh"h#hK{ubh%)��}�(hhh]�(h*)��}�(h�'Apache HTTPD Configuration (Linux/Unix)�h]�hJ�'Apache HTTPD Configuration (Linux/Unix)�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j� h!hh"h#hK�ubhV)��}�(h��Once Apache HTTP has been configured to support ``mod_wsgi``, the pgAdmin165application may be configured similarly to the example below:�h]�(hJ�0Once Apache HTTP has been configured to support �����}�(h j� h!hh"NhNubh�)��}�(h�``mod_wsgi``�h]�hJ�mod_wsgi�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ�K, the pgAdmin166application may be configured similarly to the example below:�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(hX� <VirtualHost *>167 ServerName pgadmin.example.com168 169 WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/path/to/python/virtualenv170 WSGIScriptAlias / /opt/pgAdmin4/web/pgAdmin4.wsgi171 172 <Directory /opt/pgAdmin4/web>173 WSGIProcessGroup pgadmin174 WSGIApplicationGroup %{GLOBAL}175 Order deny,allow176 Allow from all177 </Directory>178</VirtualHost>�h]�hJX� <VirtualHost *>179 ServerName pgadmin.example.com180 181 WSGIDaemonProcess pgadmin processes=1 threads=25 python-home=/path/to/python/virtualenv182 WSGIScriptAlias / /opt/pgAdmin4/web/pgAdmin4.wsgi183 184 <Directory /opt/pgAdmin4/web>185 WSGIProcessGroup pgadmin186 WSGIApplicationGroup %{GLOBAL}187 Order deny,allow188 Allow from all189 </Directory>190</VirtualHost>�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �apache�js }�uhj^ h"h#hK�h j� h!hubhV)��}�(h�G**Note:** If you're using Apache HTTPD 2.4 or later, replace the lines:�h]�(j� )��}�(h� **Note:**�h]�hJ�Note:�����}�(h j
h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhj� h j ubhJ�@ If you’re using Apache HTTPD 2.4 or later, replace the lines:�����}�(h j h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h�Order deny,allow191Allow from all�h]�hJ�Order deny,allow192Allow from all�����}�h j% sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �apache�js }�uhj^ h"h#hK�h j� h!hubhV)��}�(h�with:�h]�hJ�with:�����}�(h j5 h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h�Require all granted�h]�hJ�Require all granted�����}�h jC sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �apache�js }�uhj^ h"h#hK�h j� h!hubhV)��}�(h�:Adjust as needed to suit your access control requirements.�h]�hJ�:Adjust as needed to suit your access control requirements.�����}�(h jS h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubeh}�(h]��%apache-httpd-configuration-linux-unix�ah]�h]��'apache httpd configuration (linux/unix)�ah]�h]�uhh$h j h!hh"h#hK�ubh%)��}�(hhh]�(h*)��}�(h�!Standalone Gunicorn Configuration�h]�hJ�!Standalone Gunicorn Configuration�����}�(h jl h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h ji h!hh"h#hK�ubhV)��}�(h��pgAdmin may be hosted by Gunicorn directly simply by running a command such as193the one shown below. Note that this example assumes pgAdmin was installed using194the Python Wheel (you may need to adjust the path to suit your installation):�h]�hJ��pgAdmin may be hosted by Gunicorn directly simply by running a command such as195the one shown below. Note that this example assumes pgAdmin was installed using196the Python Wheel (you may need to adjust the path to suit your installation):�����}�(h jz h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h ji h!hubj_ )��}�(h��gunicorn --bind 0.0.0.0:80 \197 --workers=1 \198 --threads=25 \199 --chdir /usr/lib/python3.7/dist-packages/pgadmin4 \200 pgAdmin4:app�h]�hJ��gunicorn --bind 0.0.0.0:80 \201 --workers=1 \202 --threads=25 \203 --chdir /usr/lib/python3.7/dist-packages/pgadmin4 \204 pgAdmin4:app�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hK�h ji h!hubeh}�(h]��!standalone-gunicorn-configuration�ah]�h]��!standalone gunicorn configuration�ah]�h]�uhh$h j h!hh"h#hK�ubh%)��}�(hhh]�(h*)��}�(h�Standalone uWSGI Configuration�h]�hJ�Standalone uWSGI Configuration�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j� h!hh"h#hK�ubhV)��}�(h��pgAdmin may be hosted by uWSGI directly simply by running a command such as205the one shown below. Note that this example assumes pgAdmin was installed using206the Python Wheel (you may need to adjust the path to suit your installation):�h]�hJ��pgAdmin may be hosted by uWSGI directly simply by running a command such as207the one shown below. Note that this example assumes pgAdmin was installed using208the Python Wheel (you may need to adjust the path to suit your installation):�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h��uwsgi --http-socket 0.0.0.0:80 \209 --processes 1 \210 --threads 25 \211 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \212 --mount /=pgAdmin4:app�h]�hJ��uwsgi --http-socket 0.0.0.0:80 \213 --processes 1 \214 --threads 25 \215 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \216 --mount /=pgAdmin4:app�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hK�h j� h!hubeh}�(h]��standalone-uwsgi-configuration�ah]�h]��standalone uwsgi configuration�ah]�h]�uhh$h j h!hh"h#hK�ubh%)��}�(hhh]�(h*)��}�(h�!NGINX Configuration with Gunicorn�h]�hJ�!NGINX Configuration with Gunicorn�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j� h!hh"h#hK�ubhV)��}�(h��pgAdmin can be hosted by Gunicorn, with NGINX in front of it. Note that these217examples assume pgAdmin was installed using the Python Wheel (you may need to218adjust the path to suit your installation).�h]�hJ��pgAdmin can be hosted by Gunicorn, with NGINX in front of it. Note that these219examples assume pgAdmin was installed using the Python Wheel (you may need to220adjust the path to suit your installation).�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubhV)��}�(h�cTo run with pgAdmin in the root directory of the server, start Gunicorn using a221command similar to:�h]�hJ�cTo run with pgAdmin in the root directory of the server, start Gunicorn using a222command similar to:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h��gunicorn --bind unix:/tmp/pgadmin4.sock \223 --workers=1 \224 --threads=25 \225 --chdir /usr/lib/python3.7/dist-packages/pgadmin4 \226 pgAdmin4:app�h]�hJ��gunicorn --bind unix:/tmp/pgadmin4.sock \227 --workers=1 \228 --threads=25 \229 --chdir /usr/lib/python3.7/dist-packages/pgadmin4 \230 pgAdmin4:app�����}�h j sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hK�h j� h!hubhV)��}�(h�And configure NGINX:�h]�hJ�And configure NGINX:�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h�Wlocation / {231 include proxy_params;232 proxy_pass http://unix:/tmp/pgadmin4.sock;233}�h]�hJ�Wlocation / {234 include proxy_params;235 proxy_pass http://unix:/tmp/pgadmin4.sock;236}�����}�h j" sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �nginx�js }�uhj^ h"h#hK�h j� h!hubhV)��}�(h��Alternatively, pgAdmin can be hosted in a sub-directory (/pgadmin4 in this case)237on the server. Start Gunicorn as when using the root directory, but configure238NGINX as follows:�h]�hJ��Alternatively, pgAdmin can be hosted in a sub-directory (/pgadmin4 in this case)239on the server. Start Gunicorn as when using the root directory, but configure240NGINX as follows:�����}�(h j2 h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hK�h j� h!hubj_ )��}�(h��location /pgadmin4/ {241 include proxy_params;242 proxy_pass http://unix:/tmp/pgadmin4.sock;243 proxy_set_header X-Script-Name /pgadmin4;244}�h]�hJ��location /pgadmin4/ {245 include proxy_params;246 proxy_pass http://unix:/tmp/pgadmin4.sock;247 proxy_set_header X-Script-Name /pgadmin4;248}�����}�h j@ sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �nginx�js }�uhj^ h"h#hK�h j� h!hubeh}�(h]��!nginx-configuration-with-gunicorn�ah]�h]��!nginx configuration with gunicorn�ah]�h]�uhh$h j h!hh"h#hK�ubh%)��}�(hhh]�(h*)��}�(h�NGINX Configuration with uWSGI�h]�hJ�NGINX Configuration with uWSGI�����}�(h j[ h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h jX h!hh"h#hM ubhV)��}�(h��pgAdmin can be hosted by uWSGI, with NGINX in front of it. Note that these249examples assume pgAdmin was installed using the Python Wheel (you may need to250adjust the path to suit your installation).�h]�hJ��pgAdmin can be hosted by uWSGI, with NGINX in front of it. Note that these251examples assume pgAdmin was installed using the Python Wheel (you may need to252adjust the path to suit your installation).�����}�(h ji h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hMh jX h!hubhV)��}�(h�`To run with pgAdmin in the root directory of the server, start uWSGI using a253command similar to:�h]�hJ�`To run with pgAdmin in the root directory of the server, start uWSGI using a254command similar to:�����}�(h jw h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hMh jX h!hubj_ )��}�(h��uwsgi --socket /tmp/pgadmin4.sock \255 --processes 1 \256 --threads 25 \257 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \258 --manage-script-name \259 --mount /=pgAdmin4:app�h]�hJ��uwsgi --socket /tmp/pgadmin4.sock \260 --processes 1 \261 --threads 25 \262 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \263 --manage-script-name \264 --mount /=pgAdmin4:app�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hM h jX h!hubhV)��}�(h�And configure NGINX:�h]�hJ�And configure NGINX:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hMh jX h!hubj_ )��}�(h��location / { try_files $uri @pgadmin4; }265location @pgadmin4 {266 include uwsgi_params;267 uwsgi_pass unix:/tmp/pgadmin4.sock;268}�h]�hJ��location / { try_files $uri @pgadmin4; }269location @pgadmin4 {270 include uwsgi_params;271 uwsgi_pass unix:/tmp/pgadmin4.sock;272}�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �nginx�js }�uhj^ h"h#hMh jX h!hubhV)��}�(h��Alternatively, pgAdmin can be hosted in a sub-directory (/pgadmin4 in this case)273on the server. Start uWSGI, noting that the directory name is specified in the274``mount`` parameter:�h]�(hJ��Alternatively, pgAdmin can be hosted in a sub-directory (/pgadmin4 in this case)275on the server. Start uWSGI, noting that the directory name is specified in the276�����}�(h j� h!hh"NhNubh�)��}�(h� ``mount``�h]�hJ�mount�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh�h j� ubhJ� parameter:�����}�(h j� h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hMh jX h!hubj_ )��}�(h��uwsgi --socket /tmp/pgadmin4.sock \277 --processes 1 \278 --threads 25 \279 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \280 --manage-script-name \281 --mount /pgadmin4=pgAdmin4:app�h]�hJ��uwsgi --socket /tmp/pgadmin4.sock \282 --processes 1 \283 --threads 25 \284 --chdir /usr/lib/python3.7/dist-packages/pgadmin4/ \285 --manage-script-name \286 --mount /pgadmin4=pgAdmin4:app�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �bash�js }�uhj^ h"h#hM h jX h!hubhV)��}�(h�Then, configure NGINX:�h]�hJ�Then, configure NGINX:�����}�(h j� h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh"h#hM)h jX h!hubj_ )��}�(h��location = /pgadmin4 { rewrite ^ /pgadmin4/; }287location /pgadmin4 { try_files $uri @pgadmin4; }288location @pgadmin4 {289 include uwsgi_params;290 uwsgi_pass unix:/tmp/pgadmin4.sock;291}�h]�hJ��location = /pgadmin4 { rewrite ^ /pgadmin4/; }292location /pgadmin4 { try_files $uri @pgadmin4; }293location @pgadmin4 {294 include uwsgi_params;295 uwsgi_pass unix:/tmp/pgadmin4.sock;296}�����}�h j� sbah}�(h]�h]�h]�h]�h]�jn jo jp �jq �nginx�js }�uhj^ h"h#hM+h jX h!hubeh}�(h]��nginx-configuration-with-uwsgi�ah]�h]��nginx configuration with uwsgi�ah]�h]�uhh$h j h!hh"h#hM ubh%)��}�(hhh]�(h*)��}�(h�Additional Information�h]�hJ�Additional Information�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhh)h j h!hh"h#hM5ubh �note���)��}�(hX\ pgAdmin will spawn additional Python processes from time to time, and297relies on the *sys.executable* variable in Python to do this. In some cases,298you may need to override that value to ensure the correct interpreter is299used, instead of the WSGI host process. For example, uWSGI offers the300*--py-sys-executable* command line option to achieve this.�h]�hV)��}�(hX\ pgAdmin will spawn additional Python processes from time to time, and301relies on the *sys.executable* variable in Python to do this. In some cases,302you may need to override that value to ensure the correct interpreter is303used, instead of the WSGI host process. For example, uWSGI offers the304*--py-sys-executable* command line option to achieve this.�h]�(hJ�TpgAdmin will spawn additional Python processes from time to time, and305relies on the �����}�(h j h!hh"NhNubjJ )��}�(h�*sys.executable*�h]�hJ�sys.executable�����}�(h j( h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhjI h j ubhJ�� variable in Python to do this. In some cases,306you may need to override that value to ensure the correct interpreter is307used, instead of the WSGI host process. For example, uWSGI offers the308�����}�(h j h!hh"NhNubjJ )��}�(h�*--py-sys-executable*�h]�hJ�–py-sys-executable�����}�(h j: h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhjI h j ubhJ�% command line option to achieve this.�����}�(h j h!hh"NhNubeh}�(h]�h]�h]�h]�h]�uhhUh"h#hM7h j ubah}�(h]�h]�h]�h]�h]�uhj h"h#hM7h j h!hubeh}�(h]��additional-information�ah]�h]��additional information�ah]�h]�uhh$h j h!hh"h#hM5ubeh}�(h]��hosting�ah]�h]��hosting�ah]�h]�uhh$h h&h!hh"h#hKuubeh}�(h]�(h�id1�eh]�h]�(�server deployment��server_deployment�eh]�h]�uhh$h hh!hh"h#hK�expect_referenced_by_name�}�jn hs�expect_referenced_by_id�}�hhsubeh}�(h]�h]�h]�h]�h]��source�h#�translation_progress�}�(�total�K �309translated�K uuhh�current_source�N�current_line�N�settings��docutils.frontend��Values���)��}�(�output�Nh)N� generator�N� datestamp�N�root_prefix��/��source_link�N�310source_url�N�
toc_backlinks��entry��footnote_backlinks���
sectnum_xform���strip_comments�N�strip_elements_with_classes�N�
strip_classes�N�report_level�K�311halt_level�K�exit_status_level�K�debug�N�warning_stream�N� traceback���input_encoding�� utf-8-sig��input_encoding_error_handler��strict��output_encoding��utf-8��output_encoding_error_handler�j� �error_encoding��cp1252��error_encoding_error_handler��backslashreplace��
language_code��en��record_dependencies�N�config�N� id_prefix�h�auto_id_prefix��id��
dump_settings�N�dump_internals�N�dump_transforms�N�dump_pseudo_xml�N�expose_internals�N�strict_visitor�N�_disable_config�N�_source�h#�_destination�N�
_config_files�]��file_insertion_enabled���raw_enabled�K�line_length_limit�M'�pep_references�N�pep_base_url��https://peps.python.org/��pep_file_url_template��pep-%04d��rfc_references�N�rfc_base_url��&https://datatracker.ietf.org/doc/html/�� tab_width�K�trim_footnote_reference_space���syntax_highlight��long��smart_quotes���smartquotes_locales�]��character_level_inline_markup���doctitle_xform���
docinfo_xform���sectsubtitle_xform���
image_loading��link��embed_stylesheet���cloak_email_addresses���section_self_link���env�Nub�reporter�N�indirect_targets�]��substitution_defs�}��substitution_names�}��refnames�}��refids�}�h]�has�nameids�}�(jn hjm jj j} jz jX jU j� j� j� j� je jb j� j� jf jc j� j� j� j� jU jR j j j] jZ u� nametypes�}�(jn �jm �j} �jX �j� �j� �je �j� �jf �j� �j� �jU �j �j] �uh}�(hh&jj h&jz jt jU j� j� j[ j� j� jb j j� j! jc j� j� ji j� j� jR j� j jX jZ j u�
footnote_refs�}��
citation_refs�}��
autofootnotes�]��autofootnote_refs�]��symbol_footnotes�]��symbol_footnote_refs�]�� footnotes�]�� citations�]��autofootnote_start�K�symbol_footnote_start�K �312id_counter��collections��Counter���}�j� Ks��R��parse_messages�]�h �system_message���)��}�(hhh]�hV)��}�(h�:Enumerated list start value not ordinal-1: "4" (ordinal 4)�h]�hJ�>Enumerated list start value not ordinal-1: “4” (ordinal 4)�����}�(h j h!hh"NhNubah}�(h]�h]�h]�h]�h]�uhhUh j ubah}�(h]�h]�h]�h]�h]��level�K�type��INFO��source�h#�line�Kuhj h j� h!hh"h#hKfuba�transform_messages�]�(j )��}�(hhh]�hV)��}�(hhh]�hJ�7Hyperlink target "server-deployment" is not referenced.�����}�h j$ sbah}�(h]�h]�h]�h]�h]�uhhUh j! ubah}�(h]�h]�h]�h]�h]��level�K�type�j �source�h#�line�Kuhj ubj )��}�(hhh]�hV)��}�(hhh]�hJ�-Hyperlink target "index-0" is not referenced.�����}�h j> sbah}�(h]�h]�h]�h]�h]�uhhUh j; ubah}�(h]�h]�h]�h]�h]��level�K�type�j �source�h#�line�Kuhj ube�transformer�N�include_log�]��313decoration�Nh!hub.