[object Object]

← back to Exo

just run

ff3d11c748fda848a7fb0c8a868a922a8aeb6126 · 2025-07-29 16:58:27 +0100 · Gelu Vrabie

Co-authored-by: Gelu Vrabie <gelu@exolabs.net>

Files touched

Diff

commit ff3d11c748fda848a7fb0c8a868a922a8aeb6126
Author: Gelu Vrabie <gelu.vrabie.univ@gmail.com>
Date:   Tue Jul 29 16:58:27 2025 +0100

    just run
    
    Co-authored-by: Gelu Vrabie <gelu@exolabs.net>
---
 justfile | 13 +++++++++++--
 run.sh   | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 2 deletions(-)

diff --git a/justfile b/justfile
index a327859d..5b92d3c4 100644
--- a/justfile
+++ b/justfile
@@ -26,7 +26,7 @@ sync:
     uv sync --all-packages
 
 sync-clean:
-    uv sync --all-packages --force-reinstall
+    uv sync --all-packages --force-reinstall --no-cache
 
 protobufs:
     just regenerate-protobufs
@@ -43,4 +43,13 @@ test-forwarder:
     cd networking/forwarder && go test ./src/...
 
 # Build all components (Python packages and Go forwarder)
-build-all: build build-forwarder
\ No newline at end of file
+build-all: build build-forwarder
+
+run n="1" clean="false":
+    @echo "→ Spinning up {{n}} node(s) (clean={{clean}})"
+    if [ "{{clean}}" = "true" ]; then ./run.sh -c; else ./run.sh; fi
+    if [ "{{n}}" -gt 1 ]; then \
+        for i in $(seq 2 "{{n}}"); do \
+            if [ "{{clean}}" = "true" ]; then ./run.sh -rc; else ./run.sh -r; fi; \
+        done; \
+    fi
\ No newline at end of file
diff --git a/run.sh b/run.sh
new file mode 100755
index 00000000..f63eea07
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+DIR="$PWD"
+
+# Initialize flags
+REPLICA=false
+CLEAN=false
+
+# Parse command line arguments
+while getopts "rc" opt; do
+  case $opt in
+    r)
+      REPLICA=true
+      ;;
+    c)
+      CLEAN=true
+      ;;
+    \?)
+      echo "Invalid option: -$OPTARG" >&2
+      echo "Usage: $0 [-r] [-c]"
+      echo "  -r  Run as replica"
+      echo "  -c  Clean databases before starting"
+      exit 1
+      ;;
+  esac
+done
+
+# Clean if requested
+if [ "$CLEAN" = true ]; then
+  echo "Cleaning databases..."
+  rm -f ~/.exo/*db*
+  rm -f ~/.exo_replica/*db*
+fi
+
+# First command (worker) - changes based on replica flag
+if [ "$REPLICA" = true ]; then
+  osascript -e "tell app \"Terminal\" to do script \"cd '$DIR'; nix develop -c bash -c 'export EXO_HOME=.exo_replica; uv run -m worker.main'\""
+else
+  osascript -e "tell app \"Terminal\" to do script \"cd '$DIR'; nix develop -c uv run -m worker.main\""
+fi
+
+# Second command (master) - changes based on replica flag
+if [ "$REPLICA" = true ]; then
+  osascript -e "tell app \"Terminal\" to do script \"cd '$DIR'; nix develop -c bash -c 'export EXO_RUN_AS_REPLICA=1 EXO_HOME=.exo_replica API_PORT=8001; uv run -m master.main'\""
+else
+  osascript -e "tell app \"Terminal\" to do script \"cd '$DIR'; nix develop -c uv run -m master.main\""
+fi
\ No newline at end of file

← 25fa46c6 Update CODEOWNERS  ·  back to Exo  ·  Test Supervisor Errors. b350eded →