Skip to content

Commit

Permalink
Add the greeting app that uses guestbook to demos (#170)
Browse files Browse the repository at this point in the history
The last link in the doc points to github... why not.
  • Loading branch information
apoliakov authored Aug 6, 2024
1 parent 2f5cc06 commit 5bfd4a2
Show file tree
Hide file tree
Showing 20 changed files with 1,914 additions and 1,370 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: CI for greeting emails example
name: CI for greeting guestbook example

on:
push:
branches: [ "main" ]
paths:
- 'greeting-emails/**'
- '.github/workflows/greeting-emails.yml'
- 'greeting-guestbook/**'
- '.github/workflows/greeting-guestbook.yml'
pull_request:
types:
- ready_for_review
- opened
- reopened
- synchronize
paths:
- 'greeting-emails/**'
- '.github/workflows/greeting-emails.yml'
- 'greeting-guestbook/**'
- '.github/workflows/greeting-guestbook.yml'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:

steps:
- name: Setup Postgres
run: docker exec postgres psql -U postgres -c "CREATE DATABASE hello;"
run: docker exec postgres psql -U postgres -c "CREATE DATABASE hello_guestbook;"
env:
PGPASSWORD: dbos
- name: Checkout demo app
Expand All @@ -54,7 +54,7 @@ jobs:
with:
node-version: 20
- name: Compile Hello World
working-directory: dbos-demo-apps/greeting-emails
working-directory: dbos-demo-apps/greeting-guestbook
run: |
npm install
npx knex migrate:latest
Expand Down
41 changes: 0 additions & 41 deletions greeting-emails/README.md

This file was deleted.

This file was deleted.

43 changes: 0 additions & 43 deletions greeting-emails/src/operations.ts

This file was deleted.

26 changes: 0 additions & 26 deletions greeting-emails/start_postgres_docker.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions greeting-guestbook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# DBOS Guestbook Hello App

This is the app described in the [DBOS Programming Guide](https://docs.dbos.dev/getting-started/quickstart-programming)

## Getting Started

First, install all the app dependencies
```bash
npm install
```

Start the database. You can use any Postgres DB. If you don't have one, we've provided a script that starts Postgres locally in a Docker container and creates a database:

```bash
export PGPASSWORD=dbos #set PGPASSWORD=dbos on Windows
node start_postgres_docker.js
```

Then, create some database tables.

```bash
npx dbos migrate
```

Then, visit the guestbook key generator at [https://demo-guestbook.cloud.dbos.dev/key](https://demo-guestbook.cloud.dbos.dev/key) and save your key to `dbos-config.yaml`

Next, build and run the app:

```bash
npm run build
npx dbos start
```

Finally, curl the server to see that it's working!

```bash
curl http://localhost:3000/greeting/dbos
```

## Learn More

To learn more about DBOS, take a look at [our documentation](https://docs.dbos.dev/) or our [source code](https://github.com/dbos-inc/dbos-transact).
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ database:
port: 5432
username: 'postgres'
password: ${PGPASSWORD}
app_db_name: 'hello'
app_db_name: 'hello_guestbook'
connectionTimeoutMillis: 3000
app_db_client: 'knex'
migrate: ['npx knex migrate:latest']
rollback: ['npx knex migrate:rollback']
env:
GUESTBOOK_KEY: 'your-key-here' #visit https://demo-guestbook.cloud.dbos.dev/key to create a key

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
exports.up = function(knex) {
return knex.schema.createTable('greetings', table => {
table.text('name');
table.text('note');
});
};

exports.down = function(knex) {
return knex.schema.dropTable('greetings');
};

Loading

0 comments on commit 5bfd4a2

Please sign in to comment.