| name | cloud-run-sandbox |
| description | Guide for creating and managing Google Cloud Run sandboxes using ComputeSDK. Use when building applications that need Google Cloud Run Sandboxes provider for ComputeSDK. |
Google Cloud Run Sandboxes with ComputeSDK
Google Cloud Run Sandboxes provider for ComputeSDK.
Setup
npm install computesdk @computesdk/cloud-run
Set your credentials:
CLOUD_RUN_AUTH_TOKEN=your_cloud_run_auth_token
CLOUD_RUN_SANDBOX_BINARY=your_cloud_run_sandbox_binary
CLOUD_RUN_SANDBOX_SECRET=your_cloud_run_sandbox_secret
CLOUD_RUN_SANDBOX_URL=your_cloud_run_sandbox_url
Quick Start
import { compute } from 'computesdk';
import { cloudRun } from '@computesdk/cloud-run';
compute.setConfig({
provider: cloudRun({
gatewayAuthToken: process.env.CLOUD_RUN_AUTH_TOKEN,
sandboxBinary: process.env.CLOUD_RUN_SANDBOX_BINARY,
sandboxUrl: process.env.CLOUD_RUN_SANDBOX_URL,
}),
});
const sandbox = await compute.sandbox.create();
const result = await sandbox.runCommand('echo "Hello from Google Cloud Run!"');
console.log(result.stdout);
await sandbox.destroy();
You can also call the provider factory directly:
import { cloudRun } from '@computesdk/cloud-run';
const sdk = cloudRun({
gatewayAuthToken: process.env.CLOUD_RUN_AUTH_TOKEN,
sandboxBinary: process.env.CLOUD_RUN_SANDBOX_BINARY,
sandboxUrl: process.env.CLOUD_RUN_SANDBOX_URL,
});
const sandbox = await sdk.sandbox.create();
Google Cloud Run Configuration
interface CloudRunConfig {
sandboxUrl?: string
sandboxSecret?: string
gatewayAuthToken?: string
executionMode?: CloudRunExecutionMode
sandboxBinary?: string
mode?: 'local' | 'container'
allowEgress?: boolean
rootfs?: string
workdir?: string
template?: string
persistDir?: string
overlayDir?: string
?:
?: []
?: <, >
?: []
?: []
?: []
}
Full API
ComputeSDK exposes the same universal sandbox API across providers: sandbox.create(), sandbox.getById(), sandbox.destroy(), sandbox.runCommand(), sandbox.getInfo(), sandbox.getUrl(), and sandbox.filesystem.*.
Install the main skill for the complete reference:
npx skills add https://github.com/computesdk/sandbox-skills --skill computesdk
Or see https://www.computesdk.com/docs/reference/sandbox/.