Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/55 signer api microservice #56

Merged
merged 4 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,32 @@ deployment.

Alternatively, no docker hub, use docker compose directly..

### Bridge API

```bash
# prod
docker rm -f bridge_api_production
docker run -d -t -i --network host --name bridge_api_production -p 3020:3020 -e TARGET_ENV='linode-production' -e btcSchnorrReveal=${BTC_PROD_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${BTC_PROD_SCHNORR_KEY_RECLAIM} -e btcRpcUser=${BTC_PROD_RPC_USER} -e btcRpcPwd=${BTC_PROD_RPC_PWD} -e btcNode=${BTC_PROD_NODE} -e mongoDbUrl=${MONGO_PROD_SBTC_URL} -e mongoDbName=${MONGO_PROD_SBTC_DBNAME} -e mongoUser=${MONGO_PROD_SBTC_USER} -e mongoPwd=${MONGO_PROD_SBTC_PWD} mijoco/bridge_api
docker run -d -t -i --network host --name bridge_api_production -p 3020:3020 -e TARGET_ENV='linode-production' -e btcSchnorrReveal=${BTC_PROD_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${BTC_PROD_SCHNORR_KEY_RECLAIM} -e btcSchnorrOracle=${BTC_PROD_SCHNORR_KEY_ORACLE} -e btcRpcUser=${BTC_PROD_RPC_USER} -e btcRpcPwd=${BTC_PROD_RPC_PWD} -e btcNode=${BTC_PROD_NODE} -e mongoDbUrl=${MONGO_PROD_SBTC_URL} -e mongoDbName=${MONGO_PROD_SBTC_DBNAME} -e mongoUser=${MONGO_PROD_SBTC_USER} -e mongoPwd=${MONGO_PROD_SBTC_PWD} mijoco/bridge_api
```

```bash
# stag
docker rm -f bridge_api_staging
docker run -d -t -i --network host --name bridge_api_staging -p 3010:3010 -e TARGET_ENV='linode-staging' -e btcSchnorrReveal=${BTC_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${BTC_SCHNORR_KEY_RECLAIM} -e btcRpcUser=${BTC_RPC_USER} -e btcRpcPwd=${BTC_RPC_PWD} -e btcNode=${BTC_NODE} -e mongoDbUrl=${MONGO_SBTC_URL} -e mongoDbName=${MONGO_SBTC_DBNAME} -e mongoUser=${MONGO_SBTC_USER} -e mongoPwd=${MONGO_SBTC_PWD} mijoco/bridge_api
docker run -d -t -i --network host --name bridge_api_staging -p 3010:3010 -e TARGET_ENV='linode-staging' -e btcSchnorrReveal=${BTC_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${BTC_SCHNORR_KEY_RECLAIM} -e btcSchnorrOracle=${BTC_SCHNORR_KEY_ORACLE} -e btcRpcUser=${BTC_RPC_USER} -e btcRpcPwd=${BTC_RPC_PWD} -e btcNode=${BTC_NODE} -e mongoDbUrl=${MONGO_SBTC_URL} -e mongoDbName=${MONGO_SBTC_DBNAME} -e mongoUser=${MONGO_SBTC_USER} -e mongoPwd=${MONGO_SBTC_PWD} mijoco/bridge_api
```

### Signer API

```bash
# prod
docker rm -f signer_api_production
docker run -d -t -i --network host --name signer_api_production -p 3020:3020 -e TARGET_ENV='linode-production' -e btcSchnorrReveal=${SIG_BTC_PROD_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${SIG_BTC_PROD_SCHNORR_KEY_RECLAIM} -e btcSchnorrOracle=${SIG_BTC_PROD_SCHNORR_KEY_ORACLE} -e btcRpcUser=${SIG_BTC_PROD_RPC_USER} -e btcRpcPwd=${SIG_BTC_PROD_RPC_PWD} -e btcNode=${SIG_BTC_PROD_NODE} -e mongoDbUrl=${SIG_MONGO_PROD_SBTC_URL} -e mongoDbName=${SIG_MONGO_PROD_SBTC_DBNAME} -e mongoUser=${SIG_MONGO_PROD_SBTC_USER} -e mongoPwd=${SIG_MONGO_PROD_SBTC_PWD} mijoco/signer_api
```

```bash
# stag
docker rm -f signer_api_staging
docker run -d -t -i --network host --name signer_api_staging -p 4010:4010 -e TARGET_ENV='linode-staging' -e btcSchnorrReveal=${SIG_BTC_SCHNORR_KEY_REVEAL} -e btcSchnorrReclaim=${SIG_BTC_SCHNORR_KEY_RECLAIM} -e btcSchnorrOracle=${SIG_BTC_SCHNORR_KEY_ORACLE} -e btcRpcUser=${SIG_BTC_RPC_USER} -e btcRpcPwd=${SIG_BTC_RPC_PWD} -e btcNode=${SIG_BTC_NODE} -e mongoDbUrl=${SIG_MONGO_SBTC_URL} -e mongoDbName=${SIG_MONGO_SBTC_DBNAME} -e mongoUser=${SIG_MONGO_SBTC_USER} -e mongoPwd=${SIG_MONGO_SBTC_PWD} mijoco/signer_api
```

## Swagger API Docs
Expand Down
1 change: 1 addition & 0 deletions deploy-dev.sh → deploy-bridge-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ docker run -d -t -i --name bridge_api -p 3030:3030 \
-e TARGET_ENV='development' \
-e btcSchnorrReveal=${BTC_SCHNORR_KEY_REVEAL} \
-e btcSchnorrReclaim=${BTC_SCHNORR_KEY_RECLAIM} \
-e btcSchnorrOracle=${BTC_SCHNORR_KEY_ORACLE} \
-e btcRpcUser=${BTC_RPC_USER} \
-e btcRpcUser=${BTC_RPC_USER} \
-e btcRpcPwd=${BTC_RPC_PWD} \
Expand Down
40 changes: 40 additions & 0 deletions deploy-signer-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash -e
#
############################################################

export DOCKER_ID_USER='mijoco'
export DOCKER_CMD='docker'

$DOCKER_CMD build -t mijoco/signer_api sbtc-signer-api
$DOCKER_CMD tag mijoco/signer_api mijoco/signer_api
#$DOCKER_CMD push mijoco/signer_api:latest

printf "\nConnecting to $SERVER.\n\n"

docker login;
#docker pull mijoco/signer_api;

docker rm -f signer_api
#source ~/.profile;
docker run -d -t -i --name signer_api -p 4030:4030 \
-e TARGET_ENV='development' \
-e btcSchnorrReveal=${SIG_BTC_SCHNORR_KEY_REVEAL} \
-e btcSchnorrReclaim=${SIG_BTC_SCHNORR_KEY_RECLAIM} \
-e btcSchnorrOracle=${SIG_BTC_SCHNORR_KEY_ORACLE} \
-e btcRpcUser=${SIG_BTC_RPC_USER} \
-e btcRpcUser=${SIG_BTC_RPC_USER} \
-e btcRpcPwd=${SIG_BTC_RPC_PWD} \
-e btcNode=${SIG_BTC_NODE} \
-e mongoDbUrl=${SIG_MONGO_SBTC_URL} \
-e mongoDbName=${SIG_MONGO_SBTC_DBNAME} \
-e mongoUser=${SIG_MONGO_SBTC_USER} \
-e mongoPwd=${SIG_MONGO_SBTC_PWD} \
mijoco/signer_api

printf "Finished....\n"
printf "\n-----------------------------------------------------------------------------------------------------\n";

exit 0;

# docker rm -f signer_api
# docker run -t -i --name signer_api -p 4030:4030 -e TARGET_ENV='development' -e btcRpcUser=${SIG_BTC_RPC_USER} -e btcRpcPwd=${SIG_BTC_RPC_PWD} -e btcNode=${SIG_BTC_NODE} -e mongoDbUrl=${SIG_MONGO_SBTC_URL} -e mongoDbName=${SIG_MONGO_SBTC_DBNAME} -e mongoUser=${SIG_MONGO_SBTC_USER} -e mongoPwd=${SIG_MONGO_SBTC_PWD} mijoco/signer_api
80 changes: 80 additions & 0 deletions deploy-signer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/bin/bash -e
#
############################################################

export DEPLOYMENT=$1
#export PORT=22
#export SERVER=popper.brightblock.org
export PORT=7019
export SERVER=chomsky.brightblock.org
export DOCKER_NAME=signer_api_staging
export TARGET_ENV=linode-staging
if [ "$DEPLOYMENT" == "prod" ]; then
#SERVER=chomsky.brightblock.org;
DOCKER_NAME=signer_api_production
TARGET_ENV=linode-production
PORT=7019
fi
export DOCKER_ID_USER='mijoco'
export DOCKER_CMD='docker'

$DOCKER_CMD build -t mijoco/signer_api sbtc-signer-api
$DOCKER_CMD tag mijoco/signer_api mijoco/signer_api
$DOCKER_CMD push mijoco/signer_api:latest

printf "\nConnecting to: $SERVER.\n\n"
printf "\nDeploying docker container: $DOCKER_NAME.\n\n"

if [ "$DEPLOYMENT" == "prod" ]; then
ssh -i ~/.ssh/id_rsa -p $PORT bob@$SERVER "
cd /home/bob/hubgit/sbtc-signer-api
pwd
cat .env;
docker login;
docker pull mijoco/signer_api;

docker rm -f ${DOCKER_NAME}
source /home/bob/.profile;
docker run -d -t -i --name ${DOCKER_NAME} -p 4020:4020 \
-e TARGET_ENV=linode-production \
-e btcSchnorrReveal=${SIG_BTC_PROD_SCHNORR_KEY_REVEAL} \
-e btcSchnorrReclaim=${SIG_BTC_PROD_SCHNORR_KEY_RECLAIM} \
-e btcRpcUser=${SIG_BTC_PROD_RPC_USER} \
-e btcRpcPwd=${SIG_BTC_PROD_RPC_PWD} \
-e btcNode=${SIG_BTC_PROD_NODE} \
-e mongoDbUrl=${SIG_MONGO_PROD_SBTC_URL} \
-e mongoDbName=${SIG_MONGO_PROD_SBTC_DBNAME} \
-e mongoUser=${SIG_MONGO_PROD_SBTC_USER} \
-e mongoPwd=${SIG_MONGO_PROD_SBTC_PWD} \
mijoco/signer_api
";
else
ssh -i ~/.ssh/id_rsa -p $PORT bob@$SERVER "
cd /home/bob/hubgit/sbtc-signer-api
pwd
cat .env;
docker login;
docker pull mijoco/signer_api;

docker rm -f ${DOCKER_NAME}
source /home/bob/.profile;
docker run -d -t -i --name ${DOCKER_NAME} -p 4010:4010 \
-e TARGET_ENV=linode-staging \
-e btcSchnorrReveal=${SIG_BTC_SCHNORR_KEY_REVEAL} \
-e btcSchnorrReclaim=${SIG_BTC_SCHNORR_KEY_RECLAIM} \
-e btcRpcUser=${SIG_BTC_RPC_USER} \
-e btcRpcPwd=${SIG_BTC_RPC_PWD} \
-e btcNode=${SIG_BTC_NODE} \
-e mongoDbUrl=${SIG_MONGO_SBTC_URL} \
-e mongoDbName=${SIG_MONGO_SBTC_DBNAME} \
-e mongoUser=${SIG_MONGO_SBTC_USER} \
-e mongoPwd=${SIG_MONGO_SBTC_PWD} \
mijoco/signer_api
";
fi

printf "Finished....\n"
printf "\n-----------------------------------------------------------------------------------------------------\n";

exit 0;