Skip to content

Commit

Permalink
Merge pull request #102 from blockapps/develop
Browse files Browse the repository at this point in the history
4.4.0
  • Loading branch information
nikitamendelbaum authored Jan 22, 2024
2 parents 20b3b90 + 1f550a6 commit 2c9b187
Show file tree
Hide file tree
Showing 5 changed files with 410 additions and 15 deletions.
11 changes: 11 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# STRATO Getting Started release notes

## 4.4.0

STRATO versions supported: v11.0+

- Added Highway server deployment script
- Added Stripe PS deployment script
- Removed the EXT_STORAGE vars from strato script
- Removed the Stripe keys vars check from strato script
- Added the STRIPE_PAYMENT_SERVER_URL var as a required
- Minor fixes and formatting

## 4.3.1

STRATO versions supported: v9.0+
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.1
4.4.0
196 changes: 196 additions & 0 deletions highway
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
#!/usr/bin/env bash
set -e

Green='\033[0;32m'
Red='\033[0;31m'
Yellow='\033[0;33m'
BYellow='\033[1;33m'
NC='\033[0m'

function outputLogo {
echo "
███████ ████████ ██████ █████ ████████ ██████ ██ ██ ██ ██████ ██ ██ ██ ██ █████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██████ ███████ ██ ██ ██ ███████ ██ ██ ███ ███████ ██ █ ██ ███████ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██
███████ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██████ ██ ██ ███ ███ ██ ██ ██
"
}

function help {
outputLogo
echo -e "${BYellow}Highway server run script${NC}
Kickstart a highway server.
${Yellow}Optional flags:${NC}
The entrypoints are mutually exclusive.
--help|-h - this help.
--stop - stop highway server containers (keeps containers and volumes.)
--start - start the existing highway server containers after they were stopped (the opposite to --stop.)
--down - remove highway server containers and leave all volumes intact.
--wipe - stop and remove highway server containers and wipe out volumes.
--compose - fetch the latest stable docker-compose.highway.yml.
--pull - pull images used in docker-compose.highway.yml.
${Yellow}Environment variables:${NC}
HTTP_PORT - (default: 80) Port for HTTP traffic listener.
HTTPS_PORT - (default: 443) Port for HTTPS traffic listener; only used with ssl=true.
OAUTH_DISCOVERY_URL - (required) OAuth provider's OpenID Connect discovery URL.
OAUTH_CLIENT_ID - (required) Client ID of OAuth provider valid for the future STRATO url (http(s)://<NODE_HOST>:<HTTP_PORT/HTTPS_PORT>).
OAUTH_CLIENT_SECRET - (required) Client Secret for the client ID specified.
OAUTH_SCOPE - (default: 'openid email profile') The openid scopes used in session cookie verification
ssl - (default: false) [true|false] to run the node with SSL/TLS.
sslCertFileType - (default: pem) [pem|crt] the SSL certificate type and file extension (should be accessible at ./ssl/certs/server.<sslCertFileType> at deploy time.)
"
}

function wipe {
echo -e "${Yellow}Removing Highway containers and wiping out volumes${NC}"
${docker_compose} down -vt 0 --remove-orphans
}

function down {
echo -e "${Yellow}Removing Highway containers${NC}"
${docker_compose} down --remove-orphans
}

function stop {
echo -e "${Yellow}Gently stopping Highway containers${NC}"
${docker_compose} stop
}

function start {
echo -e "${Yellow}Starting the earlier stopped Highway containers${NC}"
${docker_compose} start
}

function getCompose {
echo -e "${Yellow}Downloading the latest stable version of docker-compose.highway.yml...${NC}"
curl -fLo docker-compose.highway.yml https://github.com/blockapps/strato-getting-started/releases/download/$(curl -s -L https://github.com/blockapps/strato-getting-started/releases/latest | grep -om1 '"/blockapps/strato-getting-started/releases/tag/[^"]*' | grep -oE "[^/]+$")/docker-compose.highway.yml
echo -e "${Yellow}docker-compose.highway.yml downloaded successfully.${NC}"
}

function pullImages {
${docker_compose} pull
}


if [ ! -f $(pwd)/strato ]; then
echo -e "${Red}Should be run from within the strato-getting-started directory. Exit.${NC}"
exit 4
fi

if ! docker ps &> /dev/null
then
echo -e "${Red}Error: docker is required: https://www.docker.com/ . If you have it installed - you may need to execute as super user${NC}"
exit 1
fi

if ! docker-compose -v &> /dev/null
then
echo -e "${Red}Error: docker-compose is required: https://docs.docker.com/compose/install/"
exit 2
else
if ! docker compose version &> /dev/null
then
docker_compose="docker-compose -p highway -f docker-compose.highway.yml --log-level ERROR"
else
docker_compose="docker compose -p highway -f docker-compose.highway.yml"
fi
fi

STRATOGS_REQUIRED_VERSION=$(grep strato-getting-started-min-version docker-compose.highway.yml | awk -F":" '{print $NF}')
if [ ${STRATOGS_REQUIRED_VERSION} ]; then
STRATOGS_CURRENT_VERSION=$(< VERSION)
if ! awk -v VER=${STRATOGS_CURRENT_VERSION//.} -v REQ_VER=${STRATOGS_REQUIRED_VERSION//.} 'BEGIN {exit (VER < REQ_VER)}'
then
echo -e "${Red}The STRATO version from docker-compose.highway.yml is incompatible with this strato-getting-started. Please update to v${STRATOGS_REQUIRED_VERSION}."
exit 12
fi
fi

while [ ${#} -gt 0 ]; do
case "${1}" in
--help|-h)
help
exit 0
;;
--stop)
stop
exit 0
;;
--start)
start
exit 0
;;
--down)
down
exit 0
;;
--wipe)
wipe
exit 0
;;
--compose)
getCompose
exit 0
;;
--pull)
pullImages
exit 0
;;
*)
echo -e "${Red}Unknown flag ${1} provided, please check --help. Exit.${NC}"
exit 5
;;
esac
shift 1
done

outputLogo

if [ "$ssl" = true ] ; then
http_protocol=https
main_port=${HTTPS_PORT}
else
http_protocol=http
main_port=${HTTP_PORT}
fi
export sslCertFileType=${sslCertFileType:-pem}

echo "" && echo "*** Common Config ***"
echo "HTTP_PORT: $HTTP_PORT"
echo "HTTPS_PORT: $HTTPS_PORT"
echo "ssl: $ssl"
echo "sslCertFileType: $sslCertFileType"

if [ ! -f docker-compose.highway.yml ]
then
getCompose
else
echo -e "${BYellow}Using the existing docker-compose.highway.yml (to download the most recent stable version - remove the file and restart the script)${NC}"
fi

# COMPOSE FILE PRE-PROCESSING
function cleanup {
rm docker-compose-highway-temp.yml
}
trap cleanup EXIT

if [ "$ssl" != true ]; then
sed -n '/#TAG_REMOVE_WHEN_NO_SSL/!p' docker-compose.highway.yml > docker-compose-highway-temp.yml
else
if [ "$HTTPS_PORT" != "443" ]; then
sed -n '/#TAG_REMOVE_WHEN_SSL_CUSTOM_HTTPS_PORT/!p' docker-compose.highway.yml > docker-compose-highway-temp.yml
else
cp docker-compose.highway.yml docker-compose-highway-temp.yml
fi
fi
# END OF COMPOSE FILE PRE-PROCESSING

${docker_compose} -f docker-compose-highway-temp.yml up -d --remove-orphans
until curl --silent --output /dev/null --fail --insecure --location "${http_protocol}://localhost:${main_port}/_ping" ; do sleep 0.5; done

echo -e "\n${Green}STRATO Highway Server has awoken. Check ${http_protocol}://your.hostname:${main_port}${NC}"
20 changes: 6 additions & 14 deletions strato
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,15 @@ sslCertFileType - (default: pem) [pem|crt] the SSL certificate type and file
OAUTH_DISCOVERY_URL - (required) OAuth provider's OpenID Connect discovery URL.
OAUTH_CLIENT_ID - (required) Client ID of OAuth provider valid for the future STRATO url (http(s)://<NODE_HOST>:<HTTP_PORT/HTTPS_PORT>).
OAUTH_CLIENT_SECRET - (required) Client Secret for the client ID specified.
OAUTH_JWT_USER_ID_CLAIM - DEPRECATED (default: 'sub') The name of claim (property) in JWT access token's payload, the value of which will be used as user name in STRATO, e.g. 'preferred_username', 'email', 'sub' etc.
OAUTH_SCOPE - (default: 'openid email profile') The openid scopes used in session cookie verification (alter for custom OAUTH_JWT_USER_ID_CLAIM only, refer to your OAuth provider's documentation.)
OAUTH_SCOPE - (default: 'openid email profile') The openid scopes used in session cookie verification
OAUTH_VAULT_PROXY_ALT_CLIENT_ID - (optional) Alternative client id to use in Vault Proxy within STRATO Core for Client Credentials Grant flow (used when Identity Provider does not support multiple grant flows on a single client (e.g. AWS Cognito))
OAUTH_VAULT_PROXY_ALT_CLIENT_SECRET - (optional) Client secret for alternative client id
VAULT_URL - (required) The URL of STRATO Vault in the format '<protocol>://<hostname>:<port>' (e.g. https://example.com or https://example.com:8090)
Marketplace App variables:
MP_IS_BOOTNODE - (default: false) [true|false] Whether or not to run the Markeplace in boot node mode or connect to the existing marketplace deployment based on address provided in MP_DAPP_ADDRESS
MP_DAPP_ADDRESS - (default: c93f9a422a4508a6501a63537291128122f7bcf2) When in MP_IS_BOOTNODE=false mode, this address is used to connect to the existing Marketplace contract on the chain
EXT_STORAGE_S3_BUCKET - (required for STRATO versions bundled with Marketplace) - AWS S3 bucket name to be used in the Marketplace App
EXT_STORAGE_S3_ACCESS_KEY_ID - (required for STRATO versions bundled with Marketplace) - Access key id of AWS IAM user with access to the bucket provided in EXT_STORAGE_S3_BUCKET
EXT_STORAGE_S3_SECRET_ACCESS_KEY - (required for STRATO versions bundled with Marketplace) - Secret access key of AWS IAM user
STRIPE_PAYMENT_SERVER_URL - (required for STRATO versions bundled with Marketplace) - URL of payment server be used in the Marketplace App
GLOBAL_ADMIN_NAME - (required for STRATO versions bundled with Marketplace and running in MP_IS_BOOTNODE=true mode)
GLOBAL_ADMIN_PASSWORD - (required for STRATO versions bundled with Marketplace and running in MP_IS_BOOTNODE=true mode)
"
Expand Down Expand Up @@ -156,7 +153,7 @@ function fetchLogs {
if [[ "$1" = withdb ]]; then
withdb_flag="--db-dump"
fi
python fetchlogs ${withdb_flag}
python3 fetchlogs ${withdb_flag}
}

if [ ! -f $(pwd)/strato ]; then
Expand Down Expand Up @@ -317,14 +314,10 @@ if grep "marketplace" docker-compose.yml > /dev/null; then
exit 15
fi
fi
if [[ -z ${EXT_STORAGE_S3_BUCKET} || -z ${EXT_STORAGE_S3_ACCESS_KEY_ID} || -z ${EXT_STORAGE_S3_SECRET_ACCESS_KEY} ]] ; then
echo -e "${Red}EXT_STORAGE_S3_BUCKET, EXT_STORAGE_S3_ACCESS_KEY_ID, EXT_STORAGE_S3_SECRET_ACCESS_KEY are required for this STRATO version\nFor additional help see './strato --help'${NC}"
if [[ -z ${STRIPE_PAYMENT_SERVER_URL} ]] ; then
echo -e "${Red}STRIPE_PAYMENT_SERVER_URL is required for this STRATO version\nFor additional help see './strato --help'${NC}"
exit 16
fi
if [[ -z ${STRIPE_PUBLISHABLE_KEY} || -z ${STRIPE_SECRET_KEY} ]] ; then
echo -e "${Red}STRIPE_PUBLISHABLE_KEY, STRIPE_SECRET_KEY are required for this STRATO version\nFor additional help see './strato --help'${NC}"
exit 18
fi
fi

echo "" && echo "*** Common Config ***"
Expand All @@ -341,7 +334,7 @@ echo "OAUTH_JWT_USER_ID_CLAIM: ${OAUTH_JWT_USER_ID_CLAIM:-not set (using default
echo "OAUTH_SCOPE: ${OAUTH_SCOPE:-not set (using default)}"
echo "VAULT_URL: ${VAULT_URL}"

if [ ${node_type} = single ]
if [ "${node_type}" == "single" ]
then
echo "" && echo -e "${BYellow}Running single node with PBFT-blockstanbul${NC}"
export blockstanbul=true
Expand Down Expand Up @@ -391,7 +384,6 @@ echo "generateKey: $generateKey"
echo "numMinPeers: $numMinPeers"
echo "networkID: ${networkID:-unset - using default}"

echo "" && echo "*** Genesis Block ***"
if [[ -e "genesis-block.json" && -z ${genesis+x} ]]
then
export genesisBlock=$(< genesis-block.json)
Expand Down
Loading

0 comments on commit 2c9b187

Please sign in to comment.