Add a stack for testnet-onboarding-api
This commit is contained in:
parent
ee1fb9b7b8
commit
5474625e22
@ -0,0 +1,21 @@
|
||||
services:
|
||||
testnet-onboarding-api:
|
||||
restart: unless-stopped
|
||||
image: cerc/testnet-onboarding-api:local
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
SUMSUB_APP_TOKEN: ${SUMSUB_APP_TOKEN}
|
||||
SUMSUB_SECRET_KEY: ${SUMSUB_SECRET_KEY}
|
||||
KYC_LEVEL: ${KYC_LEVEL:-basic-kyc-level}
|
||||
TTL_IN_SECS: ${TTL_IN_SECS:-600}
|
||||
command: ["bash", "./run.sh"]
|
||||
volumes:
|
||||
- ../config/api/run.sh:/app/run.sh
|
||||
ports:
|
||||
- 3000
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "127.0.0.1", "3000"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 5s
|
18
stack-orchestrator/config/api/run.sh
Executable file
18
stack-orchestrator/config/api/run.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
echo "Using the following env variables:"
|
||||
echo "SUMSUB_APP_TOKEN: ${SUMSUB_APP_TOKEN}"
|
||||
echo "SUMSUB_SECRET_KEY: ${SUMSUB_SECRET_KEY}"
|
||||
echo "KYC_LEVEL: ${KYC_LEVEL}"
|
||||
echo "TTL_IN_SECS: ${TTL_IN_SECS}"
|
||||
|
||||
SUMSUB_APP_TOKEN=$SUMSUB_APP_TOKEN \
|
||||
SUMSUB_SECRET_KEY=$SUMSUB_SECRET_KEY \
|
||||
KYC_LEVEL=$KYC_LEVEL \
|
||||
TTL_IN_SECS=$TTL_IN_SECS \
|
||||
node dist/index.js
|
0
stack-orchestrator/config/app/onboarding-app-start.sh
Normal file → Executable file
0
stack-orchestrator/config/app/onboarding-app-start.sh
Normal file → Executable file
5
stack-orchestrator/container-build/cerc-testnet-onboarding-api/build.sh
Executable file
5
stack-orchestrator/container-build/cerc-testnet-onboarding-api/build.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/testnet-onboarding-api
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
docker build -t cerc/testnet-onboarding-api:local ${build_command_args} ${CERC_REPO_BASE_DIR}/testnet-onboarding-api
|
107
stack-orchestrator/stacks/onboarding-api/README.md
Normal file
107
stack-orchestrator/stacks/onboarding-api/README.md
Normal file
@ -0,0 +1,107 @@
|
||||
# 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
|
||||
```
|
9
stack-orchestrator/stacks/onboarding-api/stack.yml
Normal file
9
stack-orchestrator/stacks/onboarding-api/stack.yml
Normal file
@ -0,0 +1,9 @@
|
||||
version: "1.0"
|
||||
name: onboarding-api
|
||||
description: "Testnet onboarding API"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/testnet-onboarding-api
|
||||
containers:
|
||||
- cerc/testnet-onboarding-api
|
||||
pods:
|
||||
- testnet-onboarding-api
|
Loading…
Reference in New Issue
Block a user