Skip to content

Commit 31cf2d2

Browse files
committed
Add prism profile
1 parent f58dfc3 commit 31cf2d2

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

spp

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,13 @@ def run(cmd: str | list, check: bool = True, capture: bool = False, **kwargs) ->
150150
return subprocess.run(cmd, check=check, **kwargs)
151151

152152

153-
def docker_compose(*args, profile: str = None) -> list:
153+
def docker_compose(*args, profile: str = None, profiles: list = None) -> list:
154154
"""Build docker compose command."""
155155
cmd = ["docker", "compose"]
156-
if profile:
156+
if profiles:
157+
for p in profiles:
158+
cmd.extend(["--profile", p])
159+
elif profile:
157160
cmd.extend(["--profile", profile])
158161
cmd.extend(args)
159162
return cmd
@@ -551,6 +554,14 @@ def cmd_start(args):
551554
# Determine profile: dev (dynamic port) vs ui (fixed 8069)
552555
profile = args.profile
553556

557+
# --prism requires the ui profile (fixed port 8069) so PRISM can reach Odoo
558+
extra_profiles = []
559+
if getattr(args, "prism", False):
560+
if profile == "dev":
561+
info("--prism requires fixed port, switching to ui profile")
562+
profile = "ui"
563+
extra_profiles.append("prism")
564+
554565
# Check if Docker image needs rebuilding (unless --no-build)
555566
if not getattr(args, "no_build", False):
556567
_check_image_freshness(profile, auto_rebuild=args.yes)
@@ -576,7 +587,7 @@ def cmd_start(args):
576587
print("\n" + _color("1;34", "Phase 1: Installing job_worker..."))
577588
phase1_env = env.copy()
578589
phase1_env["ODOO_INIT_MODULES"] = "job_worker"
579-
run(docker_compose("up", "-d", profile=profile), env=phase1_env)
590+
run(docker_compose("up", "-d", profiles=[profile] + extra_profiles), env=phase1_env)
580591

581592
if not _wait_for_odoo_ready(profile):
582593
warn("Odoo did not become ready in time, continuing anyway...")
@@ -590,7 +601,7 @@ def cmd_start(args):
590601

591602
print("\n" + _color("1;34", f"Phase 2: Installing {demo_modules}..."))
592603
env["ODOO_INIT_MODULES"] = demo_modules
593-
run(docker_compose("up", "-d", profile=profile), env=env)
604+
run(docker_compose("up", "-d", profiles=[profile] + extra_profiles), env=env)
594605

595606
# Wait for Odoo to be ready first
596607
if not _wait_for_odoo_ready(profile, timeout=120):
@@ -620,7 +631,7 @@ def cmd_start(args):
620631

621632
# Start services
622633
print(f"Starting Odoo ({profile} profile)...")
623-
run(docker_compose("up", "-d", profile=profile), env=env)
634+
run(docker_compose("up", "-d", profiles=[profile] + extra_profiles), env=env)
624635

625636
# Warn if --generate used without --wipe
626637
if args.generate:
@@ -634,6 +645,9 @@ def cmd_start(args):
634645
print("\nOdoo available at: http://localhost:8069")
635646
print("Credentials: admin / admin")
636647

648+
if extra_profiles and "prism" in extra_profiles:
649+
print("\nPRISM frontend: http://localhost:3000")
650+
637651

638652
def cmd_stop(args):
639653
"""Stop all services."""
@@ -649,7 +663,7 @@ def cmd_stop(args):
649663

650664
print("Stopping all containers...")
651665
# Stop all profiles
652-
for profile in ["dev", "ui", "e2e"]:
666+
for profile in ["dev", "ui", "e2e", "prism"]:
653667
run(docker_compose("down", profile=profile), check=False)
654668

655669
# Also stop standalone db if running
@@ -1314,6 +1328,11 @@ def build_parser():
13141328
action="store_true",
13151329
help="Run demo data generator after installation (requires --wipe and --demo)",
13161330
)
1331+
p.add_argument(
1332+
"--prism",
1333+
action="store_true",
1334+
help="Also start PRISM frontend on port 3000 (requires prism-app repo)",
1335+
)
13171336

13181337
# stop
13191338
p = subparsers.add_parser("stop", help="Stop all services")

0 commit comments

Comments
 (0)