Re: Help with running pgadmin in a docker container - Mailing list pgadmin-support
From | Simon Thorpe |
---|---|
Subject | Re: Help with running pgadmin in a docker container |
Date | |
Msg-id | BYAPR06MB4502A299E6EF71690883FD4AAB799@BYAPR06MB4502.namprd06.prod.outlook.com Whole thread Raw |
In response to | Re: Help with running pgadmin in a docker container (Simon Thorpe <simon@thorpevillage.com>) |
Responses |
Re: Help with running pgadmin in a docker container
|
List | pgadmin-support |
So here is my temporary solution, given the environment I am building is not a critical production system and only used for testing.
docker compose up -d
docker exec -it -u0 pgadmin sed -i "/app\.config\['sessions'] = dict\(\)/a\app\.config\['WTF_CSRF_ENABLED'\] = False" /pgadmin4/pgAdmin4.py
docker exec -it -u0 pgadmin sed -i "/app\.config\['sessions'] = dict\(\)/a\app\.config\['WTF_CSRF_ENABLED'\] = False" /pgadmin4/pgAdmin4.py
After the docker container starts, I am inserting the above Python line to disable Flask from CSRF checking. With this, I can now easily access the app without getting the errors.
Simon
From: Simon Thorpe <simon@thorpevillage.com>
Sent: Tuesday, May 16, 2023 8:17 AM
To: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: Help with running pgadmin in a docker container
Sent: Tuesday, May 16, 2023 8:17 AM
To: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: Help with running pgadmin in a docker container
Attached...
Seems like a csrf problem. A quick google search and it seems that when Docker is
So I tried accessing the server in Firefox. And it all worked fine. Went back to Chrome, closed all my tabs and accessed the server again, now Chrome works. Logged out on Chrome, and attempted to log back in. Get the errors again.
Closed Chrome again, returned to the pgadmin login page and logged in. Works fine.
So it seems that upon a logout and return, using the same browser tab, it's failing the csrf check. Should the logout call delete a cookie or something?
Simon
From: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>
Sent: Monday, May 15, 2023 10:36 PM
To: Simon Thorpe <simon@thorpevillage.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: Help with running pgadmin in a docker container
Sent: Monday, May 15, 2023 10:36 PM
To: Simon Thorpe <simon@thorpevillage.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: Help with running pgadmin in a docker container
Hi Simon,
Can you please share the docker logs for v7?
On Tue, May 16, 2023 at 6:21 AM Simon Thorpe <simon@thorpevillage.com> wrote:
Note, I rolled back and used 6.21 of pgadmin...pgadmin:container_name: pgadminimage: dpage/pgadmin4:6.21depends_on:- postgresdbenvironment:- PGADMIN_DEFAULT_PASSWORD=nottherealpassword- PGADMIN_DEFAULT_EMAIL=admin@domain.comports:- "3004:80"I still get an error, but this time the UX shows a red box lower right with the error..."INTERNAL SERVER ERROR"and then disappears.again a whole load of 400 errors in the browser console.The UX also doesn't show the "Servers" item under the "Browser" heading on the left hand menu.Something not right. Would love some pointers as to how to get it working. I would imagine this would also fail for others as I am using a pretty standard container for both pgadmin and postgres.SimonFrom: Simon Thorpe <simon@thorpevillage.com>
Sent: Monday, May 15, 2023 5:40 PM
To: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Help with running pgadmin in a docker containerHiI'm running a postgres server in a docker container and pgadmin in another docker container, i'm using a docker compose file to build them both. I am able to start both containers fine, I can access the pgadmin UI fine. I can login and add a new server, all seems well. I can see and navigate the postgres server via the pgadmin UX.However, if I logout and back in, I cannot use the UX at all. The browser throws a lot of errors and I can't even re-add the server. Not sure what is going on. My environment is the following...services:pgadmin:container_name: pgadminimage: dpage/pgadmin4depends_on:- postgresdbenvironment:- PGADMIN_DEFAULT_PASSWORD=nottherealpassword- PGADMIN_DEFAULT_EMAIL=admin@domain.comports:- "3004:80"postgresdb:image: postgres:15container_name: postgresdbenvironment:- POSTGRES_DB=postgres- POSTGRES_PASSWORD=nottherealpassword- POSTGRES_USER=adminvolumes:- postgresdb:/var/lib/postgresql/volumes:postgresdb:When I attempt to relogin, I can authenticate. But the browser throws the errors below. It hints that the local pgadmin database is corrupted (/var/lib/pgadmin/pgadmin4.db?).Any clues as to how I get this working?app.bundle.js?ver=70100:2 Uncaught (in promise) Error: Node Load Error...at app.bundle.js?ver=70100:2:2318033at s (app.bundle.js?ver=70100:2:2309094)at Generator.<anonymous> (app.bundle.js?ver=70100:2:2310431)at Generator.next (app.bundle.js?ver=70100:2:2309457)at y (app.bundle.js?ver=70100:2:2315084)at i (app.bundle.js?ver=70100:2:2315287)Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=Error%3A%20Request%20failed%20with%20status%20code%20400 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.at xo (vendor.others.js?ver=70100:109:3096293)at vendor.others.js?ver=70100:109:3101114at Fs (vendor.others.js?ver=70100:109:3112100)at $a (vendor.others.js?ver=70100:109:3157983)at Tl (vendor.others.js?ver=70100:109:3143455)at kl (vendor.others.js?ver=70100:109:3143383)at El (vendor.others.js?ver=70100:109:3143246)at yl (vendor.others.js?ver=70100:109:3140233)at vendor.others.js?ver=70100:109:3089971at t.unstable_runWithPriority (vendor.others.js?ver=70100:109:3476540)GET https://pgadmin.skyflash.co/misc/bgprocess/ 400Error: Request failed with status code 400at e.exports (vendor.others.js?ver=70100:109:168712)at e.exports (vendor.others.js?ver=70100:109:171135)at XMLHttpRequest.v (vendor.others.js?ver=70100:109:164032)Uncaught (in promise) Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=Error%3A%20Request%20failed%20with%20status%20code%20400 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.at xo (vendor.others.js?ver=70100:109:3096293)at vendor.others.js?ver=70100:109:3101114at Fs (vendor.others.js?ver=70100:109:3112100)at $a (vendor.others.js?ver=70100:109:3157983)at Tl (vendor.others.js?ver=70100:109:3143455)at kl (vendor.others.js?ver=70100:109:3143383)at El (vendor.others.js?ver=70100:109:3143246)at yl (vendor.others.js?ver=70100:109:3140233)at vendor.others.js?ver=70100:109:3089971at t.unstable_runWithPriority (vendor.others.js?ver=70100:109:3476540)Uncaught (in promise) Error: Request failed with status code 400at e.exports (vendor.others.js?ver=70100:109:168712)at e.exports (vendor.others.js?ver=70100:109:171135)at XMLHttpRequest.v (vendor.others.js?ver=70100:109:164032)
Thanks,
Aditya Toshniwal
"Don't Complain about Heat, Plant a TREE"
pgadmin-support by date: