Skip to content

Commit

Permalink
Merge pull request #1074 from bcgov/bcgov/chore/lob
Browse files Browse the repository at this point in the history
chore: moves tenant lob demo out of core services
  • Loading branch information
loneil authored Apr 18, 2024
2 parents efaf442 + 69ed218 commit d2d77b7
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 48 deletions.
File renamed without changes.
19 changes: 9 additions & 10 deletions services/tenant-lob/README.md → demo/lob/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ The endpoints in this demo use `GET` for creates instead of `POST` to simplify t

All data in this demo is completely ephemeral, it only exists in memory.

### Starting the demo with Docker Compose

Ensure you have Traction running locally. Please see the Traction [documentation](https://github.com/bcgov/traction/tree/main/scripts#run-local-traction) for instructions on how to run Traction locally with Docker.

```sh
docker compose up
```

## Simple Demo Flow
Assumes this is being run in a local environment stood up according to [scripts](../../scripts) documentation with default configuration.

1. Create set of demo tenants
1. Open browser at [http://localhost:9876/tasks/create-alice-faber-acme](http://localhost:9876/tasks/create-alice-faber-acme)
Expand All @@ -41,12 +48,4 @@ Assumes this is being run in a local environment stood up according to [scripts]
4. Open browser at [http://localhost:9876/tenants/faber/webhook-data](http://localhost:9876/tenants/faber/webhook-data) to view faber's webhook data.
5. Note that there is a new topic: `endorse_transaction`. This is faber asking the endorser to do work (write public did to ledger) on their behalf.

When creating your own tenants in the [tenant-ui](http://localhost:5101), you can update their webhook url to `http://host.docker.internal:9876/webhook` and do not add an api key. You can see notifications for you webhook in the `tenant-lob` docker console.


### Docker Build image

```shell
docker build -f Dockerfile -t tenant-lob .
```

When creating your own tenants in the [tenant-ui](http://localhost:5101), you can update their webhook url to `http://host.docker.internal:9876/webhook` and do not add an api key. You can see notifications for you webhook in the `tenant-lob` docker console.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions demo/lob/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
tenant-lob:
build:
context: .
dockerfile: Dockerfile
image: traction:tenant-lob
depends_on:
tenant-proxy:
condition: service_started
restart: unless-stopped
environment:
- SERVER_TRACTION_URL=${LOB_SERVER_TRACTION_URL}
- TRACTION_INNKEEPER_TENANT_ID=${TRACTION_INNKEEPER_TENANT_ID}
- TRACTION_INNKEEPER_WALLET_NAME=${TRACTION_INNKEEPER_WALLET_NAME}
- TRACTION_INNKEEPER_WALLET_KEY=${TRACTION_INNKEEPER_WALLET_KEY}
- WEBHOOK_URL=${LOB_WEBHOOK_URL}
ports:
- ${LOB_PORT}:8088
extra_hosts:
- host.docker.internal:host-gateway
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion plugins/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"python.formatting.provider": "black",
"python.formatting.blackArgs": [],
"python.venvFolders": ["~.cache/virtualenvs"]
"python.venvFolders": ["~.cache/virtualenvs"]
},
"extensions": [
"ms-python.python",
Expand Down
10 changes: 0 additions & 10 deletions scripts/.env-example
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,6 @@ FRONTEND_QUICK_CONNECT_ENDORSER_NAME=bcovrin-test-endorser

TENANT_PROXY_PORT=8032

# ------------------------------------------------------------
# ------------------------------------------------------------
# Tenant LOB Server/Controller
# ------------------------------------------------------------
# ------------------------------------------------------------

LOB_SERVER_TRACTION_URL=http://host.docker.internal:8032
LOB_WEBHOOK_URL=http://host.docker.internal:9876/webhook
LOB_PORT=9876

# ------------------------------------------------------------
# ------------------------------------------------------------
# Plugins
Expand Down
4 changes: 1 addition & 3 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,4 @@ You can use the wallet id and key to retrieve a token and use the Tenant API.
9. In the bottom `AuthorizationHeader (apiKey)` section, for the Value field, enter `Bearer <your token value>` and Authorize.
10. You are now logged in as your tenant/wallet/agent.
11. Scroll to [GET /tenant](http://localhost:8032/api/doc#/traction-tenant/get_tenant), expand, Try it out and Execute.
12. These are your tenant's details. Only you are authorized to fetch your tenant data.

For Tenant Line of Business Integration, see more steps in the [tenant-lob demo](../services/tenant-lob/README.md) readme.
12. These are your tenant's details. Only you are authorized to fetch your tenant data.
24 changes: 0 additions & 24 deletions scripts/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,30 +162,6 @@ services:
extra_hosts:
- host.docker.internal:host-gateway

###############################################
# XXX: The following is breaking the build
###############################################
# tenant-lob:
# build:
# context: ../services/tenant-lob
# dockerfile: Dockerfile
# image: traction:tenant-lob
# depends_on:
# tenant-proxy:
# condition: service_started
# restart: unless-stopped
# environment:
# - SERVER_TRACTION_URL=${LOB_SERVER_TRACTION_URL}
# - TRACTION_INNKEEPER_TENANT_ID=${TRACTION_INNKEEPER_TENANT_ID}
# - TRACTION_INNKEEPER_WALLET_NAME=${TRACTION_INNKEEPER_WALLET_NAME}
# - TRACTION_INNKEEPER_WALLET_KEY=${TRACTION_INNKEEPER_WALLET_KEY}
# - WEBHOOK_URL=${LOB_WEBHOOK_URL}
# ports:
# - ${LOB_PORT}:8088
# extra_hosts:
# - host.docker.internal:host-gateway
###############################################

endorser-api:
pull_policy: missing
build:
Expand Down

0 comments on commit d2d77b7

Please sign in to comment.