skip to Main Content

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

Now I want to pass some environment vars to customize the deployment, e.g., I want the database backend to be my Azure Postgres Flexible Server, not the default Postgres docker container superset_db. But I can’t figure out how to pass that info via environment variables.

I’ve tried like this, with --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?

Update: I’m now focused on the SECRET_KEY variable since, if one is not passed, the default is used and a message appears in the container once I connect to it via the Azure web portal and run superset init:

A Default SECRET_KEY was detected, please use superset_config.py to override it.

That’s a clean way to verify that the problem is in my env variables. Once the container starts up, I can verify the connection to the same Postgres DB I want to use as the application backend by listing it as a database source and testing the connection.

2

Answers


  1. 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.
    Login or Signup to reply.
  2. 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?
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search