Re: Install pgadmin4 on Fedora 30 - Mailing list pgadmin-support

From Michael Monerau
Subject Re: Install pgadmin4 on Fedora 30
Date
Msg-id CAOpvgNcXcS7NCc6Kd8g7vX52TDYc=+cmS655jwNVWDi+Mo7=8w@mail.gmail.com
Whole thread Raw
In response to Re: Install pgadmin4 on Fedora 30  (Michael Monerau <michael.monerau@gmail.com>)
Responses Re: Install pgadmin4 on Fedora 30  (Murtuza Zabuawala <murtuza.zabuawala@enterprisedb.com>)
List pgadmin-support
Well, the performance issue seems to be gone.

The only thing I can think of that would have solved the issue is I added the following to pg_hba.conf:
local all postgres md5
host all postgres md5

and restart the postgresql service.

Hope it really fixed the issue and it can help somebody going through that also.
(but Chrome still broken FYI).

Best,
Michael


Le jeu. 23 mai 2019 à 20:35, Michael Monerau <michael.monerau@gmail.com> a écrit :
Ok, found the issue (but now am stuck with a big performance issue, see below).

It had to do with SELinux, which was blocking the access to the files because they are not decorated with the proper types. Based on the results from `/var/log/audit/audit.log` and the actual types of /var/lib/httpd and /var/log/httpd, I did the following, which could be useful to incorporate in the install script (or put in a README somewhere?):

```
sudo setsebool -P httpd_can_network_connect 1
sudo setsebool -P httpd_can_network_connect_db 1
sudo semanage fcontext -a -t httpd_var_lib_t '/var/lib/pgadmin(/.*)?'
sudo restorecon -R -v /var/lib/pgadmin
sudo semanage fcontext -a -t httpd_log_t '/var/log/pgadmin(/.*)?'
sudo restorecon -R -v /var/log/pgadmin
```

And now localhost/pgadmin4 properly loads.

Unfortunately, I run into 2 new issues:
  - The module doesn't work on Chrome (stays on the login page, 302 redirections seem to stay stuck on the login page). But works ok in Firefox.
  - In Firefox, when connecting to the database, it takes forever to open the tree elements, and times out after a few minutes. But the databases are correctly recognized. I'm not sure how to investigate this issue. Any idea? I see this thread, but can't find a solution in it (https://www.postgresql-archive.org/quot-pgadmin4-quot-slow-td5966570.html). I'm interested to help debunk the issue. Note if it helps: pgadmin3 works well.

Best,
Michael

Le jeu. 23 mai 2019 à 19:20, Michael Monerau <michael.monerau@gmail.com> a écrit :
Hi,

Thanks for the quick update!
Unfortunately, it still gives the errors below on my Fedora 30 in the httpd error log.

I tried to understand what's going on, but in vain.
I verified that the python script correctly runs as `apache` user, it does. If I try to chmod through command line myself as the `apache` user, it works ok (as it should!). But somehow, it fails when called from inside the wsgi.

I guess this has to do with some Apache config that I have different from you by default?
Does anybody know where to look to find this config?

Thanks,
Michael

###
[Thu May 23 18:35:18.258836 2019] [core:notice] [pid 7402:tid 139830674198848] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu May 23 18:35:18.260143 2019] [suexec:notice] [pid 7402:tid 139830674198848] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu May 23 18:35:18.269186 2019] [so:warn] [pid 7402:tid 139830674198848] AH01574: module wsgi_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
[Thu May 23 18:35:18.270012 2019] [lbmethod_heartbeat:notice] [pid 7402:tid 139830674198848] AH02282: No slotmem from mod_heartmonitor
[Thu May 23 18:35:18.270343 2019] [http2:warn] [pid 7402:tid 139830674198848] AH02951: mod_ssl does not seem to be enabled
[Thu May 23 18:35:18.272382 2019] [mpm_event:notice] [pid 7402:tid 139830674198848] AH00489: Apache/2.4.39 (Fedora) mod_wsgi/4.6.4 Python/3.7 configured -- resuming normal operations
[Thu May 23 18:35:18.272394 2019] [core:notice] [pid 7402:tid 139830674198848] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Thu May 23 18:35:18.274994 2019] [:warn] [pid 7404:tid 139830674198848] ./mod_dnssd.c: No services found to register
[Thu May 23 18:35:33.021413 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386] mod_wsgi (pid=7405): Failed to exec Python script file '/usr/lib/python3.7/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Thu May 23 18:35:33.021446 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386] mod_wsgi (pid=7405): Exception occurred processing WSGI script '/usr/lib/python3.7/site-packages/pgadmin4-web/pgAdmin4.wsgi'.
[Thu May 23 18:35:33.021736 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386] Traceback (most recent call last):
[Thu May 23 18:35:33.021754 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]   File "/usr/lib/python3.7/site-packages/pgadmin4-web/pgAdmin4.wsgi", line 36, in <module>
[Thu May 23 18:35:33.021758 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]     from pgAdmin4 import app as application
[Thu May 23 18:35:33.021761 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]   File "/usr/lib/python3.7/site-packages/pgadmin4-web/pgAdmin4.py", line 97, in <module>
[Thu May 23 18:35:33.021763 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]     app = create_app()
[Thu May 23 18:35:33.021765 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]   File "/usr/lib/python3.7/site-packages/pgadmin4-web/pgadmin/__init__.py", line 241, in create_app
[Thu May 23 18:35:33.021768 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]     create_app_data_directory(config)
[Thu May 23 18:35:33.021770 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]   File "/usr/lib/python3.7/site-packages/pgadmin4-web/pgadmin/setup/data_directory.py", line 24, in create_app_data_directory
[Thu May 23 18:35:33.021773 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386]     os.chmod(os.path.dirname(config.SQLITE_PATH), 0o700)
[Thu May 23 18:35:33.021790 2019] [wsgi:error] [pid 7405:tid 139830615561984] [remote 127.0.0.1:45386] PermissionError: [Errno 13] Permission denied: '/var/lib/pgadmin'
###

Le jeu. 23 mai 2019 à 10:33, Devrim Gündüz <devrim@gunduz.org> a écrit :

Hi Michael,

On Wed, 2019-05-22 at 14:29 +0200, Michael Monerau wrote:

> I went through the install process you describe on your website (
> https://people.planetpostgresql.org/devrim/index.php?/archives/96-Installing-pgAdmin4-3.X-on-RHEL-CentOS-7-and-Fedora-27.html)
> but couldn't get it to work.
>
> 1. Small typo in the install script pgadmin4-web-setup.sh: PGADMIN4INSTDIR
> is not known (miss a `$`). I replaced with the full path of the install on
> my system (/usr/lib/python3.7/site-packages/pgadmin4-web/) but I guess
> there is a cleaner way to be more general in the install.
>
> 2. The webserver fails to serve the website, and I get that from httpd log:

<snip>

Just pushed 4.6-2 packages to repos, which should fix this issue (at least it
fixed on my Fedora 30 box).

They will be available in 1 hour from now.

Regards,
--
Devrim Gündüz
Open Source Solution Architect, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

pgadmin-support by date:

Previous
From: Michael Monerau
Date:
Subject: Re: Install pgadmin4 on Fedora 30
Next
From: Murtuza Zabuawala
Date:
Subject: Re: Install pgadmin4 on Fedora 30