Home > Enterprise >  Point Apache Superset docker container on Azure to use my production Postgres db
Point Apache Superset docker container on Azure to use my production Postgres db

Time:07-12

I'm able to create a working container group of Apache Superset using the Azure CLI like this:

az container create --resource-group myrg --name superset-test --image apache/superset:1.5.1 --dns-name-label superset-test --ports 80 8088 --cpu 2 --memory 8

But I want the application's data to be stored on my Azure Postgres Flexible Server, not the default Postgres docker container. I am trying to pass that info via environment variables:

az container create --resource-group myrg --name superset-test --image apache/superset:1.5.1
 --dns-name-label superset-test --ports 80 8088 --cpu 2 --memory 8 --environment-variables DATABASE_DIALECT="postgresql"
"DATABASE_USER"="superset" "DATABASE_PASSWORD"="superset" "DATABASE_HOST"="azpostgresql1.mydomain.com"
"DATABASE_PORT"="5432" "DATABASE_DB"="superset" 

But they seem to be ignored - the Superset container starts up the same way and no data is populated into my db. Can I do this via the CLI? Or is there another way I should execute this deployment?

I've created an empty database superset in my Postgres db and made user superset the owner.

CodePudding user response:

Instead of using CLI use PgAdmin. In PgAdmin, we can connect our application to Postgres to local or on azure platform. The environment variables which were shown in the question, directly mentioned in the PgAdmin credentials and it will allow access to the application to database.

Follow the steps:

  • Open PgAdmin
  • On the Left click on Servers
  • Click on Dropdown
  • Right Click on Open Clusters and select properties
  • Click on Open Connection tab and give all the environment variables which were created.
  • Check the working of the application again after setting up all the variables.

CodePudding user response:

Have you tried running this container via the Azure web portal as per this example? This would ensure all variables are present and parsed correctly.

Azure documentation suggests using single quotes ' rather than double " for env var specification. As per this docs example. Though I realise it shouldn't really make much difference.

If you won't have any luck with the above, you may want to explore another option - have you seen the Superset database connection UI? It may prove useful in checking the connectivity.

Other than that, it's difficult to explore other options. A bit more context would help:

  • have you seen any traffic arrive at the target database?
  • is there any traffic in the local Postgres instead?
  • any chance you can confirm in the web portal that the variables were set correctly via the cli?
  • Related