public inbox for [email protected]  
help / color / mirror / Atom feed
pgAdmin Docker container: specify web URL path prefix?
8+ messages / 5 participants
[nested] [flat]

* pgAdmin Docker container: specify web URL path prefix?
@ 2022-04-12 00:50  Glen Bakeman <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Glen Bakeman @ 2022-04-12 00:50 UTC (permalink / raw)
  To: [email protected]

Hi everyone,

I'm getting into containerized hosting, and I'd like to setup the 
pgAdmin docker container with a reverse proxy (Traefik). Traefik 
supports Path Prefix proxying for services (i.e, I'd like to access 
pgAdmin at host.example.com/pgadmin/). The issue seems to be that 
pgAdmin automatically rewrites requests to host.example.com/login, which 
breaks the proxy.

I can't seem to find any options that allow us to specify the web path 
pgAdmin uses, from the perspective of configuring the docker container. 
Can anyone please confirm this?

Thanks in advance,

Glen






^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgAdmin Docker container: specify web URL path prefix?
@ 2022-04-12 04:11  Yogesh Mahajan <[email protected]>
  parent: Glen Bakeman <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Yogesh Mahajan @ 2022-04-12 04:11 UTC (permalink / raw)
  To: Glen Bakeman <[email protected]>; +Cc: [email protected]

Hi Glen,

Please refer to the last point at this
<https://www.pgadmin.org/docs/pgadmin4/6.8/container_deployment.html;
web-page for hosting pgadmin4 under subdirectory with Traefik.
Here is example when pgadmin4 is hosted under /pgadmin4/

docker run --name "pgadmin4" \
    -e "[email protected]" \
    -e "PGADMIN_DEFAULT_PASSWORD=SuperSecret" \
    -e "SCRIPT_NAME=/pgadmin4" \
    -l "traefik.frontend.rule=PathPrefix:/pgadmin4" \
    -d dpage/pgadmin4


Thanks,
Yogesh Mahajan
EnterpriseDB


On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman <[email protected]> wrote:

> Hi everyone,
>
> I'm getting into containerized hosting, and I'd like to setup the
> pgAdmin docker container with a reverse proxy (Traefik). Traefik
> supports Path Prefix proxying for services (i.e, I'd like to access
> pgAdmin at host.example.com/pgadmin/). The issue seems to be that
> pgAdmin automatically rewrites requests to host.example.com/login, which
> breaks the proxy.
>
> I can't seem to find any options that allow us to specify the web path
> pgAdmin uses, from the perspective of configuring the docker container.
> Can anyone please confirm this?
>
> Thanks in advance,
>
> Glen
>
>
>
>


^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgAdmin Docker container: specify web URL path prefix?
@ 2022-04-13 02:17  Glen Bakeman <[email protected]>
  parent: Yogesh Mahajan <[email protected]>
  0 siblings, 2 replies; 8+ messages in thread

From: Glen Bakeman @ 2022-04-13 02:17 UTC (permalink / raw)
  To: Yogesh Mahajan <[email protected]>; +Cc: [email protected]

Yogesh,

Not only was my DuckDuckGo-fu failing me, I didn't even get to the 
bottom of the page...

I had to make a few small tweaks since I'm on Traefikv2, but I'd be 
happy to update the documentation. Thank you for putting me in the right 
direction!

Glen

On 4/11/2022 9:11 PM, Yogesh Mahajan wrote:
> Hi Glen,
>
> Please refer to the last point at this 
> <https://www.pgadmin.org/docs/pgadmin4/6.8/container_deployment.html; 
> web-page for hosting pgadmin4 under subdirectory with Traefik.
> Here is example when pgadmin4 is hosted under /pgadmin4/
> docker run --name"pgadmin4"  \
>      -e"[email protected]"  \
>      -e"PGADMIN_DEFAULT_PASSWORD=SuperSecret"  \
>      -e"SCRIPT_NAME=/pgadmin4"  \
>      -l"traefik.frontend.rule=PathPrefix:/pgadmin4"  \
>      -d dpage/pgadmin4
>
> Thanks,
> Yogesh Mahajan
> EnterpriseDB
>
>
> On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman <[email protected]> wrote:
>
>     Hi everyone,
>
>     I'm getting into containerized hosting, and I'd like to setup the
>     pgAdmin docker container with a reverse proxy (Traefik). Traefik
>     supports Path Prefix proxying for services (i.e, I'd like to access
>     pgAdmin at host.example.com/pgadmin/
>     <http://host.example.com/pgadmin/;). The issue seems to be that
>     pgAdmin automatically rewrites requests to host.example.com/login
>     <http://host.example.com/login;, which
>     breaks the proxy.
>
>     I can't seem to find any options that allow us to specify the web
>     path
>     pgAdmin uses, from the perspective of configuring the docker
>     container.
>     Can anyone please confirm this?
>
>     Thanks in advance,
>
>     Glen
>
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgAdmin Docker container: specify web URL path prefix?
@ 2022-04-13 18:40  Glen Bakeman <[email protected]>
  parent: Glen Bakeman <[email protected]>
  1 sibling, 1 reply; 8+ messages in thread

From: Glen Bakeman @ 2022-04-13 18:40 UTC (permalink / raw)
  To: Yogesh Mahajan <[email protected]>; +Cc: [email protected]; pgadmin-hackers

Of course! My docker labels are as follows:

- "traefik.http.routers.pgadmin4.rule=Host(`host.example.com`) && 
PathPrefix(`/pgadmin4`)"
- "traefik.http.routers.pgadmin4.tls=true"

This assumes that the chosen name for the instance is "pgadmin4", which 
is entirely up the user. The Host portion was necessary because Traefik 
will complain otherwise about a lack of specificity in the rule. I also 
added the .tls line since Traefik will only forward insecure requests 
without it (not sure why yet). Otherwise, Traefik is able to 
automatically identify the necessary port on the service to communicate 
with. I added the SCRIPT_NAME environment variable which seemed to be 
the key I was missing.

Thanks again for your help,

Glen

On 4/12/2022 10:19 PM, Yogesh Mahajan wrote:
> Glad to hear it!
> Can you please share what additional steps are required?
>
> Thanks,
> Yogesh Mahajan
> EnterpriseDB
>
>
> On Wed, Apr 13, 2022 at 7:49 AM Glen Bakeman <[email protected]> wrote:
>
>     Yogesh,
>
>     Not only was my DuckDuckGo-fu failing me, I didn't even get to the
>     bottom of the page...
>
>     I had to make a few small tweaks since I'm on Traefikv2, but I'd
>     be happy to update the documentation. Thank you for putting me in
>     the right direction!
>
>     Glen
>
>     On 4/11/2022 9:11 PM, Yogesh Mahajan wrote:
>>     Hi Glen,
>>
>>     Please refer to the last point at this
>>     <https://www.pgadmin.org/docs/pgadmin4/6.8/container_deployment.html;
>>     web-page for hosting pgadmin4 under subdirectory with Traefik.
>>     Here is example when pgadmin4 is hosted under /pgadmin4/
>>     docker run --name"pgadmin4"  \
>>          -e"[email protected]"  \
>>          -e"PGADMIN_DEFAULT_PASSWORD=SuperSecret"  \
>>          -e"SCRIPT_NAME=/pgadmin4"  \
>>          -l"traefik.frontend.rule=PathPrefix:/pgadmin4"  \
>>          -d dpage/pgadmin4
>>
>>     Thanks,
>>     Yogesh Mahajan
>>     EnterpriseDB
>>
>>
>>     On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman <[email protected]>
>>     wrote:
>>
>>         Hi everyone,
>>
>>         I'm getting into containerized hosting, and I'd like to setup
>>         the
>>         pgAdmin docker container with a reverse proxy (Traefik). Traefik
>>         supports Path Prefix proxying for services (i.e, I'd like to
>>         access
>>         pgAdmin at host.example.com/pgadmin/
>>         <http://host.example.com/pgadmin/;). The issue seems to be that
>>         pgAdmin automatically rewrites requests to
>>         host.example.com/login <http://host.example.com/login;, which
>>         breaks the proxy.
>>
>>         I can't seem to find any options that allow us to specify the
>>         web path
>>         pgAdmin uses, from the perspective of configuring the docker
>>         container.
>>         Can anyone please confirm this?
>>
>>         Thanks in advance,
>>
>>         Glen
>>
>>
>>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: pgAdmin Docker container: specify web URL path prefix?
@ 2022-04-14 02:32  Glen Bakeman <[email protected]>
  parent: Glen Bakeman <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: Glen Bakeman @ 2022-04-14 02:32 UTC (permalink / raw)
  To: [email protected]; pgadmin-hackers; +Cc: Yogesh Mahajan <[email protected]>

For anyone watching this: I've made an issue 
<https://redmine.postgresql.org/issues/7315; to track updating the docs. 
If someone can give me the OK I'll go and get it done.

Glen

On 4/13/2022 11:40 AM, Glen Bakeman wrote:
>
> Of course! My docker labels are as follows:
>
> - "traefik.http.routers.pgadmin4.rule=Host(`host.example.com`) && 
> PathPrefix(`/pgadmin4`)"
> - "traefik.http.routers.pgadmin4.tls=true"
>
> This assumes that the chosen name for the instance is "pgadmin4", 
> which is entirely up the user. The Host portion was necessary because 
> Traefik will complain otherwise about a lack of specificity in the 
> rule. I also added the .tls line since Traefik will only forward 
> insecure requests without it (not sure why yet). Otherwise, Traefik is 
> able to automatically identify the necessary port on the service to 
> communicate with. I added the SCRIPT_NAME environment variable which 
> seemed to be the key I was missing.
>
> Thanks again for your help,
>
> Glen
>
> On 4/12/2022 10:19 PM, Yogesh Mahajan wrote:
>> Glad to hear it!
>> Can you please share what additional steps are required?
>>
>> Thanks,
>> Yogesh Mahajan
>> EnterpriseDB
>>
>>
>> On Wed, Apr 13, 2022 at 7:49 AM Glen Bakeman <[email protected]> wrote:
>>
>>     Yogesh,
>>
>>     Not only was my DuckDuckGo-fu failing me, I didn't even get to
>>     the bottom of the page...
>>
>>     I had to make a few small tweaks since I'm on Traefikv2, but I'd
>>     be happy to update the documentation. Thank you for putting me in
>>     the right direction!
>>
>>     Glen
>>
>>     On 4/11/2022 9:11 PM, Yogesh Mahajan wrote:
>>>     Hi Glen,
>>>
>>>     Please refer to the last point at this
>>>     <https://www.pgadmin.org/docs/pgadmin4/6.8/container_deployment.html;
>>>     web-page for hosting pgadmin4 under subdirectory with Traefik.
>>>     Here is example when pgadmin4 is hosted under /pgadmin4/
>>>     docker run --name"pgadmin4"  \
>>>          -e"[email protected]"  \
>>>          -e"PGADMIN_DEFAULT_PASSWORD=SuperSecret"  \
>>>          -e"SCRIPT_NAME=/pgadmin4"  \
>>>          -l"traefik.frontend.rule=PathPrefix:/pgadmin4"  \
>>>          -d dpage/pgadmin4
>>>
>>>     Thanks,
>>>     Yogesh Mahajan
>>>     EnterpriseDB
>>>
>>>
>>>     On Tue, Apr 12, 2022 at 6:23 AM Glen Bakeman <[email protected]>
>>>     wrote:
>>>
>>>         Hi everyone,
>>>
>>>         I'm getting into containerized hosting, and I'd like to
>>>         setup the
>>>         pgAdmin docker container with a reverse proxy (Traefik).
>>>         Traefik
>>>         supports Path Prefix proxying for services (i.e, I'd like to
>>>         access
>>>         pgAdmin at host.example.com/pgadmin/
>>>         <http://host.example.com/pgadmin/;). The issue seems to be that
>>>         pgAdmin automatically rewrites requests to
>>>         host.example.com/login <http://host.example.com/login;, which
>>>         breaks the proxy.
>>>
>>>         I can't seem to find any options that allow us to specify
>>>         the web path
>>>         pgAdmin uses, from the perspective of configuring the docker
>>>         container.
>>>         Can anyone please confirm this?
>>>
>>>         Thanks in advance,
>>>
>>>         Glen
>>>
>>>
>>>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* bash or sql script to copy foreign table to locale table
@ 2022-05-19 23:55  koff <[email protected]>
  parent: Glen Bakeman <[email protected]>
  1 sibling, 1 reply; 8+ messages in thread

From: koff @ 2022-05-19 23:55 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

Hi all,

I need little help  please,

I'v  already   foreign tables (from oracle_fdw) in my  postgresql 
environment.

I'm Just  looking for  script shell  or sql  ( easy way)  to migrate  
this  foreign tables   to locale  table .

My script below  has some issue

thanks lot

------script migrate---

#!/bin/bash
export PGDATA=/pg01/pgdata/9.6/data
export PGUSER="postgres"
export PGPORT="5433"
export PGPASSWORD="ttooe2"

for tbl in `psql -qAt   data_2020
-c "select  foreign_table_name  from information_schema.foreign_tables;"`;
do psql data_2020  -c "create table public.\"$tbl\" as select * from 
fdw_link.\"$tbl\"" ; done

----end  of script---

the database is :  data_2020

  foreign_table schema   is :  fdw_link

and want to copy  to public  schema









^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: bash or sql script to copy foreign table to locale table
@ 2022-05-20 03:17  Ron <[email protected]>
  parent: koff <[email protected]>
  0 siblings, 1 reply; 8+ messages in thread

From: Ron @ 2022-05-20 03:17 UTC (permalink / raw)
  To: [email protected]

Please do not hijack existing threads.

On 5/19/22 18:55, koff wrote:
> Hi all,
>
> I need little help  please,
>
> I'v  already   foreign tables (from oracle_fdw) in my  postgresql 
> environment.
>
> I'm Just  looking for  script shell  or sql  ( easy way)  to migrate  
> this  foreign tables   to locale  table .
>
> My script below  has some issue
>
> thanks lot
>
> ------script migrate---
>
> #!/bin/bash
> export PGDATA=/pg01/pgdata/9.6/data
> export PGUSER="postgres"
> export PGPORT="5433"
> export PGPASSWORD="ttooe2"
>
> for tbl in `psql -qAt   data_2020 -c "select  foreign_table_name  from 
> information_schema.foreign_tables;"`;
> do
                   ## note the added semicolon
>     psql data_2020  -c "create table public.\"$tbl\" as select * from 
> fdw_link.\"$tbl\";"
Here, either psql COPY the fdw_link.\"$tbl\" data OUT to a local file, and 
then COPY IN to public.\"$tbl\" *OR* INSERT INTO public.\"$tbl\" SELECT * 
FROM fdw_link.\"$tbl\";

> done
>
> ----end  of script---
>
> the database is :  data_2020
>
>  foreign_table schema   is :  fdw_link
>
> and want to copy  to public  schema
>
>
>
>
>
>

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: bash or sql script to copy foreign table to locale table
@ 2022-05-20 09:40  khoff <[email protected]>
  parent: Ron <[email protected]>
  0 siblings, 0 replies; 8+ messages in thread

From: khoff @ 2022-05-20 09:40 UTC (permalink / raw)
  To: Ron <[email protected]>; +Cc: [email protected]

Hi  Ron,

It works

Thanks for your  contribution

khoff.

Le 20/05/2022 à 05:17, Ron a écrit :
> Please do not hijack existing threads.
>
> On 5/19/22 18:55, koff wrote:
>> Hi all,
>>
>> I need little help  please,
>>
>> I'v  already   foreign tables (from oracle_fdw) in my postgresql 
>> environment.
>>
>> I'm Just  looking for  script shell  or sql  ( easy way)  to migrate  
>> this  foreign tables   to locale  table .
>>
>> My script below  has some issue
>>
>> thanks lot
>>
>> ------script migrate---
>>
>> #!/bin/bash
>> export PGDATA=/pg01/pgdata/9.6/data
>> export PGUSER="postgres"
>> export PGPORT="5433"
>> export PGPASSWORD="ttooe2"
>>
>> for tbl in `psql -qAt   data_2020 -c "select  foreign_table_name  
>> from information_schema.foreign_tables;"`;
>> do
>                   ## note the added semicolon
>>     psql data_2020  -c "create table public.\"$tbl\" as select * from 
>> fdw_link.\"$tbl\";"
> Here, either psql COPY the fdw_link.\"$tbl\" data OUT to a local file, 
> and then COPY IN to public.\"$tbl\" *OR* INSERT INTO public.\"$tbl\" 
> SELECT * FROM fdw_link.\"$tbl\";
>
>> done
>>
>> ----end  of script---
>>
>> the database is :  data_2020
>>
>>  foreign_table schema   is :  fdw_link
>>
>> and want to copy  to public  schema
>>
>>
>>
>>
>>
>>
>
> -- 
> Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2022-05-20 09:40 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 00:50 pgAdmin Docker container: specify web URL path prefix? Glen Bakeman <[email protected]>
2022-04-12 04:11 ` Yogesh Mahajan <[email protected]>
2022-04-13 02:17   ` Glen Bakeman <[email protected]>
2022-04-13 18:40     ` Glen Bakeman <[email protected]>
2022-04-14 02:32       ` Glen Bakeman <[email protected]>
2022-05-19 23:55     ` bash or sql script to copy foreign table to locale table koff <[email protected]>
2022-05-20 03:17       ` Re: bash or sql script to copy foreign table to locale table Ron <[email protected]>
2022-05-20 09:40         ` Re: bash or sql script to copy foreign table to locale table khoff <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox