Skip to content

Commit 9f6a156

Browse files
committed
make install script more robust
1 parent 814e6cf commit 9f6a156

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ CodeRunner is an MCP (Model Context Protocol) server that executes AI-generated
3030
git clone https://github.com/instavm/coderunner.git
3131
cd coderunner
3232
chmod +x install.sh
33-
sudo ./install.sh
33+
./install.sh
3434
```
3535

3636
MCP server will be available at: http://coderunner.local:8222/mcp

install.sh

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ then
3636
fi
3737

3838
echo "Stopping any running Apple 'container' processes..."
39+
container system stop 2>/dev/null || true
3940
else
4041
echo "Apple 'container' tool not detected. Proceeding with installation..."
4142

@@ -47,40 +48,69 @@ else
4748
sudo installer -pkg container-installer.pkg -target /
4849
fi
4950

50-
echo "Starting the Sandbox Container..."
51-
container system start
51+
# Stop any existing container system to clean up stale connections
52+
echo "Stopping any existing container system..."
53+
container system stop 2>/dev/null || true
54+
55+
# Wait a moment for cleanup
56+
sleep 2
57+
58+
# Start the container system (this is blocking and will wait for kernel download if needed)
59+
echo "Starting the Sandbox Container system (this may take a few minutes if downloading kernel)..."
60+
if ! container system start; then
61+
echo "❌ Failed to start container system."
62+
exit 1
63+
fi
64+
65+
# Quick verification that system is ready
66+
echo "Verifying container system is ready..."
67+
if container system status &>/dev/null; then
68+
echo "✅ Container system is ready."
69+
else
70+
echo "❌ Container system started but status check failed."
71+
echo "Try running: container system stop && container system start"
72+
exit 1
73+
fi
5274

5375
echo "Setting up local network domain..."
5476

5577
# Run the commands for setting up the local network
5678
echo "Running: sudo container system dns create local"
57-
sudo container system dns create local
79+
sudo container system dns create local 2>/dev/null || echo "DNS domain 'local' already exists (this is fine)"
5880

59-
echo "Running: container system dns default set local"
81+
echo "Running: container system property set dns.domain local"
6082
container system property set dns.domain local
6183

62-
echo "Starting the Sandbox Container..."
63-
container system start
64-
6584

6685
echo "Pulling the latest image: instavm/coderunner"
67-
container image pull instavm/coderunner
86+
if ! container image pull instavm/coderunner; then
87+
echo "❌ Failed to pull image. Please check your internet connection and try again."
88+
exit 1
89+
fi
6890

6991
echo "→ Ensuring coderunner assets directories…"
7092
ASSETS_SRC="$HOME/.coderunner/assets"
7193
mkdir -p "$ASSETS_SRC/skills/user"
7294
mkdir -p "$ASSETS_SRC/outputs"
7395

96+
# Stop any existing coderunner container
97+
echo "Stopping any existing coderunner container..."
98+
container stop coderunner 2>/dev/null || true
99+
sleep 2
100+
74101
# Run the command to start the sandbox container
75102
echo "Running: container run --name coderunner --detach --rm --cpus 8 --memory 4g instavm/coderunner"
76-
container run \
103+
if container run \
77104
--volume "$ASSETS_SRC/skills/user:/app/uploads/skills/user" \
78105
--volume "$ASSETS_SRC/outputs:/app/uploads/outputs" \
79106
--name coderunner \
80107
--detach \
81108
--rm \
82109
--cpus 8 \
83110
--memory 4g \
84-
instavm/coderunner
85-
86-
echo "✅ Setup complete. MCP server is available at http://coderunner.local:8222/mcp"
111+
instavm/coderunner; then
112+
echo "✅ Setup complete. MCP server is available at http://coderunner.local:8222/mcp"
113+
else
114+
echo "❌ Failed to start coderunner container. Please check the logs with: container logs coderunner"
115+
exit 1
116+
fi

0 commit comments

Comments
 (0)