0

I am unable to run docker image dpage/pgadmin4 on azure web app (Linux) which is available on docker hub.

I have installed Docker in my Linux machine and was able to run that docker image locally. Then I created Web app in Azure with options as given below:

  • OS: Linux
  • Publish: Docker Image
  • App service plan: Linux app service

After creating web app, I added two env variables in App Settings section:

PGADMIN_DEFAULT_EMAIL : user@domain.com
PGADMIN_DEFAULT_PASSWORD : SuperSecret

Finally login screen is visible but when I enter above credentials, it doesn't work and keeps redirecting to login page.

Update: If login is working properly, screen appears as shown below. !(pgadmin initial screen)

Rushabh
  • 1
  • 2

3 Answers3

2

After several retries i once got an message (CSRF token invalid) displayed in the right-top corner of the login screen.

For CSRF to properly work there must be some serverside state? So I activated the "ARR affinity" in the "General Settings" on the azure "Configuration".

I also noticed in the explamples on documentation the two environment-variables PGADMIN_CONFIG_CONSOLE_LOG_LEVEL (which is in the example set to '10') and PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION (which is in the example set to 'True').

After enabling "ARR" and setting PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION to False the login started to work. I have no idea what PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION is actually doing, so please take that with caution.

If thats not working for you, maybe setting PGADMIN_CONFIG_CONSOLE_LOG_LEVEL to 10 and enabling console debug logging can give you a clue whats happening.

Marco Kinski
  • 302
  • 3
  • 7
0

For your issue, I do the test and find that it's really a strange thing. When I deploy the docker image dpage/pgadmin4 in Azure service Web App for Container through Azure CLI and set the app settings, there is no problem to log in with the user and password. But when I deploy it through the Azure portal, then I meet the same thing with you.

Not sure what is the reason, but the solution is that set the environment variables PGADMIN_DEFAULT_EMAIL and PGADMIN_DEFAULT_PASSWORD through the Azure CLI like below:

az webapp config appsettings set --resource-group <resource-group-name> --name <app-name> --settings PGADMIN_DEFAULT_EMAIL="user@domain.com" PGADMIN_DEFAULT_PASSWORD="SuperSecret"

If you really want to know the reason, then you can make feedback to Microsoft. Maybe it's a bug or some special settings.

Update

The screenshot of the test on my side here:

enter image description here

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Can you please share me screenshot which appears in your web app after login with username and password as I am trying to figure it out since one week and not able to resolve. – Rushabh May 13 '19 at 06:08
  • @Rushabh I add the screenshot. Log in with the user and password. – Charles Xu May 13 '19 at 06:39
  • I have updated one screenshot of pgadmin4 client which is working locally fine. I guess your screenshot is showing that its not properly working post login. Right now I am not able to see my updated screenshot as I have less credits. I am also trying to follow your steps and creating web app for container using Azure CLI and docker hub image as container to be used. – Rushabh May 13 '19 at 07:47
  • @Rushabh Yes, it just shows as the screenshot shows and it works fine when I deploy the image in the vm. Not sure why it cannot load the dashboard when it deploys in the web app. – Charles Xu May 13 '19 at 07:57
  • So even you are stuck again as I thought. Don't worry, I will definitely provide feedback to Microsoft regarding this. Please let me know if you find any more on this web app issue. – Rushabh May 13 '19 at 09:02
  • Did you ever find a fix for this? I am trying this a year later and still get the same result as @CharlesXu – dashambles Aug 10 '20 at 13:57
  • @dashambles I didn't get the same error. So I don't know why you got it. – Charles Xu Aug 11 '20 at 01:06
0

PGADMIN_CONFIG_ENHANCED_COOKIE_PROTECTION allows pgAdmin4 to create session cookies based on IP address. It should be disabled in dynamic IP address hosting environments, where the IP address could change.

Source: https://www.pgadmin.org/docs/pgadmin4/development/config_py.html and search for ENHANCED_COOKIE_PROTECTION

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Raff
  • 1
  • 1