Skip to content

Commit de7ec66

Browse files
authored
More Config Updates (#351)
Remove all mentions of the DB Wizard, explicit postgres start commands.
1 parent b5c6a64 commit de7ec66

File tree

10 files changed

+92
-150
lines changed

10 files changed

+92
-150
lines changed

docs/python/integrating-dbos.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ This guide shows you how to add the open-source [DBOS Transact](https://github.c
88

99
### 1. Install DBOS
1010
`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).
1211

1312
```shell
1413
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
1622
```
1723

1824
### 2. Add the DBOS Initializer
@@ -36,11 +42,7 @@ DBOS.launch()
3642
### 3. Start Your Application
3743

3844
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.
4446
Congratulations! You've integrated DBOS into your application.
4547

4648

docs/python/programming-guide.md

+13-17
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ cd dbos-starter
3535
</TabItem>
3636
</Tabs>
3737

38-
Then, install DBOS and create a DBOS configuration file:
38+
Then, install DBOS:
39+
3940
```shell
4041
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
4250
```
4351

4452
## 2. Workflows and Steps
@@ -82,10 +90,6 @@ If your program crashes or is interrupted, DBOS uses this saved state to recover
8290
Thus, DBOS makes your application **resilient to any failure**.
8391

8492
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-
8993
Your program should print output like:
9094

9195
```shell
@@ -327,20 +331,12 @@ This creates a `migrations/` directory in your application.
327331
Next, add the following code to `migrations/env.py` right before the `run_migrations_offline` function:
328332

329333
```python showLineNumbers title="migrations/env.py"
330-
from dbos import get_dbos_database_url
331-
import re
334+
import os
332335
from schema import metadata
333336

334337
target_metadata = metadata
335-
336-
# Programmatically set the sqlalchemy.url field from the DBOS config
337-
# Alembic requires the % in URL-escaped parameters be escaped to %%.
338-
escaped_conn_string = re.sub(
339-
r"%(?=[0-9A-Fa-f]{2})",
340-
"%%",
341-
get_dbos_database_url(),
342-
)
343-
config.set_main_option("sqlalchemy.url", escaped_conn_string)
338+
conn_string = os.environ.get("DBOS_DATABASE_URL", "postgresql+psycopg://postgres:dbos@localhost:5432/dbos_starter")
339+
config.set_main_option("sqlalchemy.url", conn_string)
344340
```
345341

346342
This code imports your table schema into Alembic and tells it to load its database connection parameters from your DBOS configuration file.

docs/python/reference/dbos-class.md

-35
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ Should be called after all decorators run.
3838
**You should not call a DBOS function until after DBOS is launched.**
3939
If a FastAPI app is passed into the `DBOS` constructor, `launch` is called automatically during FastAPI setup.
4040

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-
4641
**Example:**
4742
```python
4843
from dbos import DBOS
@@ -108,33 +103,3 @@ Destroy the DBOS [system database](../../explanations/how-workflows-work.md), re
108103
Useful when testing a DBOS application to reset the internal state of DBOS between tests.
109104
For example, see its use in the [testing tutorial](../tutorials/testing.md).
110105
**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.

docs/quickstart.md

+26-17
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This guide shows you how to install and run it on your computer.
1717
<article className="col col--6">
1818

1919
#### 1. Create a Virtual Environment
20-
In a clean directory, create a Python virtual environment.
20+
Create and activate a Python virtual environment in a directory.
2121
DBOS requires Python 3.9 or later.
2222

2323
</article>
@@ -27,25 +27,22 @@ DBOS requires Python 3.9 or later.
2727
<Tabs groupId="operating-systems" className="small-tabs">
2828
<TabItem value="maclinux" label="macOS or Linux">
2929
```shell
30-
mkdir my-app
31-
cd my-app
32-
python3 -m venv .venv
30+
python3 -m venv dbos-app-starter/.venv
31+
cd dbos-app-starter
3332
source .venv/bin/activate
3433
```
3534
</TabItem>
3635
<TabItem value="win-ps" label="Windows (PowerShell)">
3736
```shell
38-
mkdir my-app
39-
cd my-app
40-
python3 -m venv .venv
37+
python3 -m venv dbos-app-starter/.venv
38+
cd dbos-app-starter
4139
.venv\Scripts\activate.ps1
4240
```
4341
</TabItem>
4442
<TabItem value="win-cmd" label="Windows (cmd)">
4543
```shell
46-
mkdir my-app
47-
cd my-app
48-
python3 -m venv .venv
44+
python3 -m venv dbos-app-starter/.venv
45+
cd dbos-app-starter
4946
.venv\Scripts\activate.bat
5047
```
5148
</TabItem>
@@ -58,7 +55,7 @@ python3 -m venv .venv
5855
<article className="col col--6">
5956

6057
#### 2. Install and Initialize DBOS
61-
Install DBOS with `pip install dbos`, then initialize `dbos-app-starter`, an example application built with DBOS and FastAPI.
58+
Install DBOS with `pip install dbos`, then initialize an example application.
6259

6360
</article>
6461

@@ -78,13 +75,14 @@ dbos init --template dbos-app-starter
7875
<section className="row list">
7976

8077
<article className="col col--6">
81-
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:
8281
</article>
8382

8483
<article className="col col--6">
8584
```bash
86-
export PGPASSWORD=dbos
87-
python3 start_postgres_docker.py
85+
dbos postgres start
8886
```
8987
</article>
9088

@@ -94,7 +92,7 @@ Now, start your app!
9492

9593
<article className="col col--6">
9694
```bash
97-
fastapi run app/main.py
95+
python3 app/main.py
9896
```
9997
</article>
10098

@@ -104,7 +102,7 @@ To see that your app is working, visit this URL in your browser: http://localhos
104102
This app lets you test the reliability of DBOS for yourself.
105103
Launch a durable workflow and watch it execute its three steps.
106104
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.
108106

109107

110108
Congratulations, you've run your first durable workflow with DBOS!
@@ -171,9 +169,20 @@ npm run build
171169

172170
<section className="row list">
173171

172+
<article className="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+
<article className="col col--6">
179+
```bash
180+
npx dbos postgres start
181+
```
182+
</article>
183+
174184
<article className="col col--6">
175185
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).
177186

178187
</article>
179188

docs/typescript/examples/task-scheduler.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ After a bit of launch activity, you will be presented with:
3333
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.
3434

3535
### 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:
39+
40+
```shell
41+
npx dbos postgres start
42+
```
3743

3844

3945
### Running In Development

docs/typescript/integrating-dbos.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Also check out the integration guides for popular TypeScript frameworks:
1818
`npm install` DBOS into your application. Note that DBOS requires Node.js 20 or later.
1919

2020
```shell
21-
npm install @dbos-inc/dbos-sdk
21+
npm install @dbos-inc/dbos-sdk@latest
2222
```
2323

2424
Then, enable TypeScript decorators in your `tsconfig.json` file:
@@ -29,6 +29,14 @@ Then, enable TypeScript decorators in your `tsconfig.json` file:
2929
}
3030
```
3131

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+
3240

3341
#### 2. Initialize DBOS in Your App
3442

@@ -48,11 +56,7 @@ await DBOS.launch();
4856
#### 3. Start Your Application
4957

5058
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.
5660
Congratulations! You've integrated DBOS into your application.
5761

5862
#### 4. Start Building With DBOS

0 commit comments

Comments
 (0)