Skip to content

Commit

Permalink
Merge pull request #988 from openedx/jill/mount-superset
Browse files Browse the repository at this point in the history
feat: add bind and compose mount settings for superset
  • Loading branch information
Cristhian Garcia authored Nov 18, 2024
2 parents 5823579 + c9d0c9e commit 4a00325
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,34 @@ def _aspects_public_hosts(
pass


@hooks.Filters.IMAGES_BUILD_MOUNTS.add()
def _mount_superset_on_build(
mounts: list[tuple[str, str]], host_path: str
) -> list[tuple[str, str]]:
"""
Automatically add superset repo from the host to the build context whenever
it is added to the `MOUNTS` setting.
"""
if os.path.basename(host_path) == "superset":
mounts += [
("aspects-superset", "superset"),
]
return mounts


@hooks.Filters.COMPOSE_MOUNTS.add()
def _mount_superset_compose(
volumes: list[tuple[str, str]], name: str
) -> list[tuple[str, str]]:
"""
When mounting superset with `tutor mounts add /path/to/superset"
bind-mount the host repo in the superset container.
"""
if name == "superset":
volumes += [("superset", "/app")]
return volumes


########################################
# INITIALIZATION TASKS
########################################
Expand Down
3 changes: 3 additions & 0 deletions tutoraspects/templates/base-docker-compose-services
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ image: {{ DOCKER_IMAGE_SUPERSET }}
- ../../env/plugins/aspects/apps/superset/superset_home:/app/superset_home
- ../../env/plugins/aspects/apps/superset/scripts:/app/scripts
- ../../env/plugins/aspects/build/aspects-superset/openedx-assets:/app/openedx-assets
{%- for mount in iter_mounts(MOUNTS, "superset") %}
- {{ mount }}
{%- endfor %}
restart: unless-stopped
environment:
DATABASE_DIALECT: {{ SUPERSET_DB_DIALECT }}
Expand Down

0 comments on commit 4a00325

Please sign in to comment.