Skip to content

Conversation

@Che-Zhu
Copy link
Collaborator

@Che-Zhu Che-Zhu commented Dec 26, 2025

Summary

Add a Deploy button in the terminal toolbar that allows users to build and run their app in production mode. The app will keep running even after closing the terminal.

Features

  • Deploy Button: One-click deployment with pnpm run build && pnpm run start
  • Persistent Execution: Uses nohup to run in background, survives terminal close
  • Status Detection: Polls port 3000 to detect when app is running
  • Live Toggle: Click again to stop the running app
  • Visual Feedback: Deploy → Deploying... → Live (green) → Stopping...

API Endpoints

  • POST /api/sandbox/{id}/exec - Execute command in background
  • GET /api/sandbox/{id}/app-status - Check if app is running (port 3000)
  • DELETE /api/sandbox/{id}/app-status - Stop the app

Files Changed

  • lib/k8s/sandbox-manager.ts - Add execCommandInBackground, isPortListening, killProcessOnPort
  • lib/k8s/kubernetes.ts - Add wrapper methods
  • app/api/sandbox/[id]/exec/route.ts - New endpoint
  • app/api/sandbox/[id]/app-status/route.ts - New endpoint
  • components/terminal/terminal-toolbar.tsx - Add Deploy button with polling

Closes #116

- Add execCommandInBackground method in sandbox-manager.ts for nohup execution
- Add isPortListening and killProcessOnPort methods for app status detection
- Create /api/sandbox/[id]/exec endpoint for background command execution
- Create /api/sandbox/[id]/app-status endpoint for status check and stop
- Add Deploy button in terminal-toolbar with polling-based status detection
- Support start/stop toggle with visual feedback (Deploy -> Live -> Stop)

Closes #116
@github-actions
Copy link

✅ PR Check Results: Passed

Build Checks

Check Status
Lint & Build ✅ Passed
Docker Build ✅ Passed

✨ Great work!

All checks passed successfully. Your PR is ready for review.

Details:

  • ✅ Code quality verified (linting passed)
  • ✅ Build successful
  • ✅ Docker image build verified (linux/amd64)
    Commit: 410279c9382828a8381b2cb6a41b1fe3ab95883a
    Branch: feature/sandbox-deploy

🔗 View Details:

@Che-Zhu Che-Zhu merged commit 754c54d into main Dec 26, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support exec cmd in sandbox

2 participants