### Skip install step Source: https://sahabti.com/en/docs/build-configuration Sets installCommand to an empty string to skip dependency installation because dependencies are vendored. ```json { "installCommand": "" } ``` -------------------------------- ### Publish static site Source: https://sahabti.com/en/docs/build-configuration Configures buildCommand, startCommand, and outputDir to serve a static site. With no start command, the output directory is served as files. ```json { "buildCommand": "npm run build", "startCommand": "", "outputDir": "dist" } ``` -------------------------------- ### Example sahabti.json configuration Source: https://sahabti.com/en/docs/build-configuration A complete example of a sahabti.json file showing all available fields. The file is optional and every field is optional. It is placed at the app's root directory. An empty string for a field means 'don't do this at all', which is different from omitting the field. ```json { "framework": "nextjs", "installCommand": "pnpm install --frozen-lockfile", "buildCommand": "pnpm run build", "startCommand": "pnpm run start", "outputDir": "", "dockerfilePath": "", "nodeVersion": "22" } ``` -------------------------------- ### _headers file example Source: https://sahabti.com/en/docs/web-app-runtime Example of a _headers file with a path followed by indented header rules. 'Name: value' sets a header, '! Name' removes one. Paths may use * anywhere. Later rules override earlier ones for the same header. ```text /* X-Frame-Options: DENY /assets/* Cache-Control: public, max-age=86400 ! X-Powered-By ``` -------------------------------- ### POST /v1/kubernetes/clusters/{id}/upgrades/{upgradeId}/start-now Source: https://sahabti.com/en/docs/kubernetes-upgrades Starts a waiting upgrade immediately. Requires the kubernetes:update permission. ```APIDOC ## POST /v1/kubernetes/clusters/{id}/upgrades/{upgradeId}/start-now ### Description Starts a waiting upgrade immediately. Does not work on upgrades scheduled by the Sahabti team or a fleet run. ### Method POST ### Endpoint /v1/kubernetes/clusters/{id}/upgrades/{upgradeId}/start-now ### Parameters #### Path Parameters - **id** (string) - Required - The cluster ID. - **upgradeId** (string) - Required - The upgrade ID. ### Response #### Success Response (200) - **status** (string) - Confirmation message. ### Permissions Requires `kubernetes:update`. ``` -------------------------------- ### Connect to cluster with kubectl using downloaded kubeconfig Source: https://sahabti.com/en/docs/get-started-kubernetes Sets the KUBECONFIG environment variable to the downloaded kubeconfig file, then verifies authentication with 'kubectl auth whoami' and lists nodes with 'kubectl get nodes'. The kubeconfig carries your role and renews credentials using 'sh' and 'curl'; on machines without them, choose the 12-hour kubeconfig instead. Listing nodes requires the Admin role; editors or viewers should run 'kubectl get pods'. ```bash export KUBECONFIG=~/Downloads/shop.kubeconfig kubectl auth whoami kubectl get nodes ``` -------------------------------- ### GET /v1/servers Source: https://sahabti.com/en/docs/api-tokens Lists servers (instances) in a workspace. Requires the x-api-key header with a valid API token. ```APIDOC ## GET /v1/servers ### Description Lists servers (instances) in a workspace. Requires the x-api-key header with a valid API token. ### Method GET ### Endpoint https://api.sahabti.com/v1/servers ### Parameters #### Query Parameters - **orgId** (string) - Required - The workspace ID. ### Request Example ```bash curl "https://api.sahabti.com/v1/servers?orgId=$WORKSPACE_ID" \ -H "x-api-key: $SAHABTI_TOKEN" ``` ### Response #### Success Response (200) - **servers** (array) - List of server objects. #### Response Example (Not provided in source) ``` -------------------------------- ### _redirects file example Source: https://sahabti.com/en/docs/web-app-runtime Example of a _redirects file with one rule per line in the format 'from to [status]'. Status can be 301, 302, 303, 307, or 308, defaulting to 302. Lines starting with # and blank lines are ignored. ```text /old-pricing /pricing 301 /blog/* /articles/:splat 301 /docs https://docs.example.com/ ``` -------------------------------- ### Create a server instance with x-api-key header Source: https://sahabti.com/en/docs/api-tokens Use this curl command to create a server instance, attaching the API token as the x-api-key header. The request includes a JSON body with engine, name, plan, and orgId. The $WORKSPACE_ID and $SAHABTI_TOKEN environment variables must be set. ```bash curl -X POST https://api.sahabti.com/v1/servers \ -H "x-api-key: $SAHABTI_TOKEN" \ -H "Content-Type: application/json" \ -d '{"engine":"postgres","name":"orders","plan":"small","orgId":"'"$WORKSPACE_ID"'"}' ``` -------------------------------- ### Apply and inspect the LoadBalancer Service Source: https://sahabti.com/en/docs/kubernetes Commands to apply the web-service.yaml file and get the Service details. The Service gets a platform load balancer on the workspace's public address, and traffic is spread over every worker. ```bash kubectl apply -f web-service.yaml kubectl get service web ``` -------------------------------- ### Create a Deployment and delete a bare pod Source: https://sahabti.com/en/docs/kubernetes-insights Create a Deployment to manage a pod that has no controller, wait for it to be ready, then delete the bare pod. ```bash kubectl -n create deployment --image= --replicas=2 kubectl -n rollout status deployment/ kubectl -n delete pod ``` -------------------------------- ### Apply deployment and list pods Source: https://sahabti.com/en/docs/kubernetes-node-pools Commands to apply the trainer Deployment and list its pods with wide output to verify they run on the gpu pool workers. ```bash kubectl apply -f trainer.yaml kubectl get pods -l app=trainer -o wide ``` -------------------------------- ### POST /v1/servers Source: https://sahabti.com/en/docs/api-tokens Creates a new server (instance) in a workspace. Requires the x-api-key header and a JSON request body with engine, name, plan, and orgId. ```APIDOC ## POST /v1/servers ### Description Creates a new server (instance) in a workspace. Requires the x-api-key header and a JSON request body with engine, name, plan, and orgId. ### Method POST ### Endpoint https://api.sahabti.com/v1/servers ### Parameters #### Request Body - **engine** (string) - Required - The database engine (e.g., postgres). - **name** (string) - Required - The name of the instance. - **plan** (string) - Required - The plan size (e.g., small). - **orgId** (string) - Required - The workspace ID. ### Request Example ```bash curl -X POST https://api.sahabti.com/v1/servers \ -H "x-api-key: $SAHABTI_TOKEN" \ -H "Content-Type: application/json" \ -d '{"engine":"postgres","name":"orders","plan":"small","orgId":"'"$WORKSPACE_ID"'"}' ``` ### Response #### Success Response (201) - **server** (object) - The created server object. #### Response Example (Not provided in source) ``` -------------------------------- ### GET /v1/apps/{id}/processes Source: https://sahabti.com/en/docs/web-app-runtime Reads the running processes of an app. ```APIDOC ## GET /v1/apps/{id}/processes ### Description Reads the running processes of an app. ### Method GET ### Endpoint /v1/apps/{id}/processes ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the app. ### Response #### Success Response (200) - **processes** (array) - List of running processes. #### Response Example { "processes": [ { "name": "web", "status": "running" } ] } ``` -------------------------------- ### GET /v1/apps/{id}/logs Source: https://sahabti.com/en/docs/web-app-runtime Reads logs for an app with filtering and pagination options. ```APIDOC ## GET /v1/apps/{id}/logs ### Description Reads logs for an app. Supports time range, line limit, filtering, stream selection, process filtering, and cursor-based pagination. ### Method GET ### Endpoint /v1/apps/{id}/logs ### Parameters #### Path Parameters - **id** (string) - Required - The ID of the app. #### Query Parameters - **since** (string) - Optional - Time range: `15m`, `6h`, `24h`, or a timestamp. - **tail** (integer) - Optional - Number of lines to return, up to 1,000. - **filter** (string) - Optional - Filter logs by a string. - **stream** (string) - Optional - Stream type: `stdout`, `stderr`, or `all`. - **process** (string) - Optional - Process name to filter logs. - **cursor** (string) - Optional - Cursor from the last response to read only newer lines. ### Response #### Success Response (200) - **logs** (array) - List of log lines. - **cursor** (string) - Cursor for the next page. #### Response Example { "logs": [ { "timestamp": "2024-01-01T00:00:00Z", "stream": "stdout", "message": "Server started" } ], "cursor": "abc123" } ``` -------------------------------- ### GET /v1/kubernetes/clusters/{id}/gateway/security/events Source: https://sahabti.com/en/docs/kubernetes-gateway-security Returns the events log, newest first. Supports filtering and pagination. ```APIDOC ## GET /v1/kubernetes/clusters/{id}/gateway/security/events ### Description Returns the events log, newest first. Supports filtering and pagination. ### Method GET ### Endpoint /v1/kubernetes/clusters/{id}/gateway/security/events ### Parameters #### Path Parameters - **id** (string) - Required - The cluster ID. #### Query Parameters - **from** (string) - Optional - Start time. - **to** (string) - Optional - End time. - **hostname** (string) - Optional - Filter by hostname. - **kind** (string) - Optional - Filter by event kind. - **ruleId** (string) - Optional - Filter by rule ID. - **clientIp** (string) - Optional - Filter by client IP. - **limit** (integer) - Optional - Max events per page, up to 500. - **cursor** (string) - Optional - Pass the response's `next` as cursor for the next page. ### Response #### Success Response (200) - **events** (array) - List of events. - **next** (string) - Cursor for the next page. ``` -------------------------------- ### Deploy a workload with kubectl create deployment Source: https://sahabti.com/en/docs/kubernetes Create a deployment named web using the nginx:1.27-alpine image with two replicas, then list pods with wide output to see their details. ```bash kubectl create deployment web --image=nginx:1.27-alpine --replicas=2 kubectl get pods -o wide ``` -------------------------------- ### GET /v1/networks?orgId=$WORKSPACE_ID Source: https://sahabti.com/en/docs/get-started-networking Lists the network configuration for a workspace, including inbound rules and public endpoints. ```APIDOC ## GET /v1/networks?orgId=$WORKSPACE_ID ### Description Lists the workspace's network configuration, including inbound rules and public endpoints. ### Method GET ### Endpoint /v1/networks?orgId=$WORKSPACE_ID ### Parameters #### Query Parameters - **orgId** (string) - Required - The workspace ID. ### Response #### Success Response (200) - **network** (object) - The network configuration for the workspace. #### Response Example { "network": {} } ```