pgAdmin4 as web application on CentOS

From: Olav Peeters <opeeters(at)gmail(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: pgAdmin4 as web application on CentOS
Date: 2016-10-05 10:08:25
Message-ID: 1475662105354-5924512.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi,
I installed pgAdmin4 as follows on CentOS 7:
yum install
https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm

yum install pgadmin4 httpd mod_wsgi
(on CentOS 7 this means httpd 2.4.6, mod_wsgi 3.4-12 and pgadmin4 1.0-1)

This does not install pgAdmin4.wsgi to the location as specified in:
https://www.pgadmin.org/docs4/dev/server_deployment.html#apache-httpd-configuration-linux-unix

pgAdmin4.wsgi can be found here:
/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi

Hence I changed the httpd configuration to:

<VirtualHost *>
ServerName our.server.com

WSGIDaemonProcess pgadmin processes=1 threads=25
WSGIScriptAlias /
/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi

<Directory /usr/lib/python2.7/site-packages/pgadmin4-web>
WSGIProcessGroup pgadmin
WSGIApplicationGroup %{GLOBAL}
Require all granted
</Directory>
</VirtualHost>

After restarting the httpd there is an error in /var/log/httpd/error_log
concerning write access to /usr/share/httpd/.pgadmin. Hence I did:
chown -R apache:apache /usr/share/httpd since all was root:root before.
So far so good, but when I restart httpd and try to access pgadmin via
our.server.com I get the following in /var/log/httpd/error_log:

[Wed Oct 05 11:59:44.815735 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] mod_wsgi (pid=3771): Target WSGI script
'/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi' cannot be
loaded as Python module.
[Wed Oct 05 11:59:44.815797 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] mod_wsgi (pid=3771): Exception occurred processing
WSGI script '/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Wed Oct 05 11:59:44.815821 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] Traceback (most recent call last):
[Wed Oct 05 11:59:44.815839 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi", line 8, in
<module>
[Wed Oct 05 11:59:44.815906 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] from pgAdmin4 import app as application
[Wed Oct 05 11:59:44.815916 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.py", line 58, in
<module>
[Wed Oct 05 11:59:44.815965 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] app = create_app()
[Wed Oct 05 11:59:44.815974 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib/python2.7/site-packages/pgadmin4-web/pgadmin/__init__.py", line
213, in create_app
[Wed Oct 05 11:59:44.816083 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] version =
Version.query.filter_by(name='ConfigDB').first()
[Wed Oct 05 11:59:44.816093 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2659, in
first
[Wed Oct 05 11:59:44.816768 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] ret = list(self[0:1])
[Wed Oct 05 11:59:44.816783 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2457, in
__getitem__
[Wed Oct 05 11:59:44.816799 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] return list(res)
[Wed Oct 05 11:59:44.816805 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2761, in
__iter__
[Wed Oct 05 11:59:44.816813 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] return self._execute_and_instances(context)
[Wed Oct 05 11:59:44.816819 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/orm/query.py", line 2776, in
_execute_and_instances
[Wed Oct 05 11:59:44.816827 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] result = conn.execute(querycontext.statement,
self._params)
[Wed Oct 05 11:59:44.816832 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in
execute
[Wed Oct 05 11:59:44.817478 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] return meth(self, multiparams, params)
[Wed Oct 05 11:59:44.817497 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323,
in _execute_on_connection
[Wed Oct 05 11:59:44.818162 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] return connection._execute_clauseelement(self,
multiparams, params)
[Wed Oct 05 11:59:44.818174 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010,
in _execute_clauseelement
[Wed Oct 05 11:59:44.818214 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] compiled_sql, distilled_params
[Wed Oct 05 11:59:44.818225 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146,
in _execute_context
[Wed Oct 05 11:59:44.818234 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] context)
[Wed Oct 05 11:59:44.818239 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1341,
in _handle_dbapi_exception
[Wed Oct 05 11:59:44.818247 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] exc_info
[Wed Oct 05 11:59:44.818252 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/util/compat.py", line 202, in
raise_from_cause
[Wed Oct 05 11:59:44.818329 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] reraise(type(exception), exception, tb=exc_tb,
cause=cause)
[Wed Oct 05 11:59:44.818338 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139,
in _execute_context
[Wed Oct 05 11:59:44.818349 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] context)
[Wed Oct 05 11:59:44.818354 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] File
"/usr/lib64/python2.7/site-packages/sqlalchemy/engine/default.py", line 450,
in do_execute
[Wed Oct 05 11:59:44.818545 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] cursor.execute(statement, parameters)
[Wed Oct 05 11:59:44.818611 2016] [:error] [pid 3771] [remote
ip-of-our-server:188] OperationalError: (sqlite3.OperationalError) no such
table: version [SQL: u'SELECT version.name AS version_name, version.value AS
version_value \\nFROM version \\nWHERE version.name = ?\\n LIMIT ? OFFSET
?'] [parameters: ('ConfigDB', 1, 0)]

The file /usr/lib/python2.7/site-packages/pgadmin4-web/pgAdmin4.wsgi
contains the following:

import os
import sys

root = os.path.dirname(os.path.realpath(__file__))
if sys.path[0] != root:
sys.path.insert(0, root)

from pgAdmin4 import app as application

Am I missing something obvious? Is pgadmin4 maybe not ready yet to be
installed this way? Should I rather install from source?

Cheers,
Olav

--
View this message in context: http://postgresql.nabble.com/pgAdmin4-as-web-application-on-CentOS-tp5924512.html
Sent from the PostgreSQL - pgadmin hackers mailing list archive at Nabble.com.

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2016-10-05 12:05:14 pgAdmin 4 commit: Fix SSL setup. Fixes #1817
Previous Message Murtuza Zabuawala 2016-10-05 08:53:26 PATCH: To fix issue in synonym node (pgAdmin4)