1313import json
1414import logging
1515import re
16+ import shlex
1617
1718import yaml
1819from google .protobuf .json_format import MessageToDict
1920
2021from collections .abc import Callable
22+ from iris .cluster .dashboard_common import DASHBOARD_TITLE_ENV_VAR , dashboard_title_from_config
2123from iris .rpc import config_pb2
2224
2325logger = logging .getLogger (__name__ )
@@ -362,6 +364,7 @@ def build_worker_bootstrap_script(
362364 --ulimit core=0:0 \\
363365 -v /var/cache/iris:/var/cache/iris \\
364366 {{ config_volume }} \\
367+ {{ dashboard_env }} \\
365368 {{ docker_image }} \\
366369 .venv/bin/python -m iris.cluster.controller.main serve \\
367370 --host 0.0.0.0 --port {{ port }} {{ config_flag }} {{ fresh_flag }}
@@ -434,6 +437,7 @@ def build_controller_bootstrap_script(
434437 docker_image : str ,
435438 port : int ,
436439 config_yaml : str = "" ,
440+ dashboard_title : str | None = None ,
437441 fresh : bool = False ,
438442) -> str :
439443 """Build bootstrap script for controller VM.
@@ -442,6 +446,7 @@ def build_controller_bootstrap_script(
442446 docker_image: Docker image to run
443447 port: Controller port
444448 config_yaml: Optional YAML config to write to /etc/iris/config.yaml
449+ dashboard_title: Optional browser title prefix for the dashboard
445450 fresh: When True, pass ``--fresh`` to the controller serve command so
446451 it starts with an empty local database and skips checkpoint restore.
447452 """
@@ -453,6 +458,8 @@ def build_controller_bootstrap_script(
453458 config_setup = "# No config file provided"
454459 config_volume = ""
455460 config_flag = ""
461+ dashboard_title = (dashboard_title or "" ).strip ()
462+ dashboard_env = f"-e { DASHBOARD_TITLE_ENV_VAR } ={ shlex .quote (dashboard_title )} " if dashboard_title else ""
456463
457464 return render_template (
458465 CONTROLLER_BOOTSTRAP_SCRIPT ,
@@ -461,6 +468,7 @@ def build_controller_bootstrap_script(
461468 port = port ,
462469 config_setup = config_setup ,
463470 config_volume = config_volume ,
471+ dashboard_env = dashboard_env ,
464472 config_flag = config_flag ,
465473 fresh_flag = "--fresh" if fresh else "" ,
466474 )
@@ -493,4 +501,10 @@ def build_controller_bootstrap_script_from_config(
493501
494502 image = resolve_image (image , zone )
495503
496- return build_controller_bootstrap_script (image , port , config_yaml , fresh = fresh )
504+ return build_controller_bootstrap_script (
505+ image ,
506+ port ,
507+ config_yaml ,
508+ dashboard_title = dashboard_title_from_config (config ),
509+ fresh = fresh ,
510+ )
0 commit comments