@dbos-inc/dbos-sdk 1.1.12-preview → 1.1.13-preview
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/examples/hello/README.md
CHANGED
@@ -5,13 +5,21 @@ This is a [DBOS app](https://docs.dbos.dev/) bootstrapped with `npx @dbos-inc/db
|
|
5
5
|
## Getting Started
|
6
6
|
|
7
7
|
Before you can launch your app, you need a database.
|
8
|
-
DBOS works with any Postgres database, but to make things easier, we've provided a script that starts a Docker Postgres container and creates a database
|
8
|
+
DBOS works with any Postgres database, but to make things easier, we've provided a script that starts a Docker Postgres container and creates a database.
|
9
|
+
On Linux or Mac, run:
|
9
10
|
|
10
11
|
```bash
|
11
12
|
export PGPASSWORD=dbos
|
12
13
|
./start_postgres_docker.sh
|
13
14
|
```
|
14
15
|
|
16
|
+
On Windows (cmd), run:
|
17
|
+
|
18
|
+
```cmd
|
19
|
+
set PGPASSWORD=dbos
|
20
|
+
start_postgres_docker.bat
|
21
|
+
```
|
22
|
+
|
15
23
|
If successful, the script should print `Database started successfully!`.
|
16
24
|
|
17
25
|
Then, let's run a schema migration to create some tables:
|
@@ -0,0 +1,36 @@
|
|
1
|
+
@echo off
|
2
|
+
|
3
|
+
setlocal ENABLEEXTENSIONS
|
4
|
+
|
5
|
+
echo Checking if PGPASSWORD is set.
|
6
|
+
if "%PGPASSWORD%"=="" (
|
7
|
+
echo Error: PGPASSWORD is not set.
|
8
|
+
exit /b 1
|
9
|
+
)
|
10
|
+
|
11
|
+
echo Starting PostgreSQL in a local Docker container
|
12
|
+
docker run --rm --name=dbos-db --env=POSTGRES_PASSWORD=%PGPASSWORD% --env=PGDATA=/var/lib/postgresql/data --volume=/var/lib/postgresql/data -p 5432:5432 -d postgres:16.1
|
13
|
+
|
14
|
+
if %errorlevel% == 125 (
|
15
|
+
echo Error: Check if the Docker container already exists
|
16
|
+
exit /b 1
|
17
|
+
) else (
|
18
|
+
goto :start
|
19
|
+
)
|
20
|
+
|
21
|
+
:start
|
22
|
+
echo Waiting for PostgreSQL to start...
|
23
|
+
for /l %%i in (1,1,30) do (
|
24
|
+
docker exec dbos-db psql -U postgres -c "SELECT 1;" >NUL 2>&1
|
25
|
+
|
26
|
+
if %errorlevel% equ 0 (
|
27
|
+
(
|
28
|
+
echo PostgreSQL started!
|
29
|
+
goto :break
|
30
|
+
)
|
31
|
+
timeout /t 1 /nobreak
|
32
|
+
)
|
33
|
+
)
|
34
|
+
:break
|
35
|
+
|
36
|
+
echo Database started successfully^!
|