-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: adding redis SSL and username authentification #21287
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,14 +69,21 @@ def env(key, default=None): | |
|
||
MAPBOX_API_KEY = env('MAPBOX_API_KEY', '') | ||
CACHE_CONFIG = { | ||
'CACHE_TYPE': 'redis', | ||
'CACHE_TYPE': 'RedisCache', | ||
'CACHE_DEFAULT_TIMEOUT': 300, | ||
'CACHE_KEY_PREFIX': 'superset_', | ||
'CACHE_REDIS_HOST': env('REDIS_HOST'), | ||
'CACHE_REDIS_PORT': env('REDIS_PORT'), | ||
'CACHE_REDIS_PASSWORD': env('REDIS_PASSWORD'), | ||
'CACHE_REDIS_DB': env('REDIS_DB', 1), | ||
'CACHE_OPTIONS': { | ||
'username': env('REDIS_USERNAME'), | ||
{{- if .Values.supersetNode.connections.redis_ssl }} | ||
'ssl': True, | ||
{{- end }} | ||
} | ||
} | ||
|
||
DATA_CACHE_CONFIG = CACHE_CONFIG | ||
|
||
SQLALCHEMY_DATABASE_URI = f"postgresql+psycopg2://{env('DB_USER')}:{env('DB_PASS')}@{env('DB_HOST')}:{env('DB_PORT')}/{env('DB_NAME')}" | ||
|
@@ -92,9 +99,12 @@ WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365 | |
class CeleryConfig(object): | ||
CELERY_IMPORTS = ('superset.sql_lab', ) | ||
CELERY_ANNOTATIONS = {'tasks.add': {'rate_limit': '10/s'}} | ||
{{- if .Values.supersetNode.connections.redis_password }} | ||
BROKER_URL = f"redis://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
CELERY_RESULT_BACKEND = f"redis://:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
{{- if .Values.supersetNode.connections.redis_ssl }} | ||
BROKER_URL = f"rediss://{env('REDIS_USERNAME')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure of what you're asking. I introduced "redis_ssl" and I'm checking if the option is set in order to be able to choose between redis and rediss (ssl mode) already. What's REDIS_SCHEME ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. following this convention: https://www.rfc-editor.org/rfc/rfc3986.html#section-3 for scheme |
||
CELERY_RESULT_BACKEND = f"rediss://{env('REDIS_USERNAME')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
{{- else if .Values.supersetNode.connections.redis_password }} | ||
BROKER_URL = f"redis://{env('REDIS_USERNAME')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
CELERY_RESULT_BACKEND = f"redis://{env('REDIS_USERNAME')}:{env('REDIS_PASSWORD')}@{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
{{- else }} | ||
BROKER_URL = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
CELERY_RESULT_BACKEND = f"redis://{env('REDIS_HOST')}:{env('REDIS_PORT')}/0" | ||
|
@@ -104,7 +114,11 @@ CELERY_CONFIG = CeleryConfig | |
RESULTS_BACKEND = RedisCache( | ||
host=env('REDIS_HOST'), | ||
{{- if .Values.supersetNode.connections.redis_password }} | ||
username=env('REDIS_USERNAME'), | ||
password=env('REDIS_PASSWORD'), | ||
{{- end }} | ||
{{- if .Values.supersetNode.connections.redis_ssl }} | ||
ssl=True, | ||
{{- end }} | ||
port=env('REDIS_PORT'), | ||
key_prefix='superset_results' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ bootstrapScript: | | |
rm -rf /var/lib/apt/lists/* && \ | ||
pip install \ | ||
psycopg2-binary==2.9.1 \ | ||
redis==3.5.3 && \ | ||
redis==4.3.4 && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. our current base requirements is: https://github.com/apache/superset/blob/master/requirements/base.txt#L242 |
||
if [ ! -f ~/bootstrap ]; then echo "Running Superset with uid {{ .Values.runAsUser }}" > ~/bootstrap; fi | ||
|
||
## The name of the secret which we will use to generate a superset_config.py file | ||
|
@@ -242,8 +242,10 @@ supersetNode: | |
connections: | ||
# Change in case of bringing your own redis and then also set redis.enabled:false | ||
redis_host: '{{ template "superset.fullname" . }}-redis-headless' | ||
# redis_username: superset | ||
# redis_password: superset | ||
redis_port: "6379" | ||
# redis_ssl: "True" | ||
# You need to change below configuration incase bringing own PostgresSQL instance and also set postgresql.enabled:false | ||
db_host: '{{ template "superset.fullname" . }}-postgresql' | ||
db_port: "5432" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably should change: https://github.com/apache/superset/blob/04dd8d414db6a3cddcd073ad74acb2a4b7a53b0b/docker/pythonpath_dev/superset_config.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change was introduced in version 1.10.0 of flask-caching and is mandatory in version 2.X
as I'm using helm I didn't edit the docket-compose setup but it should be safe to do it I guess