You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/python/integrating-dbos.md
+9-7
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,17 @@ This guide shows you how to add the open-source [DBOS Transact](https://github.c
8
8
9
9
### 1. Install DBOS
10
10
`pip install` DBOS into your application.
11
-
Then, create a DBOS configuration file (this file is optional but is used by tooling like the DBOS CLI and debugger).
12
11
13
12
```shell
14
13
pip install dbos
15
-
dbos init my-app --config
14
+
```
15
+
16
+
DBOS requires a Postgres database.
17
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string (later we'll pass that value into DBOS).
18
+
Otherwise, you can start Postgres in a Docker container with this command:
19
+
20
+
```shell
21
+
dbos postgres start
16
22
```
17
23
18
24
### 2. Add the DBOS Initializer
@@ -36,11 +42,7 @@ DBOS.launch()
36
42
### 3. Start Your Application
37
43
38
44
Try starting your application.
39
-
When `DBOS.launch()` is called, it will attempt to connect to a Postgres database.
40
-
If your project already uses Postgres, set the `DBOS_DATABASE_URL` environment variable to a connection string to your Postgres database.
41
-
Otherwise, DBOS will automatically guide you through launching a new Postgres database (using Docker if available, else DBOS Cloud) and connecting to it.
42
-
43
-
After you've connected to Postgres, your app should run normally, but log `Initializing DBOS` and `DBOS launched!` on startup.
45
+
If everything is set up correctly, your app should run normally, but log `Initializing DBOS` and `DBOS launched!` on startup.
44
46
Congratulations! You've integrated DBOS into your application.
Copy file name to clipboardExpand all lines: docs/python/programming-guide.md
+13-17
Original file line number
Diff line number
Diff line change
@@ -35,10 +35,18 @@ cd dbos-starter
35
35
</TabItem>
36
36
</Tabs>
37
37
38
-
Then, install DBOS and create a DBOS configuration file:
38
+
Then, install DBOS:
39
+
39
40
```shell
40
41
pip install dbos
41
-
dbos init dbos-starter --config
42
+
```
43
+
44
+
DBOS requires a Postgres database.
45
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string (later we'll pass that value into DBOS).
46
+
Otherwise, you can start Postgres in a Docker container with this command:
47
+
48
+
```shell
49
+
dbos postgres start
42
50
```
43
51
44
52
## 2. Workflows and Steps
@@ -82,10 +90,6 @@ If your program crashes or is interrupted, DBOS uses this saved state to recover
82
90
Thus, DBOS makes your application **resilient to any failure**.
83
91
84
92
Now, run this code with `python3 main.py`.
85
-
When DBOS is launched, it attempts to connect to a Postgres database.
86
-
If you already use Postgres, set the `DBOS_DATABASE_URL` environment variable to a connection string to your Postgres database.
87
-
Otherwise, DBOS will automatically guide you through launching a new Postgres database (using Docker if available, else DBOS Cloud) and connecting to it.
88
-
89
93
Your program should print output like:
90
94
91
95
```shell
@@ -327,20 +331,12 @@ This creates a `migrations/` directory in your application.
327
331
Next, add the following code to `migrations/env.py` right before the `run_migrations_offline` function:
Copy file name to clipboardExpand all lines: docs/python/reference/dbos-class.md
-35
Original file line number
Diff line number
Diff line change
@@ -38,11 +38,6 @@ Should be called after all decorators run.
38
38
**You should not call a DBOS function until after DBOS is launched.**
39
39
If a FastAPI app is passed into the `DBOS` constructor, `launch` is called automatically during FastAPI setup.
40
40
41
-
`DBOS.launch()` connects your app to a Postgres database.
42
-
It looks for database connection parameters in your [`dbos-config.yaml`](./configuration.md) and `.dbos/db_connection` files.
43
-
If those parameters are set to default values and no database is found, it prompts you to launch a local Postgres database using Docker.
44
-
If Docker is not found, it prompts you to connect to a database hosted on DBOS Cloud.
45
-
46
41
**Example:**
47
42
```python
48
43
from dbos importDBOS
@@ -108,33 +103,3 @@ Destroy the DBOS [system database](../../explanations/how-workflows-work.md), re
108
103
Useful when testing a DBOS application to reset the internal state of DBOS between tests.
109
104
For example, see its use in the [testing tutorial](../tutorials/testing.md).
110
105
**This is a destructive operation and should only be used in a test environment.**
111
-
112
-
## Configuration Management
113
-
114
-
### load_config
115
-
116
-
```python
117
-
load_config(
118
-
config_file_path: str="dbos-config.yaml",
119
-
use_db_wizard: bool=True
120
-
) -> ConfigFile:
121
-
```
122
-
123
-
Load and parse a DBOS configuration file into a `ConfigFile` object.
124
-
125
-
**Parameters:**
126
-
-`config_file_path`: The path to the DBOS configuration file to parse.
127
-
-`use_db_wizard`: If the configuration file specifies default database connection parameters and there is no Postgres database there, whether to prompt the user to connect to a different database.
128
-
129
-
### get_dbos_database_url
130
-
131
-
```python
132
-
get_dbos_database_url(
133
-
config_file_path: str="dbos-config.yaml"
134
-
) ->str
135
-
```
136
-
137
-
Parse database connection information from a DBOS configuration file into a Postgres database connection string.
138
-
139
-
**Parameters:**
140
-
-`config_file_path`: The path to the DBOS configuration file to parse.
DBOS needs a Postgres database to connect to. If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string. Otherwise, you can use the Docker script we provide to start it like so:
78
+
DBOS requires a Postgres database.
79
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string.
80
+
Otherwise, you can start Postgres in a Docker container with this command:
82
81
</article>
83
82
84
83
<articleclassName="col col--6">
85
84
```bash
86
-
export PGPASSWORD=dbos
87
-
python3 start_postgres_docker.py
85
+
dbos postgres start
88
86
```
89
87
</article>
90
88
@@ -94,7 +92,7 @@ Now, start your app!
94
92
95
93
<articleclassName="col col--6">
96
94
```bash
97
-
fastapi run app/main.py
95
+
python3 app/main.py
98
96
```
99
97
</article>
100
98
@@ -104,7 +102,7 @@ To see that your app is working, visit this URL in your browser: http://localhos
104
102
This app lets you test the reliability of DBOS for yourself.
105
103
Launch a durable workflow and watch it execute its three steps.
106
104
At any point, crash the app.
107
-
Then, restart it with `fastapi run app/main.py` and watch it seamlessly recover from where it left off.
105
+
Then, restart it with `python3 app/main.py` and watch it seamlessly recover from where it left off.
108
106
109
107
110
108
Congratulations, you've run your first durable workflow with DBOS!
@@ -171,9 +169,20 @@ npm run build
171
169
172
170
<sectionclassName="row list">
173
171
172
+
<articleclassName="col col--6">
173
+
DBOS requires a Postgres database.
174
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string.
175
+
Otherwise, you can start Postgres in a Docker container with this command:
176
+
</article>
177
+
178
+
<articleclassName="col col--6">
179
+
```bash
180
+
npx dbos postgres start
181
+
```
182
+
</article>
183
+
174
184
<articleclassName="col col--6">
175
185
Now, start your app!
176
-
DBOS will automatically help you launch and connect to a new Postgres database (using Docker if available, else DBOS Cloud).
Copy file name to clipboardExpand all lines: docs/typescript/examples/task-scheduler.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,13 @@ After a bit of launch activity, you will be presented with:
33
33
If you [started out in DBOS Cloud](#running-dbos-task-scheduler-in-dbos-cloud), you can download your code to your development environment. Or, you can [clone the code from the git repository](https://github.com/dbos-inc/dbos-demo-apps) and change to the `typescript/nextjs-calendar` directory.
34
34
35
35
### Setting Up A Database
36
-
DBOS requires a Postgres database. If your local environment is set up with database connection settings, these will be used. If not, the "database wizard" will help establish a connection.
36
+
DBOS requires a Postgres database.
37
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string.
38
+
Otherwise, you can start Postgres in a Docker container with this command:
Copy file name to clipboardExpand all lines: docs/typescript/integrating-dbos.md
+10-6
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Also check out the integration guides for popular TypeScript frameworks:
18
18
`npm install` DBOS into your application. Note that DBOS requires Node.js 20 or later.
19
19
20
20
```shell
21
-
npm install @dbos-inc/dbos-sdk
21
+
npm install @dbos-inc/dbos-sdk@latest
22
22
```
23
23
24
24
Then, enable TypeScript decorators in your `tsconfig.json` file:
@@ -29,6 +29,14 @@ Then, enable TypeScript decorators in your `tsconfig.json` file:
29
29
}
30
30
```
31
31
32
+
DBOS requires a Postgres database.
33
+
If you already have Postgres, you can set the `DBOS_DATABASE_URL` environment variable to your connection string (later we'll pass that value into DBOS).
34
+
Otherwise, you can start Postgres in a Docker container with this command:
35
+
36
+
```shell
37
+
npx dbos postgres start
38
+
```
39
+
32
40
33
41
#### 2. Initialize DBOS in Your App
34
42
@@ -48,11 +56,7 @@ await DBOS.launch();
48
56
#### 3. Start Your Application
49
57
50
58
Try starting your application.
51
-
When `DBOS.launch()` is called, it will attempt to connect to a Postgres database.
52
-
If your project already uses Postgres, set the `DBOS_DATABASE_URL` environment variable to a connection string to your Postgres database.
53
-
Otherwise, DBOS will automatically guide you through launching a new Postgres database (using Docker if available, else DBOS Cloud) and connecting to it.
54
-
55
-
After you've connected to Postgres, your app should run normally, but log `DBOS launched` on startup.
59
+
If everything is set up correctly, your app should run normally, but log `DBOS launched!` on startup.
56
60
Congratulations! You've integrated DBOS into your application.
0 commit comments