108 lines
2.4 KiB
Markdown
108 lines
2.4 KiB
Markdown
|
# onboarding-api
|
||
|
|
||
|
Instructions for running the `testnet-onboarding-api` using [laconic-so](https://git.vdb.to/cerc-io/stack-orchestrator)
|
||
|
|
||
|
## Setup
|
||
|
|
||
|
* Clone the stack repo:
|
||
|
|
||
|
```bash
|
||
|
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-onboarding-app-stack
|
||
|
```
|
||
|
|
||
|
* Setup required repositories:
|
||
|
|
||
|
```bash
|
||
|
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api setup-repositories
|
||
|
```
|
||
|
|
||
|
* Build the container image:
|
||
|
|
||
|
```bash
|
||
|
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api build-containers
|
||
|
```
|
||
|
|
||
|
This should create the `cerc/testnet-onboarding-api` image locally
|
||
|
|
||
|
## Create a deployment
|
||
|
|
||
|
* Create a spec file for the deployment:
|
||
|
|
||
|
```bash
|
||
|
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api deploy init --output onboarding-api-spec.yml
|
||
|
```
|
||
|
|
||
|
* Edit `network` in the spec file to map container ports to host ports as required:
|
||
|
|
||
|
```bash
|
||
|
network:
|
||
|
ports:
|
||
|
testnet-onboarding-api:
|
||
|
- '3000:3000'
|
||
|
```
|
||
|
|
||
|
* Create a deployment from the spec file:
|
||
|
|
||
|
```bash
|
||
|
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api deploy create --spec-file onboarding-api-spec.yml --deployment-dir onboarding-api-deployment
|
||
|
```
|
||
|
|
||
|
## Configuration
|
||
|
|
||
|
* Inside the `onboarding-api-deployment` deployment directory, open `config.env` file and set following env variables:
|
||
|
|
||
|
```bash
|
||
|
# Your sumsub application token
|
||
|
SUMSUB_APP_TOKEN=
|
||
|
|
||
|
# Your sumsub secret key
|
||
|
SUMSUB_SECRET_KEY=
|
||
|
|
||
|
# Optional
|
||
|
|
||
|
# KYC level of access token being generated (default: basic-kyc-level)
|
||
|
KYC_LEVEL=
|
||
|
|
||
|
# TTL for the generated access token in seconds (default: 600)
|
||
|
TTL_IN_SECS=
|
||
|
```
|
||
|
|
||
|
## Start the deployment
|
||
|
|
||
|
```bash
|
||
|
laconic-so deployment --dir onboarding-api-deployment start
|
||
|
```
|
||
|
|
||
|
## Check status
|
||
|
|
||
|
* To list down and monitor the running container:
|
||
|
|
||
|
```bash
|
||
|
# With status
|
||
|
docker ps
|
||
|
|
||
|
# Check logs for the server
|
||
|
laconic-so deployment --dir onboarding-api-deployment logs -f testnet-onboarding-api
|
||
|
```
|
||
|
|
||
|
## Run
|
||
|
|
||
|
* Generate an access token for a user:
|
||
|
|
||
|
```bash
|
||
|
curl -X POST http://localhost:3000/generate-token \
|
||
|
-H "Content-Type: application/json" \
|
||
|
-d '{"userId": "JamesBond007"}'
|
||
|
|
||
|
# Expected output:
|
||
|
# {"token":"generated-access-token"}
|
||
|
```
|
||
|
|
||
|
## Clean up
|
||
|
|
||
|
* Stop the deployment:
|
||
|
|
||
|
```bash
|
||
|
laconic-so deployment --dir onboarding-api-deployment stop
|
||
|
```
|