A powerful command-line tool for deploying applications to sandbox environments. Deploy your code with a single command to cloud development environments like Daytona, E2B, or Azure Container Instances.
- π One-Command Deployment - Deploy any Dockerized application instantly
- π§ Multiple Providers - Support for Daytona, E2B, and Azure Container Instances
- π³ Docker Integration - Automatic image building and registry management
- π Secure Authentication - Service principal and CLI-based authentication
- π Sandbox Management - List, browse, and destroy running sandboxes
- π Direct Access - Automatic URL generation for deployed applications
- β‘ Command Execution - Run commands directly in sandbox environments
git clone <repository-url>
cd sandbox-cli
npm install
npm run buildnpm run cli init# Configure Daytona
npm run cli configure daytona
# Configure Azure Container Instances
npm run cli configure azure
# Configure E2B (coming soon)
npm run cli configure e2b# Create a sandbox environment
npm run cli create ./my-app --provider daytona
# Deploy code to the current sandbox
npm run cli deploy ./my-app
# Or create with Azure
npm run cli create ./my-app --provider azure
npm run cli deploy ./my-appPrerequisites:
- Daytona account and API key
- Daytona server access
Configuration:
npm run cli configure daytonaYou'll be prompted for:
- API Key (from Daytona dashboard)
- Server URL (default: https://app.daytona.io/api)
- Target region (default: eu)
Prerequisites:
- Azure subscription
- Azure CLI installed and configured
- Azure Container Registry
- Resource group
Setup:
# Install Azure CLI (if not already installed)
# macOS: brew install azure-cli
# Windows: Download from https://aka.ms/installazurecliwindows
# Linux: curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# Login to Azure
az login
# Create resource group (if needed)
az group create --name sandbox-rg --location eastus
# Create Azure Container Registry (if needed)
az acr create --resource-group sandbox-rg --name myregistry --sku Basic --admin-enabled trueConfiguration:
npm run cli configure azureYou'll be prompted for:
- Subscription ID (required)
- Resource Group name (required)
- Azure region (default: eastus)
- Container Registry name (required)
- Service Principal credentials (optional)
Coming soon! E2B provider implementation is planned.
# Create sandbox with default provider
npm run cli create ./my-app
# Create sandbox with specific provider
npm run cli create ./my-app --provider azure
# Create sandbox with custom Dockerfile
npm run cli create ./my-app --dockerfile ./custom.Dockerfile# Deploy to current sandbox
npm run cli deploy ./my-app
# Deploy with custom Dockerfile (optional for updates)
npm run cli deploy ./my-app --dockerfile ./custom.Dockerfile# List all sandboxes (current one highlighted)
npm run cli list
# Select current sandbox
npm run cli select
# Open sandbox in browser
npm run cli browse <sandbox-id>
# Destroy a sandbox
npm run cli destroy <sandbox-id>Run commands directly in your deployed sandbox environments without needing to access them through other means:
# Execute basic commands
npm run cli execute "ls -la"
npm run cli execute "pwd"
npm run cli execute "npm install"
# Execute commands with custom working directory
npm run cli execute "ls" --cwd /workspaces/project/src
# Execute long-running commands with custom timeout
npm run cli execute "npm run build" --timeout 600
# Execute commands without real-time streaming (get all output at once)
npm run cli execute "cat package.json" --no-streamCommon Use Cases:
- Development tasks:
npm run cli execute "npm install",npm run cli execute "npm run build" - File operations:
npm run cli execute "ls -la",npm run cli execute "cat config.json" - Process management:
npm run cli execute "ps aux",npm run cli execute "top" - Git operations:
npm run cli execute "git status",npm run cli execute "git log --oneline" - System diagnostics:
npm run cli execute "df -h",npm run cli execute "free -m"
Command Options:
--cwd <directory>- Set working directory (default:/workspaces/project)--timeout <seconds>- Set command timeout (default: 300 seconds)--no-stream- Disable real-time output streaming
Provider Support:
- β Daytona - Full command execution support with real-time streaming
- β Azure Container Instances - Full command execution support with real-time streaming
- β E2B - Coming soon
Capabilities:
- β Real-time output streaming
- β Working directory support
- β Command timeout handling
- β Signal interruption (Ctrl+C)
- β Exit code preservation
- β Both stdout and stderr capture
Limitations:
- Commands run with workspace user permissions
- Interactive commands requiring input may not work as expected
- Some system-level commands may be restricted based on workspace configuration
- Network access depends on Daytona workspace network policies
Best Practices:
- Use absolute paths or paths relative to
/workspaces/project - For long-running processes, consider using
screenortmuxwithin the command - Test commands in Daytona's web terminal first if unsure
Capabilities:
- β Real-time output streaming via Azure exec API
- β Working directory support
- β Command timeout handling
- β Signal interruption (Ctrl+C)
- β Exit code preservation
- β Both stdout and stderr capture
Limitations:
- Commands run with container's default user (usually root)
- Container must be in "Running" state for command execution
- Network access limited to container's network configuration
- Some Azure regions may have exec API limitations
- Container restart will terminate any running commands
Best Practices:
- Verify container status before executing long-running commands
- Use
--timeoutfor commands that might hang - Consider container resource limits for memory/CPU intensive operations
- Check Azure Container Instance logs if commands fail unexpectedly
Planned Capabilities:
- Real-time output streaming
- Working directory support
- Command timeout handling
- Secure sandboxed execution environment
Note: E2B provider implementation is in development. Command execution will be available in a future release.
Here are practical examples for common development scenarios:
# Install dependencies after deploying new code
npm run cli execute "npm install"
# Run build process
npm run cli execute "npm run build"
# Run tests
npm run cli execute "npm test"
# Check application logs
npm run cli execute "tail -f /var/log/app.log" --timeout 60
# Restart application service
npm run cli execute "pm2 restart app"# Check running processes
npm run cli execute "ps aux | grep node"
# Monitor system resources
npm run cli execute "top -n 1"
# Check disk usage
npm run cli execute "df -h"
# Check memory usage
npm run cli execute "free -m"
# View environment variables
npm run cli execute "env | grep NODE"
# Check network connections
npm run cli execute "netstat -tulpn"# List project files
npm run cli execute "find /workspaces/project -type f -name '*.js' | head -10"
# Check file contents
npm run cli execute "cat /workspaces/project/package.json"
# Search for text in files
npm run cli execute "grep -r 'TODO' /workspaces/project/src"
# Check file permissions
npm run cli execute "ls -la /workspaces/project"
# Create backup of important files
npm run cli execute "tar -czf backup.tar.gz /workspaces/project/config"# Check git status
npm run cli execute "git status" --cwd /workspaces/project
# View recent commits
npm run cli execute "git log --oneline -10" --cwd /workspaces/project
# Check current branch
npm run cli execute "git branch" --cwd /workspaces/project
# Pull latest changes (if git is configured)
npm run cli execute "git pull origin main" --cwd /workspaces/project# Connect to database and run query
npm run cli execute "mysql -u user -p database -e 'SHOW TABLES;'"
# Check database connection
npm run cli execute "pg_isready -h localhost -p 5432"
# Run database migrations
npm run cli execute "npm run db:migrate"
# Seed database with test data
npm run cli execute "npm run db:seed"# Check Docker containers (if Docker-in-Docker is available)
npm run cli execute "docker ps"
# Check service status
npm run cli execute "systemctl status nginx"
# View service logs
npm run cli execute "journalctl -u myapp -n 50"
# Restart a service
npm run cli execute "sudo systemctl restart nginx"# 1. Create sandbox once
npm run cli create ./my-app --provider daytona
# 2. Make code changes and deploy iteratively
npm run cli deploy ./my-app
# ... make changes ...
npm run cli deploy ./my-app
# 3. Switch between projects
npm run cli select # choose different sandbox
npm run cli deploy ./other-projectnpm run cli init
# Select your preferred default providerYour application folder must contain:
- Dockerfile - Defines how to build your application
- Application code - Your source code files
- Dependencies - Package files (package.json, requirements.txt, etc.)
Example Dockerfile:
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["npm", "start"]Configuration is stored in ~/.sandbox-cli/config.json:
{
"defaultProvider": "daytona",
"providers": {
"daytona": {
"apiKey": "your-api-key",
"serverUrl": "https://app.daytona.io/api",
"target": "eu"
},
"azure": {
"subscriptionId": "your-subscription-id",
"resourceGroup": "sandbox-rg",
"location": "eastus",
"containerRegistry": "myregistry"
}
}
}# Build TypeScript
npm run build
# Run tests
npm run test
# Lint code
npm run lint
# Clean build directory
npm run clean# Run in development mode
npm run dev
# Build and run CLI
npm run cli -- <command>"Azure CLI not found"
- Install Azure CLI: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
- Run
az loginto authenticate
"Not logged in to Azure"
az login
az account set --subscription <your-subscription-id>"Container registry not accessible"
- Ensure admin user is enabled:
az acr update --name <registry> --admin-enabled true - Or provide service principal credentials during configuration
"Docker not running"
- Start Docker Desktop or Docker daemon
- Verify with
docker info
"Invalid API key"
- Get a new API key from Daytona dashboard
- Reconfigure:
npm run cli configure daytona
"Sandbox creation failed"
- Check Daytona server status
- Verify your Daytona subscription limits
"No current sandbox selected"
- Run
npm run cli selectto choose an active sandbox - Or create a new sandbox with
npm run cli create <folder>
"Provider does not support command execution"
- Currently supported: Daytona, Azure Container Instances
- E2B support coming soon
- Check provider documentation for limitations
"Sandbox is not running"
- Verify sandbox status with
npm run cli list - Restart sandbox through provider's interface
- For Azure: Check container instance status in Azure portal
- For Daytona: Check workspace status in Daytona dashboard
"Command timeout"
- Increase timeout:
npm run cli execute "command" --timeout 600 - For very long operations, consider running in background
- Check if command is hanging or waiting for input
"Permission denied"
- Commands run with sandbox's default user permissions
- Some system commands may require elevated privileges
- Try alternative commands or check sandbox configuration
"Working directory not found"
- Verify directory exists:
npm run cli execute "ls -la /path" - Use absolute paths or paths relative to
/workspaces/project - Check if project was properly deployed to sandbox
"Command execution failed"
- Check command syntax and arguments
- Verify required tools/packages are installed in sandbox
- Review error output for specific issues
- Test command locally first if possible
"Output not streaming"
- Some commands may buffer output
- Try
--no-streamflag to get all output at once - Check if command produces output (try with
echo "test")
"Dockerfile not found"
- Ensure Dockerfile exists in your project
- Use
--dockerfileflag to specify custom path
"Build failed"
- Check Dockerfile syntax
- Ensure all dependencies are available
- Review build logs for specific errors
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
MIT License - see LICENSE for details.
- Check the troubleshooting section above
- Review configuration in
~/.sandbox-cli/config.json - Check provider-specific documentation
- Open an issue for bugs or feature requests