From e08e24a5eea619dff4ee76f03db83562459ebb5c Mon Sep 17 00:00:00 2001 From: Cristhian Garcia Date: Fri, 13 Oct 2023 14:57:18 -0500 Subject: [PATCH] feat: create Superset LMS admin user --- tutoraspects/patches/openedx-common-settings | 7 +++++++ tutoraspects/patches/openedx-development-settings | 7 +++++++ tutoraspects/plugin.py | 3 +++ .../templates/aspects/jobs/init/superset/init-superset.sh | 7 +++++++ 4 files changed, 24 insertions(+) create mode 100644 tutoraspects/patches/openedx-development-settings diff --git a/tutoraspects/patches/openedx-common-settings b/tutoraspects/patches/openedx-common-settings index 4156f85b5..4245c981d 100644 --- a/tutoraspects/patches/openedx-common-settings +++ b/tutoraspects/patches/openedx-common-settings @@ -6,3 +6,10 @@ EVENT_SINK_CLICKHOUSE_BACKEND_CONFIG = { "database": "{{ ASPECTS_EVENT_SINK_DATABASE }}", "timeout_secs": {{ ASPECTS_EVENT_SINK_CLICKHOUSE_TIMEOUT_SECS }} } +SUPERSET_CONFIG = { + "service_url": "http://superset:{{ SUPERSET_PORT }}/", + "host": "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ SUPERSET_HOST }}", + "username": "{{ SUPERSET_LMS_USERNAME }}", + "password": "{{ SUPERSET_LMS_PASSWORD }}", + "email": "{{ SUPERSET_LMS_EMAIL }}", +} diff --git a/tutoraspects/patches/openedx-development-settings b/tutoraspects/patches/openedx-development-settings new file mode 100644 index 000000000..beefbc5e6 --- /dev/null +++ b/tutoraspects/patches/openedx-development-settings @@ -0,0 +1,7 @@ +SUPERSET_CONFIG = { + "service_url": "http://superset:{{ SUPERSET_PORT }}/", + "host": "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ SUPERSET_HOST }}:{{ SUPERSET_PORT }}", + "username": "{{ SUPERSET_LMS_USERNAME }}", + "password": "{{ SUPERSET_LMS_PASSWORD }}", + "email": "{{ SUPERSET_LMS_EMAIL }}", +} diff --git a/tutoraspects/plugin.py b/tutoraspects/plugin.py index 6acd47011..7f13be6a9 100644 --- a/tutoraspects/plugin.py +++ b/tutoraspects/plugin.py @@ -262,6 +262,7 @@ }, ), ("SUPERSET_ADMIN_EMAIL", "admin@openedx.org"), + ("SUPERSET_LMS_EMAIL", "lms@openedx.org"), ("SUPERSET_OWNERS", []), # Set to 0 to have no row limit. ("SUPERSET_ROW_LIMIT", 100_000), @@ -409,6 +410,8 @@ ("SUPERSET_OAUTH2_CLIENT_SECRET", "{{ 16|random_string }}"), ("SUPERSET_ADMIN_USERNAME", "{{ 12|random_string }}"), ("SUPERSET_ADMIN_PASSWORD", "{{ 24|random_string }}"), + ("SUPERSET_LMS_USERNAME", "{{ 12|random_string }}"), + ("SUPERSET_LMS_PASSWORD", "{{ 24|random_string }}"), ] ) diff --git a/tutoraspects/templates/aspects/jobs/init/superset/init-superset.sh b/tutoraspects/templates/aspects/jobs/init/superset/init-superset.sh index 0fa9d53bb..c60221264 100755 --- a/tutoraspects/templates/aspects/jobs/init/superset/init-superset.sh +++ b/tutoraspects/templates/aspects/jobs/init/superset/init-superset.sh @@ -52,6 +52,13 @@ superset fab create-admin \ --lastname Admin \ --email "{{ SUPERSET_ADMIN_EMAIL }}" +superset fab create-admin \ + --username "{{ SUPERSET_LMS_USERNAME }}" \ + --password "{{ SUPERSET_LMS_PASSWORD }}" \ + --firstname LMS \ + --lastname Admin \ + --email "{{ SUPERSET_LMS_EMAIL }}" + # Update the password of the Admin user # (in case it changed since the user was created) superset fab reset-password \