Re: pgadmin4 running behind nginx

From: jbiskofski <jbiskofski(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: rhuddbiz <rhuddbiz(at)gmail(dot)com>, pgAdmin Support <pgadmin-support(at)postgresql(dot)org>
Subject: Re: pgadmin4 running behind nginx
Date: 2017-04-04 15:39:08
Message-ID: CAHpPzY4G+bwgjkR2NBRtf-2AFt4gks6_Fxnd3He2nQtTMnjwEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

this is how I got it to work :

VHOST FILE
==========

*server {*

*listen *:443 ssl;*

*server_name pg.YOURDOMAIN.com <http://pg.YOURDOMAIN.com>;*

* include /usr/local/nginx/conf/ssl.conf;*

* include /usr/local/nginx/conf/proxies.conf;*

* location / {*

* proxy_pass http://pgadmin-backend <http://pgadmin-backend>;*

* proxy_next_upstream error timeout http_500 http_502;*

* proxy_set_header X-Real-IP $remote_addr; *

* proxy_set_header X-Forwarded-For $remote_addr;*

* proxy_set_header Host $host;*

* proxy_redirect http:// https://;*

* }*

*}*

IN ANOTHER FILE ( in my case its called backends.conf )

============================================

*upstream pgadmin-backend {*

* server 127.0.0.1:8080 <http://127.0.0.1:8080>;*

* server 127.0.0.1:8080 <http://127.0.0.1:8080> backup;*

* server 127.0.0.1:8080 <http://127.0.0.1:8080> backup;*

* server 127.0.0.1:8080 <http://127.0.0.1:8080> backup;*

*}*

*=========================================*

I dont know why but pgadmin sometimes fails in retrieving static content (
css, js, etc ) that it serves from python somehow. If one of these files
fails to load the whole application becomes unresponsive.

I basically set it up so if it failes it retries again 3 times ( thats why
I have 127.0.0.1 as a backup backend 3 times ). I know its ugly and its
hacky, but it works.

Hope this helps.

- Jose

On Tue, Apr 4, 2017 at 1:44 AM, Dave Page <dpage(at)pgadmin(dot)org> wrote:

> On Tue, Apr 4, 2017 at 12:19 AM, rhuddbiz <rhuddbiz(at)gmail(dot)com> wrote:
> > well, setting APPLICATION_ROOT did not work. i know i have the
> > config_local.py setup correctly because i am able to configure
> > DEFAULT_SERVER. i think i see where you came up with APPLICATION_ROOT
> param,
> > http://flask.pocoo.org/docs/0.12/config/. unfortunately, it looks like
> > pgAdmin4.py does not make use of / pass that param. this appears to be
> the
> > relevant content of pgAdmin4.py that would include that param.
> > app.run(
> > host=config.DEFAULT_SERVER,
> > port=server_port,
> > use_reloader=((not PGADMIN_RUNTIME) and app.debug),
> > threaded=config.THREADED_MODE
> > )
> > . so i guess the default pgAdmin4.py is a no go . i'll have to go
> through
> > the process of setting up a uWSGI server.
>
> Flask has access to the entire config (it'll ignore the pgAdmin
> specific parts). This is handled in web/pgadmin/__init__.py, around
> line 144:
>
> app.config.from_object(config)
> app.config.update(dict(PROPAGATE_EXCEPTIONS=True))
>
> I don't know why it's ignoring it - but as I said upthread, I've never
> had to use it. It just works with Apache HTTPD (as intended).
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> --
> Sent via pgadmin-support mailing list (pgadmin-support(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-support
>

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Barter 2017-04-04 21:27:37 PGAgent Question
Previous Message Pierre Racine 2017-04-04 13:59:41 pgAdmin III Total query runtime back in microseconds (repost)