Run commands and move files

exec

miosa exec [name|id] -- <cmd> [args...] [flags]

Run a command inside a sandbox and print its output. miosa exits with the remote command’s exit code, so it drops straight into scripts and CI. The -- separator is required before the command.

miosa exec my-box -- echo hello
miosa exec -- ls -la /home                              # uses the current sandbox
miosa exec my-box --cwd my-repo --timeout 120 -- npm run build
miosa exec my-box -- bash -c 'for i in 1 2 3; do echo $i; done'

--cwd sets the working directory, relative to the sandbox home directory (or absolute). The global --timeout also bounds the command: seconds, 1 to 300, default 30, and 0 means the 300 second maximum.

A sandbox that is still starting refuses commands. exec retries with backoff until it is ready, up to 90 seconds.

ssh

miosa ssh my-box
miosa ssh my-box -- bash -lc "cd app && npm test"
miosa ssh my-box -- bash -s < ./setup.sh

miosa ssh runs the system ssh through the authenticated tunnel with a one-time key and a short-lived certificate (15 minutes, valid for that sandbox only). Where the server has no certificate authority it authorizes the one-time key in the sandbox instead. The key, certificate and host file live in a private temporary directory removed when ssh ends.

Standard input is piped through, up to 80KB. --api runs the command over the MIOSA API instead, and so does a machine without ssh. There is no interactive login shell yet.

ssh user@host and scp against a sandbox directly do not work: there is no public SSH endpoint.

console

miosa console my-box

An interactive shell in a sandbox using the miosa-terminal-v1 WebSocket relay, with a real PTY, resize handling and the remote exit code.

files

miosa files [command]

Remote paths are written <sandbox>:<path>. The sandbox may be a name or id, and can be omitted for the current sandbox. Relative remote paths start in /home/user.

miosa files ls my-box:/workspace
miosa files cp ./app.py my-box:/workspace/app.py
miosa files cp -r ./src my-box:/workspace/
miosa files cp my-box:/workspace/out.json ./out.json
miosa files cat my-box:/workspace/out.json
cat config.yaml | miosa files write my-box:/workspace/config.yaml
CommandWhat it does
files ls [-l] <path>List a directory (-l shows modification times)
files cp [-r] <src> <dst>Copy local to remote, remote to local, or remote to remote
files cat <path>Print a file
files write <path>Write stdin to a file, creating parent directories
files mkdir <path>Create a directory and its parents
files mv <from> <to>Move or rename (alias rename)
files rm [-r] [-f] <path>...Delete files or directories
files chmod <mode> <path>Change permissions (octal, for example 755)
files stat <path>Type, size, mode and modification time

A directory needs -r. A path that does not exist is an error unless -f is given.

Background processes

miosa process start --name build --cwd /workspace/app -- npm run build
miosa process list
miosa ps
miosa process logs <pid> --tail 50
miosa process kill <pid>
miosa process get <pid>

miosa ps is the same as miosa process list.

Services

Long-lived named services in a sandbox.

miosa services create --name web --command "npm run dev" --cwd /workspace/app
miosa services list
miosa services logs web --tail 100
miosa services restart web
miosa services stop web

Logs and events

miosa logs my-box -n 100 -f     # system log, follow
miosa events my-box             # stream lifecycle events

Ports, previews and URLs

miosa ports my-box
miosa preview create my-box 3000 --visibility public
miosa preview list
miosa url my-box
miosa url update my-box --auth tenant

miosa preview publishes a sandbox port at a public URL (--visibility private|public, --ttl, --name). miosa url prints the public URL for a sandbox.

Proxy

miosa proxy my-box 5432:5432

Forwards local ports to sandbox ports over a WebSocket tunnel (any TCP service; the key needs sandboxes:exec).

Desktop

miosa desktop start my-box
miosa desktop url my-box
Was this page helpful?