aws-quickstart/quickstart-apache-superset

Overwriting Docker image with own superset_config.py loses all AWS specific config

philMarius opened this issue · 0 comments

We based our stack off of the quickstart stack and got everything running well! However, we wanted to enable Google OAuth and that required updating the superset_config.py file. So, we decided to roll with a Docker image consisting of the following:

## Main Superset Docker image
# Root image available here: https://gallery.ecr.aws/p9r6s5p7/superset

FROM public.ecr.aws/p9r6s5p7/superset:v2.0.0

USER root

RUN pip install Authlib

COPY superset_config.py /app/pythonpath

USER superset

With superset_config.py:

from os import environ
from flask_appbuilder.security.manager import AUTH_OAUTH

# Set the authentication type to OAuth
AUTH_TYPE = AUTH_OAUTH

OAUTH_PROVIDERS = [
    {
        'name':'google',
        'whitelist': ['@example.com'],
        'token_key':'access_token',
        'icon':'fa-google',
        'remote_app': {
            'client_id': environ["GOOGLE_OAUTH_CLIENT_ID"],
            'client_secret': environ["GOOGLE_OAUTH_CLIENT_SECRET"],
            'client_kwargs':{
                'scope': 'email profile'
            },
            'access_token_method':'POST',
            'access_token_params':{
                'client_id': environ["GOOGLE_OAUTH_CLIENT_ID"]
            },
            'access_token_headers':{
                'Authorization': 'Basic Base64EncodedClientIdAndSecret'
            },
            'api_base_url':'https://www.googleapis.com/oauth2/v2/',
            'access_token_url':'https://accounts.google.com/o/oauth2/token',
            'authorize_url':'https://accounts.google.com/o/oauth2/auth'
        }
    }
]

AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = "Admin"

By basing it off of the image used in this quickstart, we hoped that we would retain the AWS specific settings that made it so easy to setup and run. However, this was not the case and we're having to manually reapply all the AWS configuration that enabled things like communicating with Postgres and using Redis.

So, would it be possible for either one of two things to happen:

  1. Sharing the Dockerfile for the image used in this stack (public.ecr.aws/p9r6s5p7/superset:v2.0.0) so we can duplicate the missing configuration (preferable)
  2. Adding from superset_config import * that the official config.py file uses at the end of the superset_config.py file in the AWS image to overwrite configurations (see below)
"""The main config file for Superset
All configuration in this file can be overridden by providing a superset_config
in your PYTHONPATH as there is a ``from superset_config import *``
at the end of this file.
"""

Either one of these solutions would make developing an AWS specific deployment of Superset easier. Related issue