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

Introduce galaxy_external_url variable #18576

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
20 changes: 17 additions & 3 deletions doc/source/admin/galaxy_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2279,15 +2279,29 @@
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~
``galaxy_external_url``
~~~~~~~~~~~~~~~~~~~~~~~

:Description:
URL (with schema http/https) of the Galaxy instance as accessible
from external networks, including ``galaxy_url_prefix`` if
necessary. This URL is used to determine links outside of the web
application, e.g. when requesting job finish emails.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
application, e.g. when requesting job finish emails.
application, e.g. when requesting job finish emails. This is complementary
to `galaxy_infrastructure_url` which is for internal network use.

:Default: ``None``
:Type: str


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``galaxy_infrastructure_url``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

:Description:
URL (with schema http/https) of the Galaxy instance as accessible
within your local network. This URL is used as a default by pulsar
file staging and Interactive Tool containers for communicating
back with Galaxy via the API.
within your local network, including ``galaxy_url_prefix`` if
necessary. This URL is used as a default by pulsar file staging
and Interactive Tool containers for communicating back with Galaxy
via the API.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
via the API.
via the API. This setting should be contrasted with `galaxy_external_url` which
is for public facing services.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this redundant with as accessible within your local network and as accessible from external networks and the option name itself ? I think it's good to be concise here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, maybe it can be simplified to See also: galaxy_external_url. The intent was to compare and contrast related settings, so they are not missed.

If you plan to run Interactive Tools make sure the docker
container can reach this URL.
:Default: ``http://localhost:8080``
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ class GalaxyAppConfiguration(BaseAppConfiguration, CommonConfigurationMixin):
enable_tool_shed_check: bool
galaxy_data_manager_data_path: str
galaxy_infrastructure_url: str
galaxy_external_url: Optional[str]
hours_between_check: int
integrated_tool_panel_config: str
involucro_path: str
Expand Down
13 changes: 10 additions & 3 deletions lib/galaxy/config/sample/galaxy.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -1422,9 +1422,16 @@ galaxy:
#galaxy_url_prefix: /

# URL (with schema http/https) of the Galaxy instance as accessible
# within your local network. This URL is used as a default by pulsar
# file staging and Interactive Tool containers for communicating back
# with Galaxy via the API.
# from external networks, including ``galaxy_url_prefix`` if
# necessary. This URL is used to determine links outside of the web
# application, e.g. when requesting job finish emails.
#galaxy_external_url: null

# URL (with schema http/https) of the Galaxy instance as accessible
# within your local network, including ``galaxy_url_prefix`` if
# necessary. This URL is used as a default by pulsar file staging and
# Interactive Tool containers for communicating back with Galaxy via
# the API.
# If you plan to run Interactive Tools make sure the docker container
# can reach this URL.
#galaxy_infrastructure_url: http://localhost:8080
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/config/sample/tool_shed.yml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ tool_shed:
# options.
#whoosh_index_dir: database/toolshed_whoosh_indexes

# Cache directory for Pydantic model objects.
#model_cache_dir: database/model_cache

# For searching repositories at /api/repositories:
#repo_name_boost: 0.9

Expand Down
15 changes: 12 additions & 3 deletions lib/galaxy/config/schemas/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1642,15 +1642,24 @@ mapping:
URL prefix for Galaxy application. If Galaxy should be served under a prefix set this to
the desired prefix value.

galaxy_external_url:
type: str
required: false
desc: |
URL (with schema http/https) of the Galaxy instance as accessible
from external networks, including ``galaxy_url_prefix`` if necessary.
This URL is used to determine links outside of the web application,
e.g. when requesting job finish emails.

galaxy_infrastructure_url:
type: str
default: http://localhost:8080
required: false
desc: |
URL (with schema http/https) of the Galaxy instance as accessible
within your local network. This URL is used as a default by pulsar
file staging and Interactive Tool containers for communicating back with
Galaxy via the API.
within your local network, including ``galaxy_url_prefix`` if necessary.
This URL is used as a default by pulsar file staging and Interactive Tool
containers for communicating back with Galaxy via the API.

If you plan to run Interactive Tools make sure the docker container
can reach this URL.
Expand Down
7 changes: 3 additions & 4 deletions lib/galaxy/job_execution/actions/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,11 @@ def execute(cls, app, sa_session, action, job, replacement_dict, final_job_state
try:
history_id_encoded = app.security.encode_id(job.history_id)
link_invocation = None
galaxy_url = app.config.galaxy_external_url or app.config.galaxy_infrastructure_url
if job.workflow_invocation_step:
invocation_id_encoded = app.security.encode_id(job.workflow_invocation_step.workflow_invocation_id)
link_invocation = (
f"{app.config.galaxy_infrastructure_url}/workflows/invocations/report?id={invocation_id_encoded}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... well that was problematic 😨. I agree we should have this option but we should just disable this link if the config option is not set IMO. Things should just degrade well if the new option is not set and I think that means either serializing the request url with the job or dropping it all together.

)
link = f"{app.config.galaxy_infrastructure_url}/histories/view?id={history_id_encoded}"
link_invocation = f"{galaxy_url}/workflows/invocations/report?id={invocation_id_encoded}"
link = f"{galaxy_url}/histories/view?id={history_id_encoded}"
to = job.get_user_email()
subject = f"Galaxy job completion notification from history '{job.history.name}'"
outdata = ",\n".join(ds.dataset.display_name() for ds in job.output_datasets)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/managers/notification.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def create_broadcast_notification(self, request: BroadcastNotificationCreateRequ
This kind of notification is not explicitly associated with any specific user but it is accessible by all users.
"""
self.ensure_notifications_enabled()
notification = self._create_notification_model(request)
notification = self._create_notification_model(request, self.config.galaxy_external_url)
self.sa_session.add(notification)
with transaction(self.sa_session):
self.sa_session.commit()
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy/webapps/galaxy/services/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def send_notification(
self.notification_manager.ensure_notifications_enabled()
self._ensure_user_can_send_notifications(sender_context)
galaxy_url = (
str(sender_context.url_builder("/", qualified=True)).rstrip("/") if sender_context.url_builder else None
str(sender_context.url_builder("/", qualified=True)).rstrip("/")
if sender_context.url_builder
else self.notification_manager.config.galaxy_external_url
)
request = NotificationCreateRequest.model_construct(
notification=payload.notification,
Expand Down
6 changes: 5 additions & 1 deletion lib/galaxy/webapps/galaxy/services/sharable.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ def share_with_users(self, trans, id: DecodedDatabaseIdField, payload: ShareWith
base_status = self._get_sharing_status(trans, item)
status = self.share_with_status_cls.model_construct(**base_status.model_dump(), extra=extra)
status.errors.extend(errors)
galaxy_url = str(trans.url_builder("/", qualified=True)).rstrip("/") if trans.url_builder else None
galaxy_url = (
str(trans.url_builder("/", qualified=True)).rstrip("/")
if trans.url_builder
else trans.app.config.galaxy_external_url
jmchilton marked this conversation as resolved.
Show resolved Hide resolved
)
self._send_notification_to_users(users_to_notify, item, status, galaxy_url)
return status

Expand Down
Loading