1717# LIFECYCLE COMMANDS:
1818# start [service] Start services. No service = start all.
1919# stop [service] Stop services. No service = stop all.
20- # restart [service] Restart without rebuilding . No service = restart all.
20+ # restart [service] Recreate container (picks up env changes) . No service = restart all.
2121# rebuild [service] Stop, rebuild image, restart. No service = rebuild all buildable.
22+ # NOTE: For frontend VITE_* changes, use rebuild (baked at build time).
2223# wake [id] Wake stopped sandbox containers. id = session or sandbox UUID.
2324# cleanup Remove orphaned sandbox containers (Created/Exited state).
2425#
@@ -149,8 +150,8 @@ USAGE:
149150COMMANDS:
150151 start [service] Start services (all if no service specified)
151152 stop [service] Stop services (all if no service specified)
152- restart [service] Restart without rebuilding
153- rebuild [service] Rebuild from source and restart
153+ restart [service] Recreate container (picks up env changes, no rebuild)
154+ rebuild [service] Rebuild from source and restart (required for VITE_* changes)
154155 wake [id] Wake stopped sandbox (session ID, sandbox ID, or 'all')
155156 cleanup Remove orphaned sandbox containers (Created/Exited)
156157 status Show running services and URLs
@@ -669,15 +670,15 @@ cmd_restart() {
669670
670671 # If a specific service was requested, just restart that one
671672 if [[ -n " $TARGET_SERVICE " ]]; then
672- log_info " Restarting $TARGET_SERVICE (keeping existing image )..."
673- compose restart " $TARGET_SERVICE "
673+ log_info " Restarting $TARGET_SERVICE (recreating container to pick up env changes )..."
674+ compose up -d --force-recreate " $TARGET_SERVICE "
674675 log_success " $TARGET_SERVICE restarted"
675676 show_service_url " $TARGET_SERVICE "
676677 return
677678 fi
678679
679680 # Restart all services
680- log_info " Restarting all services (keeping existing images )..."
681+ log_info " Restarting all services (recreating containers to pick up env changes )..."
681682 cmd_stop
682683 echo " "
683684 cmd_start
@@ -863,22 +864,22 @@ cmd_logs() {
863864_resync_sandbox_ports () {
864865 local sandbox_port
865866 sandbox_port=$( get_env_value SANDBOX_SERVER_PORT 8100)
866-
867+
867868 log_info " Syncing port allocations with sandbox-server..."
868-
869+
869870 # Try the rescan endpoint (returns 400 in cloud mode, which is fine)
870871 local response
871872 response=$( curl -fsS -X POST " http://localhost:${sandbox_port} /ports/rescan" 2>&1 ) && {
872873 log_success " Port allocations synced"
873874 return 0
874875 }
875-
876+
876877 # Check if it's a "not available" error (cloud mode) - that's OK
877878 if echo " $response " | grep -q " not available" ; then
878879 log_info " Port management not needed (cloud mode)"
879880 return 0
880881 fi
881-
882+
882883 # Fallback: restart sandbox-server to trigger startup scan
883884 log_warn " Rescan endpoint not available, restarting sandbox-server..."
884885 local sandbox_server_container=" ${PROJECT_NAME} -sandbox-server-1"
@@ -939,7 +940,7 @@ cmd_wake() {
939940 done
940941 echo " "
941942 log_success " Woke $count sandbox(es)"
942-
943+
943944 # Tell sandbox-server to rescan port allocations
944945 if [[ " $count " -gt 0 ]]; then
945946 _resync_sandbox_ports
@@ -1009,7 +1010,7 @@ cmd_wake() {
10091010 if docker ps --filter " name=$container_name " --format " {{.Status}}" | grep -q " Up" ; then
10101011 log_success " Sandbox is now running"
10111012 docker ps --filter " name=$container_name " --format " table {{.Names}}\t{{.Status}}"
1012-
1013+
10131014 # Tell sandbox-server to rescan port allocations
10141015 _resync_sandbox_ports
10151016 else
@@ -1058,7 +1059,7 @@ cmd_cleanup() {
10581059 local container_id container_name
10591060 container_id=$( echo " $line " | awk ' {print $1}' )
10601061 container_name=$( echo " $line " | awk ' {print $2}' )
1061-
1062+
10621063 if [[ -n " $container_id " ]]; then
10631064 log_info " Removing $container_name ..."
10641065 if docker rm " $container_id " & > /dev/null; then
@@ -1072,15 +1073,15 @@ cmd_cleanup() {
10721073
10731074 echo " "
10741075 log_success " Removed $count orphaned container(s)"
1075-
1076+
10761077 # Tell sandbox-server to clean up its port allocations
10771078 if [[ " $count " -gt 0 ]]; then
10781079 auto_detect_mode
10791080 get_compose_vars
1080-
1081+
10811082 local sandbox_port
10821083 sandbox_port=$( get_env_value SANDBOX_SERVER_PORT 8100)
1083-
1084+
10841085 log_info " Syncing port allocations with sandbox-server..."
10851086 if curl -fsS -X POST " http://localhost:${sandbox_port} /ports/cleanup" & > /dev/null; then
10861087 log_success " Port allocations cleaned"
0 commit comments