Redash on Azure WebApps for Container

How to Provisioning

1. Create Azure Database for PostgreSQL server

2. Create Azure WebApps for Container

3. Allow WebApps outbound IPs in  PostgreSQL's Connection security firewall

4. Configure compose settings for table provisioning in WebApps's DeployCenter

Configure following and execute create_db command.


version: '3.3'
services:
  redash:
    image: redash/redash:10.1.0.b50633
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: INFO
      REDASH_COOKIE_SECRET: {self generated cookie secret}
      REDASH_DATABASE_URL: postgresql://postgres@{dbname}:{password}@{dbname}.postgres.database.azure.com:5432/postgres?sslmode=require
      REDASH_WEB_WORKERS: 4
    restart: always
    command: create_db


5. Configure compose redasn server in WebApps's DeployCenter

version: '3.3'
services:
  redis:
    image: redis:5.0-alpine
    restart: always
  scheduler:
    image: redash/redash:10.1.0.b50633
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: INFO
      REDASH_REDIS_URL: redis://redis:6379/0
      REDASH_COOKIE_SECRET: {self generated cookie secret}
      REDASH_SECRET_KEY: {self generated secret}
      REDASH_DATABASE_URL: postgresql://postgres@{dbname}:{password}@{dbname}.postgres.database.azure.com:5432/postgres?sslmode=require
      QUEUES: "celery"
      WORKERS_COUNT: 1
    restart: always
    command: scheduler
  scheduled_worker:
    image: redash/redash:10.1.0.b50633
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: INFO
      REDASH_REDIS_URL: redis://redis:6379/0
      REDASH_COOKIE_SECRET: {self generated cookie secret}
      REDASH_SECRET_KEY: {self generated secret}
      REDASH_DATABASE_URL: postgresql://postgres@{dbname}:{password}@{dbname}.postgres.database.azure.com:5432/postgres?sslmode=require
      QUEUES: "scheduled_queries,schemas"
      WORKERS_COUNT: 1
    restart: always
    command: worker
  adhoc_worker:
    image: redash/redash:10.1.0.b50633
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: INFO
      REDASH_REDIS_URL: redis://redis:6379/0
      REDASH_COOKIE_SECRET: {self generated cookie secret}
      REDASH_SECRET_KEY: {self generated secret}
      REDASH_DATABASE_URL: postgresql://postgres@{dbname}:{password}@{dbname}.postgres.database.azure.com:5432/postgres?sslmode=require
      QUEUES: "queries"
      WORKERS_COUNT: 2
    restart: always
    command: worker
  redash:
    image: redash/redash:10.1.0.b50633
    environment:
      PYTHONUNBUFFERED: 0
      REDASH_LOG_LEVEL: INFO
      REDASH_REDIS_URL: redis://redis:6379/0
      REDASH_COOKIE_SECRET: {self generated cookie secret}
      REDASH_SECRET_KEY: {self generated secret}
      REDASH_DATABASE_URL: postgresql://postgres@{dbname}:{password}@{dbname}.postgres.database.azure.com:5432/postgres?sslmode=require
      REDASH_WEB_WORKERS: 4
    restart: always
    command: server
  nginx:
    image: redash/nginx:latest
    ports:
      - "80:80"
    restart: always


Why does it need to create Azure Database for PostgreSQL server


If you create PostgreSQL in docker-compose, you'll get this error.


FATAL: data directory "/var/lib/postgresql/data" has wrong ownership


Currently, Azure WebApps for Container has limitation for persisting storage. So, anybody don't up postgress in WebApps for Container


You cannot change permissions on the /home directory when persisting storage.

Applies to Web App for Containers

When you persist storage with the WEBSITES_ENABLE_APP_SERVICE_STORAGE app setting, we mount a location in Azure Storage to the /home mount point. The permissions on this are > 777. You cannot change these permissions, even if you attempt to do so from an initialization script or from SSH.

https://docs.microsoft.com/en-us/archive/blogs/waws/things-you-should-know-web-apps-and-linux#you-cannot-change-permissions-on-the-home-directory-when-persisting-storageapplies-to-web-app-for-containers

https://stackoverflow.com/questions/62384620/postgres-on-docker-in-azure