Commit 854c763d authored by Daniel Scholl's avatar Daniel Scholl
Browse files

Merge branch 'delivery_script' into 'master'

Added Delivery Script

See merge request osdu/platform/deployment-and-operations/infra-azure-provisioning!88
parents ea3580ab c05822cd
#!/usr/bin/env bash
#
# Purpose: Create the Developer Environment Variables.
# Usage:
# delivery.sh
###############################
## ARGUMENT INPUT ##
###############################
usage() { echo "Usage: DNS_HOST=<your_host> INVALID_JWT=<your_token> delivery.sh " 1>&2; exit 1; }
SERVICE="delivery"
if [ -z $UNIQUE ]; then
tput setaf 1; echo 'ERROR: UNIQUE not provided' ; tput sgr0
usage;
fi
if [ -z $DNS_HOST ]; then
tput setaf 1; echo 'ERROR: DNS_HOST not provided' ; tput sgr0
usage;
fi
if [ -z $COMMON_VAULT ]; then
tput setaf 1; echo 'ERROR: COMMON_VAULT not provided' ; tput sgr0
usage;
fi
if [ -z $INVALID_JWT ]; then
tput setaf 1; echo 'ERROR: INVALID_JWT not provided' ; tput sgr0
usage;
fi
if [ -f ./settings_common.env ]; then
source ./settings_common.env;
else
tput setaf 1; echo 'ERROR: common.env not found' ; tput sgr0
fi
if [ -f ./settings_environment.env ]; then
source ./settings_environment.env;
else
tput setaf 1; echo 'ERROR: environment.env not found' ; tput sgr0
fi
if [ ! -d $UNIQUE ]; then mkdir $UNIQUE; fi
# ------------------------------------------------------------------------------------------------------
# LocalHost Run Settings
# ------------------------------------------------------------------------------------------------------
AZURE_TENANT_ID="${TENANT_ID}"
AZURE_CLIENT_ID="${ENV_PRINCIPAL_ID}"
AZURE_CLIENT_SECRET="${ENV_PRINCIPAL_SECRET}"
KEYVAULT_URI="${ENV_KEYVAULT}"
aad_client_id="${ENV_APP_ID}"
appinsights_key="${ENV_APPINSIGHTS_KEY}"
AUTHORIZE_API="https://${ENV_HOST}/entitlements/v1/"
SEARCH_HOST="https://${ENV_HOST}/api/search/v2/"
partition_service_endpoint="https://${ENV_HOST}/api/partition/v1/"
BATCH_SIZE="100"
SEARCH_QUERY_LIMIT="1000"
azure_istioauth_enabled="true"
server_port="8085"
# ------------------------------------------------------------------------------------------------------
# Integration Test Settings
# ------------------------------------------------------------------------------------------------------
#DELIVERY_HOST="http://localhost:${server_port}/api/delivery/v2/"
DELIVERY_HOST="http://${ENV_HOST}/api/delivery/v2/"
SEARCH_HOST="https://${ENV_HOST}/api/search/v2/"
STORAGE_HOST="https://${ENV_HOST}/api/storage/v2/"
LEGAL_HOST="https://${ENV_HOST}/api/legal/v1/"
TENANT_NAME="${OSDU_TENANT}"
AZURE_AD_TENANT_ID="${TENANT_ID}"
INTEGRATION_TESTER="${ENV_PRINCIPAL_ID}"
TESTER_SERVICEPRINCIPAL_SECRET="${ENV_PRINCIPAL_SECRET}"
AZURE_STORAGE_ACCOUNT="${ENV_STORAGE}"
AZURE_AD_APP_RESOURCE_ID="${ENV_APP_ID}"
DEFAULT_DATA_PARTITION_ID_TENANT1="${OSDU_TENANT2}"
DEFAULT_DATA_PARTITION_ID_TENANT2="${OSDU_TENANT3}"
DOMAIN="${COMPANY_DOMAIN}"
ENTITLEMENTS_DOMAIN="${COMPANY_DOMAIN}"
LEGAL_TAG="${LEGAL_TAG}"
OTHER_RELEVANT_DATA_COUNTRIES="US"
cat > ${UNIQUE}/${SERVICE}.envrc <<LOCALENV
# ------------------------------------------------------------------------------------------------------
# Common Settings
# ------------------------------------------------------------------------------------------------------
export OSDU_TENANT=$OSDU_TENANT
export OSDU_TENANT2=$OSDU_TENANT2
export OSDU_TENANT3=$OSDU_TENANT3
export COMPANY_DOMAIN=$COMPANY_DOMAIN
export COSMOS_DB_NAME=$COSMOS_DB_NAME
export LEGAL_SERVICE_BUS_TOPIC=$LEGAL_SERVICE_BUS_TOPIC
export RECORD_SERVICE_BUS_TOPIC=$RECORD_SERVICE_BUS_TOPIC
export LEGAL_STORAGE_CONTAINER=$LEGAL_STORAGE_CONTAINER
export TENANT_ID=$TENANT_ID
export INVALID_JWT=$INVALID_JWT
export NO_ACCESS_ID=$NO_ACCESS_ID
export NO_ACCESS_SECRET=$NO_ACCESS_SECRET
export OTHER_APP_ID=$OTHER_APP_ID
export OTHER_APP_OID=$OTHER_APP_OID
export AD_USER_EMAIL=$AD_USER_EMAIL
export AD_USER_OID=$AD_USER_OID
export AD_GUEST_EMAIL=$AD_GUEST_EMAIL
export AD_GUEST_OID=$AD_GUEST_OID
# ------------------------------------------------------------------------------------------------------
# Environment Settings
# ------------------------------------------------------------------------------------------------------
export ENV_SUBSCRIPTION_NAME=$ENV_SUBSCRIPTION_NAME
export ENV_APP_ID=$ENV_APP_ID
export ENV_PRINCIPAL_ID=$ENV_PRINCIPAL_ID
export ENV_PRINCIPAL_SECRET=$ENV_PRINCIPAL_SECRET
export ENV_APPINSIGHTS_KEY=$ENV_APPINSIGHTS_KEY
export ENV_REGISTRY=$ENV_REGISTRY
export ENV_STORAGE=$ENV_STORAGE
export ENV_STORAGE_KEY=$ENV_STORAGE_KEY
export ENV_STORAGE_CONNECTION=$ENV_STORAGE_CONNECTION
export ENV_COSMOSDB_HOST=$ENV_COSMOSDB_HOST
export ENV_COSMOSDB_KEY=$ENV_COSMOSDB_KEY
export ENV_SERVICEBUS_NAMESPACE=$ENV_SERVICEBUS_NAMESPACE
export ENV_SERVICEBUS_CONNECTION=$ENV_SERVICEBUS_CONNECTION
export ENV_KEYVAULT=$ENV_KEYVAULT
export ENV_HOST=$ENV_HOST
export ENV_REGION=$ENV_REGION
export ENV_ELASTIC_HOST=$ENV_ELASTIC_HOST
export ENV_ELASTIC_PORT=$ENV_ELASTIC_PORT
export ENV_ELASTIC_USERNAME=$ENV_ELASTIC_USERNAME
export ENV_ELASTIC_PASSWORD=$ENV_ELASTIC_PASSWORD
# ------------------------------------------------------------------------------------------------------
# LocalHost Run Settings
# ------------------------------------------------------------------------------------------------------
export AZURE_TENANT_ID="${TENANT_ID}"
export AZURE_CLIENT_ID="${ENV_PRINCIPAL_ID}"
export AZURE_CLIENT_SECRET="${ENV_PRINCIPAL_SECRET}"
export KEYVAULT_URI="${ENV_KEYVAULT}"
export aad_client_id="${ENV_APP_ID}"
export appinsights_key="${ENV_APPINSIGHTS_KEY}"
export AUTHORIZE_API="https://${ENV_HOST}/entitlements/v1/"
export SEARCH_HOST="https://${ENV_HOST}/api/search/v2/"
export partition_service_endpoint="https://${ENV_HOST}/api/partition/v1/"
export BATCH_SIZE="${BATCH_SIZE}"
export SEARCH_QUERY_LIMIT="${SEARCH_QUERY_LIMIT}"
export azure_istioauth_enabled="${azure_istioauth_enabled}"
export server_port="${server_port}"
# ------------------------------------------------------------------------------------------------------
# Integration Test Settings
# ------------------------------------------------------------------------------------------------------
#export DELIVERY_HOST="http://localhost:${server_port}/api/delivery/v2/"
export DELIVERY_HOST="https://${ENV_HOST}/api/delivery/v2/"
export SEARCH_HOST="https://${ENV_HOST}/api/search/v2/"
export STORAGE_HOST="https://${ENV_HOST}/api/storage/v2/"
export LEGAL_HOST="https://${ENV_HOST}/api/legal/v1/"
export TENANT_NAME="${TENANT_NAME}"
export AZURE_AD_TENANT_ID="${TENANT_ID}"
export INTEGRATION_TESTER="${ENV_PRINCIPAL_ID}"
export TESTER_SERVICEPRINCIPAL_SECRET="${ENV_PRINCIPAL_SECRET}"
export AZURE_STORAGE_ACCOUNT="${ENV_STORAGE}"
export AZURE_AD_APP_RESOURCE_ID="${ENV_APP_ID}"
export DEFAULT_DATA_PARTITION_ID_TENANT1="${OSDU_TENANT2}"
export DEFAULT_DATA_PARTITION_ID_TENANT2="${OSDU_TENANT3}"
export DOMAIN="${COMPANY_DOMAIN}"
export ENTITLEMENTS_DOMAIN="${COMPANY_DOMAIN}"
export LEGAL_TAG="${LEGAL_TAG}"
export OTHER_RELEVANT_DATA_COUNTRIES="${OTHER_RELEVANT_DATA_COUNTRIES}"
LOCALENV
cat > ${UNIQUE}/${SERVICE}_local.yaml <<LOCALRUN
AZURE_TENANT_ID: "${TENANT_ID}"
AZURE_CLIENT_ID: "${ENV_PRINCIPAL_ID}"
AZURE_CLIENT_SECRET: "${ENV_PRINCIPAL_SECRET}"
KEYVAULT_URI: "${ENV_KEYVAULT}"
aad_client_id: "${ENV_APP_ID}"
appinsights_key: "${ENV_APPINSIGHTS_KEY}"
AUTHORIZE_API: "https://${ENV_HOST}/entitlements/v1/"
SEARCH_HOST: "https://${ENV_HOST}/api/search/v2/"
partition_service_endpoint: "https://${ENV_HOST}/api/partition/v1/"
BATCH_SIZE="${BATCH_SIZE}"
SEARCH_QUERY_LIMIT="${SEARCH_QUERY_LIMIT}"
azure_istioauth_enabled: "${azure_istioauth_enabled}"
server_port: "${server_port}"
LOCALRUN
cat > ${UNIQUE}/${SERVICE}_local_test.yaml <<LOCALTEST
DELIVERY_HOST: "http://localhost:${server_port}/api/delivery/v2/"
SEARCH_HOST: "${SEARCH_HOST}"
STORAGE_HOST: "${STORAGE_HOST}"
LEGAL_HOST: "${LEGAL_HOST}"
TENANT_NAME: "${TENANT_NAME}"
AZURE_AD_TENANT_ID: "${TENANT_ID}"
INTEGRATION_TESTER: "${INTEGRATION_TESTER}"
TESTER_SERVICEPRINCIPAL_SECRET: "${TESTER_SERVICEPRINCIPAL_SECRET}"
AZURE_STORAGE_ACCOUNT: "${AZURE_STORAGE_ACCOUNT}"
AZURE_AD_APP_RESOURCE_ID: "${AZURE_AD_APP_RESOURCE_ID}"
DEFAULT_DATA_PARTITION_ID_TENANT1: "${OSDU_TENANT2}"
DEFAULT_DATA_PARTITION_ID_TENANT2: "${OSDU_TENANT3}
DOMAIN: "${COMPANY_DOMAIN}"
ENTITLEMENTS_DOMAIN: "${COMPANY_DOMAIN}"
LEGAL_TAG: "${LEGAL_TAG}"
OTHER_RELEVANT_DATA_COUNTRIES: "${OTHER_RELEVANT_DATA_COUNTRIES}"
LOCALTEST
cat > ${UNIQUE}/${SERVICE}_test.yaml <<DEVTEST
DELIVERY_HOST: "http://${ENV_HOST}/api/delivery/v2/"
SEARCH_HOST: "https://${ENV_HOST}/api/search/v2/"
STORAGE_HOST: "https://${ENV_HOST}/api/storage/v2/"
LEGAL_HOST: "https://${ENV_HOST}/api/legal/v1/"
TENANT_NAME: "${TENANT_NAME}"
AZURE_AD_TENANT_ID: "${TENANT_ID}"
INTEGRATION_TESTER: "${INTEGRATION_TESTER}"
TESTER_SERVICEPRINCIPAL_SECRET: "${TESTER_SERVICEPRINCIPAL_SECRET}"
AZURE_STORAGE_ACCOUNT: "${AZURE_STORAGE_ACCOUNT}"
AZURE_AD_APP_RESOURCE_ID: "${AZURE_AD_APP_RESOURCE_ID}"
DEFAULT_DATA_PARTITION_ID_TENANT1: "${OSDU_TENANT2}"
DEFAULT_DATA_PARTITION_ID_TENANT2: "${OSDU_TENANT3}
DOMAIN: "${COMPANY_DOMAIN}"
ENTITLEMENTS_DOMAIN: "${COMPANY_DOMAIN}"
LEGAL_TAG: "${LEGAL_TAG}"
OTHER_RELEVANT_DATA_COUNTRIES: "${OTHER_RELEVANT_DATA_COUNTRIES}"
DEVTEST
File mode changed from 100644 to 100755
......@@ -9,6 +9,7 @@ COSMOS_DB_NAME="osdu-db"
LEGAL_SERVICE_BUS_TOPIC="legaltags"
RECORD_SERVICE_BUS_TOPIC="recordstopic"
LEGAL_STORAGE_CONTAINER="legal-service-azure-configuration"
LEGAL_TAG="opendes-public-usa-dataset-7643990"
TENANT_ID="$(az account show --query tenantId -otsv)"
INVALID_JWT=$INVALID_JWT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment