Quantcast

Some questions about configuration and the pgadmin4-v1-web package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Some questions about configuration and the pgadmin4-v1-web package

Josh Berkus-6
pgAdmin team, Devrim:

If I install the pgadmin4-v1-web package from Yum, it's a bit unclear on
what actual configuration needs to be done after that. Things I know
need to be done:

* running setup.py
* copying the httpd/conf.d/pgadmin4-web.conf.example file to a .conf file

Things I don't know if they need to be done:

1. creating data and log directories and assigning permissions on them
2. changing the permissions on the sqlite db
3. creating a config_local.py file and setting the five settings in it

Can you clarify?  I'm working on a container, and I'll also be happy to
contribute a doc if you can clarify via email.  Thanks.

--
Josh Berkus
Containers & Databases Oh My!


--
Sent via pgadmin-hackers mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Some questions about configuration and the pgadmin4-v1-web package

Dave Page-7


On Thu, Apr 20, 2017 at 9:50 PM, Josh Berkus <[hidden email]> wrote:
pgAdmin team, Devrim:

If I install the pgadmin4-v1-web package from Yum, it's a bit unclear on
what actual configuration needs to be done after that. Things I know
need to be done:

* running setup.py
* copying the httpd/conf.d/pgadmin4-web.conf.example file to a .conf file

Things I don't know if they need to be done:

1. creating data and log directories and assigning permissions on them
2. changing the permissions on the sqlite db
3. creating a config_local.py file and setting the five settings in it

Can you clarify?  I'm working on a container, and I'll also be happy to
contribute a doc if you can clarify via email.  Thanks.

I don't know how much of that work is done by the RPMs, so Devrim will need to chime in on this one. I suspect you will need to do 1-3 though.

For a source/pip installation (would a pure Python installation be a better basis for a container?), the docs at https://www.pgadmin.org/docs4/1.x/server_deployment.html should cover everything (patches to improve are always welcome of course).

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Some questions about configuration and the pgadmin4-v1-web package

Devrim GÜNDÜZ
In reply to this post by Josh Berkus-6

Hi Josh,

On Thu, 2017-04-20 at 13:50 -0700, Josh Berkus wrote:

> If I install the pgadmin4-v1-web package from Yum, it's a bit unclear on
> what actual configuration needs to be done after that. Things I know
> need to be done:
>
> * running setup.py
> * copying the httpd/conf.d/pgadmin4-web.conf.example file to a .conf file
>
> Things I don't know if they need to be done:
>
> 1. creating data and log directories and assigning permissions on them
> 2. changing the permissions on the sqlite db
> 3. creating a config_local.py file and setting the five settings in it
>
> Can you clarify?  
On RHEL 7 / Fedora 25:

* systemctl enable pgadmin4-v1.service; systemctl start pgadmin4-v1.service
* cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
v1.conf
* systemctl start httpd.service

should be enough, at least this is what I just tested on my Fedora 25 box.

Regards,

--
Devrim Gündüz
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Some questions about configuration and the pgadmin4-v1-web package

Josh Berkus-6
On 04/21/2017 01:57 AM, Devrim Gündüz wrote:

>
> Hi Josh,
>
> On Thu, 2017-04-20 at 13:50 -0700, Josh Berkus wrote:
>> If I install the pgadmin4-v1-web package from Yum, it's a bit unclear on
>> what actual configuration needs to be done after that. Things I know
>> need to be done:
>>
>> * running setup.py
>> * copying the httpd/conf.d/pgadmin4-web.conf.example file to a .conf file
>>
>> Things I don't know if they need to be done:
>>
>> 1. creating data and log directories and assigning permissions on them
>> 2. changing the permissions on the sqlite db
>> 3. creating a config_local.py file and setting the five settings in it
>>
>> Can you clarify?  
>
> On RHEL 7 / Fedora 25:
>
> * systemctl enable pgadmin4-v1.service; systemctl start pgadmin4-v1.service
> * cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
> v1.conf
> * systemctl start httpd.service
>
> should be enough, at least this is what I just tested on my Fedora 25 box.

OK, Thanks!

Now I just have to decide if I want to ship a systemd container.
Probably not, because that will restrict folks using it.

--
Josh Berkus
Containers & Databases Oh My!


--
Sent via pgadmin-hackers mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Some questions about configuration and the pgadmin4-v1-web package

Josh Berkus-6
In reply to this post by Devrim GÜNDÜZ
Devrim,

> * cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
> v1.conf

One more question: the sample .conf doesn't have the
threads-and-1-process configuration recommended in the pgadmin docs.  Is
there a reason it doesn't need it?


--
Josh Berkus
Containers & Databases Oh My!


--
Sent via pgadmin-hackers mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install of pgadmin4 from package fails ...

Josh Berkus-6
In reply to this post by Devrim GÜNDÜZ
On 04/21/2017 02:14 PM, Josh Berkus wrote:

> On 04/21/2017 01:57 AM, Devrim Gündüz wrote:
>> On RHEL 7 / Fedora 25:
>>
>> * systemctl enable pgadmin4-v1.service; systemctl start pgadmin4-v1.service
>> * cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
>> v1.conf
>> * systemctl start httpd.service
>>
>> should be enough, at least this is what I just tested on my Fedora 25 box.
>
> So I just tried this, and it doesn't do any of the setup.
>
> There's no config_local, and as far as I can tell the database isn't
> created.  It's hard to know for sure, though, because without a
> config_local I'm not sure where it would be located.
>
> Error: [Fri Apr 21 21:02:32.080337 2017] [wsgi:error] [pid 26] [remote
> 76.115.138.49:35628] FileNotFoundError: [Errno 2] No such file or
> directory: '/usr/share/httpd/.pgadmin/pgadmin4.log'
>
> ... certainly there is no /usr/share/httpd/.pgadmin directory
>

Aha, here's the problem.  Setup is getting run as root, not as the user
httpd.  This means it's dropping .pgadmin into /root/, which the web
server can't access; it's "home" directory is /usr/share/httpd.
However, that directory isn't writable by the apache user, either.

There isn't an easy fix for this; on a default Fedora or CentOS system,
the only directory the apache user has read/write to is /tmp, as far as
I know.

Ideas?

--
Josh Berkus
Containers & Databases Oh My!


--
Sent via pgadmin-hackers mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Some questions about configuration and the pgadmin4-v1-web package

Dave Page-7
In reply to this post by Josh Berkus-6


On Fri, Apr 21, 2017 at 6:45 PM, Josh Berkus <[hidden email]> wrote:
Devrim,

> * cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
> v1.conf

One more question: the sample .conf doesn't have the
threads-and-1-process configuration recommended in the pgadmin docs.  Is
there a reason it doesn't need it?

That's definitely required, otherwise you will end up with multiple DB connection managers and have no way for client sessions to maintain affinity with the right one.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install of pgadmin4 from package fails ...

Dave Page-7
In reply to this post by Josh Berkus-6


On Fri, Apr 21, 2017 at 10:40 PM, Josh Berkus <[hidden email]> wrote:
On 04/21/2017 02:14 PM, Josh Berkus wrote:
> On 04/21/2017 01:57 AM, Devrim Gündüz wrote:
>> On RHEL 7 / Fedora 25:
>>
>> * systemctl enable pgadmin4-v1.service; systemctl start pgadmin4-v1.service
>> * cp /etc/httpd/conf.d/pgadmin4-v1.conf.sample /etc/httpd/conf.d/pgadmin4-
>> v1.conf
>> * systemctl start httpd.service
>>
>> should be enough, at least this is what I just tested on my Fedora 25 box.
>
> So I just tried this, and it doesn't do any of the setup.
>
> There's no config_local, and as far as I can tell the database isn't
> created.  It's hard to know for sure, though, because without a
> config_local I'm not sure where it would be located.
>
> Error: [Fri Apr 21 21:02:32.080337 2017] [wsgi:error] [pid 26] [remote
> 76.115.138.49:35628] FileNotFoundError: [Errno 2] No such file or
> directory: '/usr/share/httpd/.pgadmin/pgadmin4.log'
>
> ... certainly there is no /usr/share/httpd/.pgadmin directory
>

Aha, here's the problem.  Setup is getting run as root, not as the user
httpd.  This means it's dropping .pgadmin into /root/, which the web
server can't access; it's "home" directory is /usr/share/httpd.
However, that directory isn't writable by the apache user, either.

There isn't an easy fix for this; on a default Fedora or CentOS system,
the only directory the apache user has read/write to is /tmp, as far as
I know.

Ideas?


Create a directory, setup the config to use it as required, then chown the database after running setup (which is probably easier than trying to run it as the apache user directly).

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install of pgadmin4 from package fails ...

Josh Berkus-6
On 04/24/2017 01:23 AM, Dave Page wrote:

>     There isn't an easy fix for this; on a default Fedora or CentOS system,
>     the only directory the apache user has read/write to is /tmp, as far as
>     I know.
>
>     Ideas?
>
>
> This is covered in the docs:
> https://www.pgadmin.org/docs4/1.x/server_deployment.html 
>
> Create a directory, setup the config to use it as required, then chown
> the database after running setup (which is probably easier than trying
> to run it as the apache user directly).
>

I know how to fix my personal install (and container image).  But I want
to fix the RPM package so that it's fixed for most users.  Right now,
install from RPM is kind of broken.

Here's the changes that need to happen on the RPM:

1. Remove the QT dependencies for pgadmin4-v1-web

2. Have the RPM create /usr/share/httpd/.pgadmin, owned by apache user.
   (is this the best location?  If not, what is?)

3. Fix the systemd unit file so that the pgadmin4 unit is owned by apache.

4. (optional) set up files according to FDL standards, putting configs
for pgadmin4 in /etc/pgadmin and the db in /var/run/pgadmin (or similar).

Devrim, where is the source for this rpm build?

--
Josh Berkus
Containers & Databases Oh My!


--
Sent via pgadmin-hackers mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Previous Thread Next Thread
Loading...