Skip to content
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: add bind and compose mount settings for superset #988

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tutoraspects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,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