### Example Setup Script for MicroVM Customization Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/production/dbos-cloud/application-management.md This bash script demonstrates how to install system packages, such as 'traceroute', within the microVM before your application starts. This requires a DBOS Pro subscription. ```bash #!/bin/bash # Install the traceroute package for use in your application apt install traceroute ``` -------------------------------- ### Install DBOS and Initialize Example App Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/quickstart.md Installs the DBOS library and FastAPI, then initializes a starter application. This is a prerequisite for running DBOS applications. ```shell pip install dbos 'fastapi[standard]' dbos init --template dbos-app-starter ``` -------------------------------- ### Start Local Development Server Source: https://github.com/dbos-inc/dbos-docs/blob/main/README.md Install dependencies and launch the local development server for the documentation site. ```bash npm install npm run start ``` -------------------------------- ### Configure Application Runtime and Setup Script Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/production/dbos-cloud/application-management.md Specify the command to start your application and an optional setup script for customizing the microVM environment in `dbos-config.yaml`. The setup script requires a DBOS Pro subscription. ```yaml runtimeConfig: # Script DBOS Cloud runs to customize your application runtime. # Requires a DBOS Pro subscription. setup: - "./build.sh" # Command DBOS Cloud executes to start your application. start: ``` -------------------------------- ### Start Workflow Example (Registered Workflow) Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/reference/methods.md Demonstrates how to start a previously registered workflow using its handle and providing input arguments. ```typescript async function example(input: number) { // Call steps } const exampleWorkflow = DBOS.registerWorkflow(example); const input = 10; const handle = await DBOS.startWorkflow(exampleWorkflow)(input); ``` -------------------------------- ### Install DBOS CLI and Start Postgres Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/integrating-dbos.md Install the DBOS Go CLI and start a Postgres database in a Docker container using these commands. ```shell go install github.com/dbos/dbos-transact-golang/cmd/dbos@latest dbos postgres start ``` -------------------------------- ### Start Workflow Example (Decorator) Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/reference/methods.md Shows how to start a workflow defined using the @DBOS.workflow() decorator, referencing the class and static method. ```typescript export class Example { @DBOS.workflow() static async exampleWorkflow(input: number) { // Call steps } } const input = 10; const handle = await DBOS.startWorkflow(Example).exampleWorkflow(input); ``` -------------------------------- ### Example Workflow Execution Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/prompting.md Demonstrates how to run a workflow, retrieve its handle, and then get its result. Includes error handling for both running the workflow and getting the result. ```go func workflow(ctx dbos.DBOSContext, input string) (string, error) { return "success", nil } func example(input string) error { handle, err := dbos.RunWorkflow(dbosContext, workflow, input) if err != nil { return err } result, err := handle.GetResult() if err != nil { return err } fmt.Println("Workflow result:", result) return nil } ``` -------------------------------- ### Temporal Workflow Starting Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/explanations/migrating-from-temporal.md Example of starting a Temporal workflow using the Python client. Requires connection to a Temporal server. ```python client = await Client.connect("localhost:7233") handle = await client.start_workflow( OrderWorkflow.run, order, id="order-123", task_queue="orders", ) result = await handle.result() ``` -------------------------------- ### Install DBOS Transact Go Library Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/integrating-dbos.md Use 'go get' to add the DBOS Transact Go library to your project dependencies. ```shell go get github.com/dbos/dbos-transact-golang ``` -------------------------------- ### Start Node.js Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/quickstart.md After setting up the database, start your Node.js application using this command. Visit http://localhost:3000/ to test its functionality. ```bash npm run start ``` -------------------------------- ### Queue Registration Example Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/python/prompting.md Example of registering a DBOS queue with a specific name. ```python DBOS.register_queue("example_queue") ``` -------------------------------- ### Start the Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/examples/checkout-tutorial.md This command starts the DBOS and Fastify server. Once running, the application can be accessed at http://localhost:3000. ```shell npm run start ``` -------------------------------- ### Launch DBOS and FastAPI Server Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/python/examples/widget-store.md This snippet shows how to launch the DBOS runtime and start the FastAPI server using uvicorn. Ensure DBOS is installed and configured before running. ```python import uvicorn from dbos import DBOS if __name__ == "__main__": DBOS.launch() uvicorn.run(app, host="0.0.0.0", port=8000) ``` -------------------------------- ### Start DBOS Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/reference/cli.md Starts your DBOS application by executing the `start` command defined in `dbos-config.yaml`. ```APIDOC ## npx dbos start ### Description Start your DBOS application by executing the `start` command defined in [`dbos-config.yaml`](./configuration.md). For example: ```yaml runtimeConfig: start: - "node dist/main.js" ``` DBOS Cloud executes this command to start your app. ### Method CLI Command ### Endpoint N/A ### Parameters N/A ``` -------------------------------- ### Start DBOS Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/python/reference/cli.md Execute the `dbos start` command to initiate your DBOS application. This command runs the 'start' script defined in your `dbos-config.yaml` file, which is used by DBOS Cloud to launch your application. ```yaml runtimeConfig: start: - "fastapi run" ``` -------------------------------- ### Initialize and Launch DBOS App with Koa Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/upgrading.md This TypeScript code demonstrates the setup for a DBOS application using Koa. It includes setting application configuration, launching the DBOS runtime, registering Koa with DBOS, and starting the server. The port is now managed via environment variables. ```typescript // Note that port is no longer set in the runtime, // and should come from the environment and default to 3000 const PORT = parseInt(process.env.NODE_PORT ?? '3000'); async function main() { DBOS.setConfig({ "name": "alert-center", // Setting app name is required }); await DBOS.launch(); DBOS.logRegisteredEndpoints(); const app = new Koa(); const appRouter = new Router(); dkoa.registerWithApp(app, appRouter); app.listen(PORT, () => { console.log(`Server running at http://localhost:${PORT}`); }); } main().then(()=>{}).catch(console.error); ``` -------------------------------- ### Build and Start DBOS App Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/typescript/programming-guide.md Build the TypeScript project and start the DBOS application. ```shell npm run build npm run start ``` -------------------------------- ### Install Databricks SDK Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/integrations/lakebase.md Install the required Python SDK for programmatic OAuth token generation. ```shell pip install databricks-sdk ``` -------------------------------- ### Initialize Go Project and Install DBOS Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/programming-guide.md Initialize a new Go module and install the DBOS Go SDK. This is the first step in setting up your DBOS Go application. ```shell go mod init dbos-starter go get github.com/dbos-inc/dbos-transact-golang/dbos ``` -------------------------------- ### Run Workflow on Specific Instance Example Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/prompting.md Example of running a workflow method on a specific instance using the WithRunInstance option. ```go handle, err := dbos.RunWorkflow(ctx, slack.Send, input, dbos.WithRunInstance(slack)) ``` -------------------------------- ### Example DBOS Client Initialization Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/reference/client.md Demonstrates how to initialize a DBOS Client using environment variables for the database URL. Ensure the DBOS_SYSTEM_DATABASE_URL environment variable is set. ```go config := dbos.ClientConfig{ DatabaseURL: os.Getenv("DBOS_SYSTEM_DATABASE_URL"), } client, err := dbos.NewClient(context.Background(), config) if err != nil { log.Fatal(err) } defer client.Shutdown(5 * time.Second) ``` -------------------------------- ### Initialize Go Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/quickstart.md Install the DBOS Go CLI and initialize a starter application. This requires Go 1.23.0 or higher. After initialization, navigate into the application directory. ```shell go install github.com/dbos-inc/dbos-transact-golang/cmd/dbos@latest dbos init cd dbos-toolbox ``` -------------------------------- ### Example: Creating a Schedule Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/golang/reference/client.md Illustrates how to create a new schedule by providing a `ClientScheduleInput` with schedule name, target workflow, cron expression, and context. ```go err := client.CreateSchedule(dbos.ClientScheduleInput{ ScheduleName: "my-schedule", WorkflowName: "myPeriodicTask", Schedule: "*/5 * * * *", Context: "my context", }) ``` -------------------------------- ### Start Workflow with No Timeout Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/java/reference/methods.md Example of starting a child workflow and explicitly disabling its timeout using `Timeout.none()`, detaching it from the parent's timeout settings. ```java dbos.startWorkflow(() -> proxy.longRunningChild(), new StartWorkflowOptions().withTimeout(Timeout.none())); ``` -------------------------------- ### DBOS Python Workflow Starting (In-App) Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/explanations/migrating-from-temporal.md Example of starting a DBOS workflow directly within the application using Python. Uses `SetWorkflowID` for idempotency. ```python # Starting a workflow from in your application with SetWorkflowID("order-123"): handle = DBOS.start_workflow(order_workflow, order) result = handle.get_result() ``` -------------------------------- ### Download and Set Up DBOS Java Starter App Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/quickstart.md Clone the DBOS demo applications repository and navigate to the Java starter directory. Ensure you have Java 17 or higher installed. ```shell git clone https://github.com/dbos-inc/dbos-demo-apps.git cd dbos-demo-apps/java/dbos-starter ``` -------------------------------- ### Start Workflow with a Specific ID Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/java/prompting.md Starts a workflow and assigns it a globally unique ID, which also serves as an idempotency key. Ensure the Example interface and ExampleImpl class are defined. ```java class ExampleImpl implements Example { @Workflow public String exampleWorkflow() { System.out.println("Running workflow with ID: " + DBOS.workflowId()); // ... return "success"; } } public void example(DBOS dbos, Example proxy) throws Exception { String myID = "unique-workflow-id-123"; WorkflowHandle handle = dbos.startWorkflow( () -> proxy.exampleWorkflow(), new StartWorkflowOptions().withWorkflowId(myID) ); String result = handle.getResult(); System.out.println("Result: " + result); } ``` -------------------------------- ### Instantiate and Launch DBOS with a Workflow Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/python/reference/dbos-class.md This example shows how to configure DBOS with a name and system database URL, instantiate the DBOS class, launch it, and then execute a simple workflow consisting of two steps. Ensure the DBOS_SYSTEM_DATABASE_URL environment variable is set. ```python import os from dbos import DBOS, DBOSConfig @DBOS.step() def step_one(): print("Step one completed!") @DBOS.step() def step_two(): print("Step two completed!") @DBOS.workflow() def dbos_workflow(): step_one() step_two() # Configure and launch DBOS, then run a workflow. if __name__ == "__main__": config: DBOSConfig = { "name": "dbos-starter", "system_database_url": os.environ.get("DBOS_SYSTEM_DATABASE_URL"), } DBOS(config=config) DBOS.launch() dbos_workflow() ``` -------------------------------- ### Install DBOS and OpenAI Agents Integration Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/ai/ai-quickstart.md Install the DBOS library and the durable OpenAI agents integration package. This setup is required for running OpenAI agents with DBOS durability. ```shell pip install dbos dbos-openai-agents ``` -------------------------------- ### Initialize DBOS Application Source: https://github.com/dbos-inc/dbos-docs/blob/main/docs/python/reference/cli.md Use `dbos init` to set up a new DBOS application in your local directory. You can specify an application name and choose from various templates like 'dbos-toolbox', 'dbos-app-starter', 'dbos-cron-starter', or 'dbos-db-starter'. The `--config` flag allows adding only the `dbos-config.yaml` file to an existing project. ```bash dbos init -t