Prathamesh Musale
aa6fa1ed82
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675) Reviewed-on: #5 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
3.4 KiB
3.4 KiB
onboarding-api
Instructions for running the testnet-onboarding-api
using laconic-so
Prerequisite
laconic-so
: installation instructions- sumsub application token: https://docs.sumsub.com/docs/app-tokens
Setup
-
Fetch the stack repo:
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-onboarding-app-stack
This should clone the stack repo in
$HOME/cerc
directory -
Setup required repositories:
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api setup-repositories --pull # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command # The repositories are located in $HOME/cerc by default
-
Build the container image:
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api build-containers
This should create the
cerc/testnet-onboarding-api
Docker image locally, same can be confirmed by runningdocker image ls
Create a deployment
-
Create a spec file for the deployment:
laconic-so --stack ~/cerc/testnet-onboarding-app-stack/stack-orchestrator/stacks/onboarding-api deploy init --map-ports-to-host any-same --output onboarding-api-spec.yml
- This should create the spec file
onboarding-api-spec.yml
- The port mapping option
any-same
binds the ports for Docker services to0.0.0.0
on the host machine; edit the spec file to change the mapping as desired
- This should create the spec file
-
Create an
onboarding-api
stack deployment from the spec file: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
- This should create the deployment directory
onboarding-api-deployment
- Note: Once a deployment is created from the spec file, the port mappings are set in Docker compose files; in order to change the port mapping after that, the deployment has to be re-created with a modified spec file
- This should create the deployment directory
Configuration
-
Inside the
onboarding-api-deployment
deployment directory, openconfig.env
and set following env variables:# Your sumsub application token SUMSUB_APP_TOKEN= # Your sumsub secret key SUMSUB_SECRET_KEY= # Optional # Default KYC level of access token being generated (default: basic-kyc-level) KYC_LEVEL= # Default TTL for the generated access token in seconds (default: 600) TTL_IN_SECS=
Start the deployment
laconic-so deployment --dir onboarding-api-deployment start
Check status
-
To list down and monitor the running container:
docker ps # Ensure that the testnet-onboarding-api container is healthy # Check logs for the server laconic-so deployment --dir onboarding-api-deployment logs -f testnet-onboarding-api
Example
-
Generate an access token for a user:
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:
laconic-so deployment --dir onboarding-api-deployment stop