updated shell scripts to use binaries

This commit is contained in:
Markus Thielen 2023-04-04 20:02:06 +02:00
parent 62c527acf8
commit 14761fa3e5
6 changed files with 21 additions and 37 deletions

View File

@ -2,7 +2,7 @@
This project implements the *Hello World* of API-driven apps: a simple TODO app, built with Vue 3.
The `bbconf` folder contains basebox config files, database schema, type maps etc. and scripts to run broker and dbproxy from within the `bbconf` directory.
The `bbconf` folder contains basebox config files, GraphQL schema, precompiled database schema, type maps etc. and scripts to run broker and dbproxy from within the `bbconf` directory.
These files assume that you extracted the [basebox distribution](https://basebox.io/download) next to this repository's root.
@ -13,7 +13,7 @@ Let's assume you create a `basebox` folder in your home directory, change into i
cd ~
mkdir basebox
cd basebox
tar xf basebox-version-arch.tgz # adopt this command to the basebox distribution archive you downloaded
tar xzf basebox-version-arch.tgz # adopt this command to the basebox distribution archive you downloaded
git clone --single-branch --depth 1 https://gitea.basebox.health/samples/vue-todo.git
```
@ -30,19 +30,13 @@ To install this app, you need
### PostgreSQL Preparation
> The following guide assumes you are installing under Debian or Ubuntu Linux; if you are on a Mac, please see our [PostgreSQL Primer](https://docs.basebox.io/getting-started/postgresql/) for some hints.
> You need a PostgreSQL database to run this app. You can read detailed instructions on how to
> install PostgreSQL and create a test database at our [PostgreSQL Primer](https://docs.basebox.io/getting-started/postgresql/) page.
You need to create a user and a database for the todo app.
The recommended way to run basebox is to have a dedicated Unix user for basebox that authenticates to PostgreSQL using Peer authentication. This way, no password for the DB user has to be stored anywhere.
However, to keep things simple for the test app, we create a local user that authenticates to the database server via password (md5).
> Please note:
>
> The recommended way to run basebox is to have a dedicated Unix user for dbproxy that
> authenticates to PostgreSQL using Peer authentication. This way, no password for the
> DB user has to be stored anywhere. The Unix user's name must match the name of the
> PostgreSQL user. For more info, see the basebox installation instructions and
> [PostgreSQL documentation](https://www.postgresql.org/docs/current/auth-peer.html).
For simplicity's sake, we are using a normal PostgreSQL user that authenticates using md5 authentication, thus requires a password, which is set in the dbproxy configuration file.
Let's create a PostgreSQL user and database for the TODO app:
``` sh
# Under (Debian) Linux, switch to the postgres user first:
@ -76,3 +70,11 @@ psql -U bb_todo bb_todo < bbconf/todo_datamodel.sql # Enter password when promp
```
The database configuration and installation is now complete.
If you're curious, you can recompile the GraphQL schema like so:
```sh
bin/bbconf --prefix=bb_todo -f todo_schema.graphql -o bbconf
```

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Run basebox broker from the samples/toodo/bbconf directory
PYO3_PYTHON=python3 cargo run --manifest-path ../../../broker/Cargo.toml -- -c broker-config.toml
../../bin/broker -c broker-config.toml

View File

@ -2,4 +2,4 @@
#
# Compile the todo schema.
#
cargo run --manifest-path=../../../bbc/Cargo.toml -- --prefix=bb_todo -f todo_schema.graphql
../../bin/bbc --prefix=bb_todo -f todo_schema.graphql

View File

@ -1,3 +1,3 @@
#!/bin/sh
# Run basebox dbproxy from the samples/toodo/bbconf directory
cargo run --manifest-path ../../../dbproxy/Cargo.toml -- -c dbproxy-config.toml
../../bin/dbproxy -c dbproxy-config.toml

View File

@ -1,18 +0,0 @@
# Sample toml file; for testing only
[generic]
# the name of the project
project_name = "bb_todo"
# the folder where the generated files will be placed. If not specifed, the project name will be
# used to create a folder by that name in the current directory. Note that the folder must not exist
# yet in order to make ensure that an existing installation will not be overwritten by accident.
output = "output"
[log]
# log level; can be off, error, warn, info, debug, trace
log_level = "info"
[graphql]
schema = "todo_schema.graphql"
[database]

View File

@ -39,7 +39,7 @@ type Query {
getUser(
username: String!
): User @bb_resolver(_type: select, _object: User, _filter: { username: { _eq: "$username" } })
}
type Mutation {
@ -64,8 +64,8 @@ type Mutation {
createTask(
title: String!,
description: String,
completed: Boolean!, # default not implemented yet, this needs to be added as it's non-nullable
list: List! # list needs to be specified as it's non-nullable
completed: Boolean!, # default not implemented yet, this needs to be added as it's non-nullable
list: List! # list needs to be specified as it's non-nullable
user: User! # username needs to be specified as it's non-nullable
): Task @bb_resolver(_type: insert, _object: Task, _fields: { title: "$title", description: "$description", completed: "$completed", list: "$list", user: "$user" })