From bbdbae9481c310cdc4090a37d90a7dbc795ae614 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 21 Sep 2026 06:46:50 +0000 Subject: [PATCH] docs(website): sync dev docs from 1905069948f96921daf88bffb160dceb9ac2a307 --- fern/.docs-snapshots.yml | 6 +- fern/pages-dev/sandboxes/manage-sandboxes.mdx | 63 +++++++++++++++++++ 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/fern/.docs-snapshots.yml b/fern/.docs-snapshots.yml index fc3c20e02..97bac82ac 100644 --- a/fern/.docs-snapshots.yml +++ b/fern/.docs-snapshots.yml @@ -1,8 +1,8 @@ snapshots: dev: - source-ref: 29e89a2f2289ad538c195e136baaaac2a92a3a2e - source-sha: 29e89a2f2289ad538c195e136baaaac2a92a3a2e - version: 0.0.117.dev212 + source-ref: 1905069948f96921daf88bffb160dceb9ac2a307 + source-sha: 1905069948f96921daf88bffb160dceb9ac2a307 + version: 0.0.117.dev213 latest: source-ref: e36d2315cab8b638e3b718d6cc9d6146e732c2ad source-sha: e36d2315cab8b638e3b718d6cc9d6146e732c2ad diff --git a/fern/pages-dev/sandboxes/manage-sandboxes.mdx b/fern/pages-dev/sandboxes/manage-sandboxes.mdx index 7627a8765..056332c37 100644 --- a/fern/pages-dev/sandboxes/manage-sandboxes.mdx +++ b/fern/pages-dev/sandboxes/manage-sandboxes.mdx @@ -453,6 +453,69 @@ with SandboxClient.from_active_cluster(client_credentials=auth) as client: Service forwarding makes a long-running process inside a sandbox reachable through a gateway-managed URL. Use it for development servers, notebooks, dashboards, or other services that keep listening after the sandbox starts. Run the service on loopback inside the sandbox, expose its port, then open the URL printed by OpenShell. +Expose the unnamed service as part of sandbox creation when the sandbox's main +process starts the server: + +```shell +openshell sandbox create \ + --name my-sandbox \ + --expose 8080 \ + --detach \ + -- python -m http.server 8080 --bind 127.0.0.1 +``` + +The CLI includes the unnamed endpoint in the sandbox create request and prints +its URL after the sandbox reaches `Ready`. `--expose` keeps the sandbox after +the create command returns and cannot be combined with `--no-keep`. Use +`openshell service expose` to add or update an endpoint later. + +SDK create methods accept named or unnamed service exposures. An empty service +name selects the unnamed endpoint. The returned sandbox includes a service URL +map keyed by those names; use the empty key for the unnamed endpoint: + +```python +from openshell import SandboxClient, ServiceExposure + +with SandboxClient.from_active_cluster() as client: + sandbox = client.create( + workspace="default", + name="app-server", + service_exposures=[ServiceExposure(target_port=4500)], + ) + print(sandbox.service_urls[""]) +``` + +```ts +const sandbox = await client.sandbox.create({ + name: 'app-server', + image: 'base', + serviceExposures: [{ targetPort: 4500 }], +}) +console.log(sandbox.serviceUrls['']) +``` + +```go +sandbox, err := client.Sandboxes().Create( + ctx, "default", "app-server", spec, nil, + v1.CreateOptions{ServiceExposures: []v1.ServiceExposure{ + {TargetPort: 4500}, + }}, +) +fmt.Println(sandbox.ServiceURLs[""]) +``` + +```rust +let sandbox = client.create_sandbox(openshell_sdk::SandboxSpec { + name: Some("app-server".into()), + service_exposures: vec![openshell_sdk::ServiceExposure { + service: String::new(), + target_port: 4500, + }], + ..Default::default() +}).await?; +println!("{}", sandbox.service_urls[""]); +``` + Expose a service that listens on loopback inside the sandbox: ```shell