Converted demo to use Docker Compose
This commit is contained in:
63
bbconf/basebox/broker-config.toml
Normal file
63
bbconf/basebox/broker-config.toml
Normal file
@ -0,0 +1,63 @@
|
||||
[generic]
|
||||
# log level; can be error, warn, info, debug, trace
|
||||
log_level = "trace"
|
||||
|
||||
[graphql]
|
||||
# path and file name to GraphQL schema file
|
||||
schema_file = "/bbconf/schema.graphql"
|
||||
allow_introspection = true
|
||||
|
||||
[proxy]
|
||||
# host name or IP of basebox DB proxy
|
||||
host = "dbproxy"
|
||||
port = 8081
|
||||
# Whether to use http or https to connect to the proxy
|
||||
tls = false
|
||||
|
||||
[server]
|
||||
# Host name of the broker (GraphQL server)
|
||||
host = "broker"
|
||||
|
||||
# Port number; default is 80 for http, 443 for https
|
||||
port = 8080
|
||||
|
||||
max_request_size = 33554433
|
||||
|
||||
[auth]
|
||||
# Contents of 'iss' field, usually the URL of the authentication realm
|
||||
iss = "https://basebox-test-1.eu.auth0.com/"
|
||||
# Access token audience field
|
||||
aud = "basebox-todo"
|
||||
|
||||
# public key file for the IdP server (KeyCloak in this case)
|
||||
# jwks_file = "/bbconf/idp_keys.json"
|
||||
|
||||
#####
|
||||
|
||||
# OpenID Connect scope; default is "openid profile email"
|
||||
scope = "openid profile email"
|
||||
|
||||
# Fully qualified URL to the OAuth2 callback endpoint.
|
||||
# After the user entered his/her credentials at the IdP's login form, the client will be redirected
|
||||
# to this URL. When the client receives a request to this URL, it must send the request's query
|
||||
# string to the broker's "openid_connect_path" set below.
|
||||
#redirect_url = "http://127.0.0.1:5167/oauth-callback"
|
||||
|
||||
# OpenID Connect login completion request path.
|
||||
# The client must pass the query string from the call to "redirect_url" to this URL and gets
|
||||
# a basebox session token in return.
|
||||
#openid_connect_path = "/oauth/complete-login"
|
||||
|
||||
# Path to the browser login URL.
|
||||
# This path is where the basebox broker returns a 302 response that redirects the browser to
|
||||
# the IdP login page; the target URL will contain all query parms needed to initiate an
|
||||
# auth code flow login procedure, incl. CSRF protection tokens etc.
|
||||
#login_path = "/oauth/login"
|
||||
|
||||
# Logout path that allows explicit, immediate logouts.
|
||||
# Simply POST to this URL with the session cookie or bearer token.
|
||||
#logout_path = "/oauth/logout"
|
||||
|
||||
# TODO - need?
|
||||
# Set to true to get a user's additional claims from OAuth2
|
||||
user_info_additional_claims_required = true
|
55
bbconf/basebox/dbproxy-config.toml
Normal file
55
bbconf/basebox/dbproxy-config.toml
Normal file
@ -0,0 +1,55 @@
|
||||
[generic]
|
||||
# log level; can be error, warn, info, debug, trace
|
||||
log_level = "trace"
|
||||
|
||||
|
||||
[oidc_config]
|
||||
# `mode` can be either "access-token" or "client". In access-token mode, all clients sending
|
||||
# GraphQL requests to basebox just pass an access token in the "Authorization" HTTP header.
|
||||
# In client mode, basebox acts as the OpenID Connect client and requests ID and access tokens
|
||||
# from the OpenID Connect server on behalf of the client.
|
||||
# See https://docs.basebox.io/guide/authorization
|
||||
mode = "access-token"
|
||||
|
||||
# Access token validation:
|
||||
# Contents of 'iss' field, usually the URL of the authentication realm
|
||||
#iss = "https://www.idp.com:8090/realms/master"
|
||||
# iss = "https://kcdev.basebox.io:8443/realms/test-runner"
|
||||
|
||||
# # Contents of the 'aud' field for access tokens; for Keycloak, this defaults to 'account';
|
||||
# # for Auth0, this is the value of the Default Audience field in your Tenant settings.
|
||||
# aud = "account"
|
||||
|
||||
# Contents of 'iss' field, usually the URL of the authentication realm
|
||||
iss = "https://basebox-test-1.eu.auth0.com/"
|
||||
# Access token audience field
|
||||
aud = "basebox-todo"
|
||||
|
||||
# public key file for the IdP server (KeyCloak in this case)
|
||||
#jwks_file = "/bbconf/idp_keys.json"
|
||||
|
||||
[graphql]
|
||||
# path and file name to GraphQL schema file
|
||||
schema_file = "/bbconf/schema.graphql"
|
||||
# Path and file name of the resolver map file
|
||||
resolver_map_file = "/bbconf/bb_todo-resolver.toml"
|
||||
# Path and file name of the type map file
|
||||
type_map_file = "/bbconf/bb_todo-typemap.json"
|
||||
|
||||
[database]
|
||||
db_type = "postgres"
|
||||
host = "host.docker.internal"
|
||||
port = 5430
|
||||
ssl_mode = "no"
|
||||
db_name = "bb_todo"
|
||||
username = "bb_todo"
|
||||
password = "bigsecret"
|
||||
|
||||
[server]
|
||||
# Host name of (this) proxy server
|
||||
host = "dbproxy"
|
||||
|
||||
# Port to serve on
|
||||
port = 8081
|
||||
|
||||
max_request_size = 33554432
|
@ -1,37 +0,0 @@
|
||||
[generic]
|
||||
# log level; can be error, warn, info, debug, trace
|
||||
log_level = "trace"
|
||||
|
||||
[graphql]
|
||||
# path and file name to GraphQL schema file
|
||||
schema_file = "todo_schema.graphql"
|
||||
allow_introspection = true
|
||||
|
||||
[proxy]
|
||||
# host name or IP of basebox DB proxy
|
||||
host = "localhost"
|
||||
port = 8081
|
||||
# Whether to use http or https to connect to the proxy
|
||||
tls = false
|
||||
|
||||
[server]
|
||||
# Host name of the broker (GraphQL server)
|
||||
host = "127.0.0.1"
|
||||
|
||||
# Port number; default is 80 for http, 443 for https
|
||||
port = 8080
|
||||
|
||||
# number of HTTP server threads to spawn; default is one per CPU core
|
||||
workers = 2
|
||||
|
||||
# Path and file name of TLS/SSL key file
|
||||
# cert_key_file = "/path/to/key.pem"
|
||||
|
||||
# Path and file name of TLS certificate (chain) file
|
||||
# cert_file = "/path/to/cert.pem"
|
||||
|
||||
[auth]
|
||||
# Contents of 'iss' field, usually the URL of the authentication realm
|
||||
iss = "https://basebox-test-1.eu.auth0.com/"
|
||||
# Access token audience field
|
||||
aud = "basebox-todo"
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Run basebox broker from the samples/toodo/bbconf directory
|
||||
|
||||
. ./util.sh
|
||||
|
||||
bb_run broker -c broker-config.toml
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Compile the todo schema.
|
||||
#
|
||||
. ./util.sh
|
||||
|
||||
bb_run bbc --prefix=bb_todo -f todo_schema.graphql
|
@ -1,41 +0,0 @@
|
||||
[generic]
|
||||
# log level; can be error, warn, info, debug, trace
|
||||
log_level = "trace"
|
||||
|
||||
[oidc_config]
|
||||
# Incoming ID tokens are validated using, among other, the following fields.
|
||||
# Contents of 'iss' field, usually the URL of the authetnication realm
|
||||
iss = "https://basebox-test-1.eu.auth0.com/"
|
||||
# Access token audience field
|
||||
aud = "basebox-todo"
|
||||
|
||||
[graphql]
|
||||
# path and file name to GraphQL schema file
|
||||
schema_file = "todo_schema.graphql"
|
||||
# Path and file name of the resolver map file
|
||||
resolver_map_file = "bb_todo-resolver.toml"
|
||||
# Path and file name of the type map file
|
||||
type_map_file = "bb_todo-typemap.json"
|
||||
|
||||
[database]
|
||||
# Type of database; currently, only "postgres" is suppoerted
|
||||
db_type = "postgres"
|
||||
|
||||
# Setting just db_name will use PostgreSQL peer authentication mode
|
||||
db_name = "bb_todo"
|
||||
|
||||
[server]
|
||||
# Host name of (this) proxy server
|
||||
host = "localhost"
|
||||
|
||||
# Port number; default is 80 for http, 443 for https
|
||||
port = 8081
|
||||
|
||||
# number of HTTP server threads to spawn; default is one per CPU core
|
||||
workers = 2
|
||||
|
||||
# Path and file name of TLS/SSL key file
|
||||
# cert_key_file = "/path/to/key.pem"
|
||||
|
||||
# Path and file name of TLS certificate (chain) file
|
||||
# cert_file = "/path/to/cert.pem"
|
@ -1,47 +0,0 @@
|
||||
[generic]
|
||||
# log level; can be error, warn, info, debug, trace
|
||||
log_level = "trace"
|
||||
|
||||
[auth]
|
||||
# Incoming ID tokens are validated using, among other, the following fields.
|
||||
# Contents of 'iss' field, usually the URL of the authentication realm
|
||||
iss = "https://basebox-test-1.eu.auth0.com/"
|
||||
# Access token audience field
|
||||
aud = "basebox-todo"
|
||||
|
||||
[graphql]
|
||||
# path and file name to GraphQL schema file
|
||||
schema_file = "todo_schema.graphql"
|
||||
# Path and file name of the resolver map file
|
||||
resolver_map_file = "bb_todo-resolver.toml"
|
||||
# Path and file name of the type map file
|
||||
type_map_file = "bb_todo-typemap.json"
|
||||
|
||||
[database]
|
||||
# Type of database; currently, only "postgres" is suppoerted
|
||||
db_type = "postgres"
|
||||
# The host where the DB server is runnung
|
||||
host = "localhost"
|
||||
# Port the DB server is listening at
|
||||
port = 5432
|
||||
# Database name
|
||||
db_name = "bb_todo"
|
||||
username = "bb_todo"
|
||||
password = "basebox"
|
||||
ssl_mode = "no"
|
||||
|
||||
[server]
|
||||
# Host name of (this) proxy server
|
||||
host = "localhost"
|
||||
|
||||
# Port number; default is 80 for http, 443 for https
|
||||
port = 8081
|
||||
|
||||
# number of HTTP server threads to spawn; default is one per CPU core
|
||||
workers = 2
|
||||
|
||||
# Path and file name of TLS/SSL key file
|
||||
# cert_key_file = "/path/to/key.pem"
|
||||
|
||||
# Path and file name of TLS certificate (chain) file
|
||||
# cert_file = "/path/to/cert.pem"
|
@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. ./util.sh
|
||||
|
||||
bb_run broker -c dbproxy-config-peer.toml
|
@ -1,6 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Run basebox dbproxy from the samples/toodo/bbconf directory
|
||||
|
||||
. ./util.sh
|
||||
|
||||
bb_run dbproxy -c dbproxy-config.toml
|
50
bbconf/postgres/creation-script.sql
Normal file
50
bbconf/postgres/creation-script.sql
Normal file
@ -0,0 +1,50 @@
|
||||
--
|
||||
-- This file is used to create the database schema. It is a copy of the `bb_todo-datamodel.sql` file
|
||||
-- generated by the basebox compiler.
|
||||
--
|
||||
|
||||
--
|
||||
-- Generated by basebox compiler (bbc) version 0.1.0-beta.23 at 2023-11-01 10:35:59+01:00
|
||||
--
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
CREATE TABLE "List" (
|
||||
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
|
||||
"title" VARCHAR NOT NULL,
|
||||
"user_username" VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "Task" (
|
||||
"id" UUID DEFAULT gen_random_uuid() NOT NULL,
|
||||
"title" VARCHAR NOT NULL,
|
||||
"description" VARCHAR,
|
||||
"completed" BOOLEAN NOT NULL,
|
||||
"user_username" VARCHAR NOT NULL,
|
||||
"list_id" UUID NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE "User" (
|
||||
"username" VARCHAR NOT NULL,
|
||||
"name" VARCHAR
|
||||
);
|
||||
|
||||
ALTER TABLE "List" ADD COLUMN ".ownerId" VARCHAR NOT NULL;
|
||||
|
||||
ALTER TABLE "Task" ADD COLUMN ".ownerId" VARCHAR NOT NULL;
|
||||
|
||||
ALTER TABLE "User" ADD COLUMN ".ownerId" VARCHAR NOT NULL;
|
||||
|
||||
ALTER TABLE "List" ADD PRIMARY KEY ("id");
|
||||
|
||||
ALTER TABLE "Task" ADD PRIMARY KEY ("id");
|
||||
|
||||
ALTER TABLE "User" ADD PRIMARY KEY ("username");
|
||||
|
||||
ALTER TABLE "List" ADD CONSTRAINT fk_list_1 FOREIGN KEY ("user_username") REFERENCES "User" ("username");
|
||||
|
||||
ALTER TABLE "Task" ADD CONSTRAINT fk_task_2 FOREIGN KEY ("user_username") REFERENCES "User" ("username");
|
||||
|
||||
ALTER TABLE "Task" ADD CONSTRAINT fk_task_3 FOREIGN KEY ("list_id") REFERENCES "List" ("id");
|
||||
|
||||
ALTER TABLE "User" ADD CONSTRAINT uq_user_4 UNIQUE (".ownerId");
|
||||
|
@ -1,34 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Utility functions for basebox test shell scripts
|
||||
#
|
||||
|
||||
bin_dir="../../basebox/bin"
|
||||
source_dir="../../.."
|
||||
|
||||
#
|
||||
# Run a basebox command.
|
||||
#
|
||||
# Assuming that if run by a customer that wants to try the demo app, we first look if there
|
||||
# is an exeutable at "../../basebox/bin/$1" and run it if present.
|
||||
# If not, we assume this is being run inside of a basebox developer environment and start the
|
||||
# command with "cargo run".
|
||||
#
|
||||
function bb_run {
|
||||
command="$1"
|
||||
args="${@:2}"
|
||||
|
||||
# check bin directory
|
||||
if [ -f "$bin_dir/$command" ]; then
|
||||
"$bin_dir/$command" $args
|
||||
return $?
|
||||
fi
|
||||
|
||||
# check source tree
|
||||
if [ -d "$source_dir/$command" ]; then
|
||||
cargo run --manifest-path=$source_dir/$command/Cargo.toml -- $args
|
||||
return $?
|
||||
fi
|
||||
|
||||
echo "Program '$command' not found!"
|
||||
return 2
|
||||
}
|
Reference in New Issue
Block a user