generated from oracle-devrel/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from mgueury/main
APEX v1
- Loading branch information
Showing
54 changed files
with
18,933 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
#!/bin/bash | ||
export BIN_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
export ROOT_DIR=${BIN_DIR%/*} | ||
if [[ -z "${BIN_DIR}" ]]; then | ||
export BIN_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
fi | ||
if [[ -z "${PROJECT_DIR}" ]]; then | ||
echo "Error: PROJECT_DIR not set" | ||
exit | ||
fi | ||
|
||
# Target DIR | ||
export TARGET_DIR=$PROJECT_DIR/target | ||
if [ ! -d $TARGET_DIR ]; then | ||
mkdir $TARGET_DIR | ||
fi | ||
|
||
# Shared BASH Functions | ||
. $BIN_DIR/shared_bash_function.sh | ||
|
||
if [ "$1" == "-no-auto" ]; then | ||
return | ||
fi | ||
|
||
# Silent mode (default is not silent) | ||
if [ "$1" == "-silent" ]; then | ||
SILENT_MODE=true | ||
|
@@ -20,7 +35,7 @@ fi | |
if [ "$TF_VAR_db_password" == "__TO_FILL__" ]; then | ||
echo "Generating password for the database" | ||
export TF_VAR_db_password=`python3 $BIN_DIR/gen_password.py` | ||
sed -i "s&TF_VAR_db_password=\"__TO_FILL__\"&TF_VAR_db_password=\"$TF_VAR_db_password\"&" $ROOT_DIR/env.sh | ||
sed -i "s&TF_VAR_db_password=\"__TO_FILL__\"&TF_VAR_db_password=\"$TF_VAR_db_password\"&" $PROJECT_DIR/env.sh | ||
echo "Password stored in env.sh" | ||
echo "> TF_VAR_db_password=$TF_VAR_db_password" | ||
fi | ||
|
@@ -44,11 +59,6 @@ if ! command -v jq &> /dev/null; then | |
exit 1 | ||
fi | ||
|
||
export TARGET_DIR=$ROOT_DIR/target | ||
if [ ! -d $TARGET_DIR ]; then | ||
mkdir $TARGET_DIR | ||
fi | ||
|
||
#-- PRE terraform ---------------------------------------------------------- | ||
if [ "$OCI_STARTER_VARIABLES_SET" == "$OCI_STARTER_CREATION_DATE" ]; then | ||
echo "Variables already set" | ||
|
@@ -103,7 +113,7 @@ else | |
auto_echo TF_VAR_region=$TF_VAR_region | ||
|
||
# Kubernetes and OCIR | ||
if [ "$TF_VAR_deploy_strategy" == "kubernetes" ] || [ "$TF_VAR_deploy_strategy" == "function" ] || [ "$TF_VAR_deploy_strategy" == "container_instance" ] || [ -f $ROOT_DIR/src/terraform/oke.tf ]; then | ||
if [ "$TF_VAR_deploy_strategy" == "kubernetes" ] || [ "$TF_VAR_deploy_strategy" == "function" ] || [ "$TF_VAR_deploy_strategy" == "container_instance" ] || [ -f $PROJECT_DIR/src/terraform/oke.tf ]; then | ||
export TF_VAR_namespace=`oci os ns get | jq -r .data` | ||
auto_echo TF_VAR_namespace=$TF_VAR_namespace | ||
export [email protected] | ||
|
@@ -113,12 +123,12 @@ else | |
|
||
export DOCKER_PREFIX=${TF_VAR_ocir}/${TF_VAR_namespace} | ||
auto_echo DOCKER_PREFIX=$DOCKER_PREFIX | ||
export KUBECONFIG=$ROOT_DIR/target/kubeconfig_starter | ||
export KUBECONFIG=$TARGET_DIR/kubeconfig_starter | ||
fi | ||
|
||
# OpenAPI Spec | ||
if [ -f $ROOT_DIR/src/app/openapi_spec.yaml ]; then | ||
export TF_VAR_openapi_spec=$(cat $ROOT_DIR/src/app/openapi_spec.yaml) | ||
if [ -f $PROJECT_DIR/src/app/openapi_spec.yaml ]; then | ||
export TF_VAR_openapi_spec=$(cat $PROJECT_DIR/src/app/openapi_spec.yaml) | ||
fi | ||
|
||
if [ "$TF_VAR_deploy_strategy" == "hpc" ]; then | ||
|
@@ -141,7 +151,7 @@ else | |
S1=${TF_VAR_git_url/git@gitlab.com:/https:\/\/gitlab.com\/} | ||
export TF_VAR_git_url=${S1/.git/\/-\/blob\/}${GIT_BRANCH} | ||
fi | ||
cd $ROOT_DIR | ||
cd $PROJECT_DIR | ||
export GIT_RELATIVE_PATH=`git rev-parse --show-prefix` | ||
cd - | ||
export TF_VAR_git_url=${TF_VAR_git_url}/${GIT_RELATIVE_PATH} | ||
|
@@ -215,13 +225,13 @@ if [ -f $STATE_FILE ]; then | |
get_attribute_from_tfstate "DB_NODE_IP" "starter_node_vnic" "private_ip_address" | ||
fi | ||
|
||
if [ "$TF_VAR_deploy_strategy" == "kubernetes" ] || [ -f $ROOT_DIR/src/terraform/oke.tf ]; then | ||
if [ "$TF_VAR_deploy_strategy" == "kubernetes" ] || [ -f $PROJECT_DIR/src/terraform/oke.tf ]; then | ||
# OKE | ||
get_output_from_tfstate "OKE_OCID" "oke_ocid" | ||
fi | ||
|
||
# JMS | ||
if [ -f $ROOT_DIR/src/terraform/jms.tf ]; then | ||
if [ -f $PROJECT_DIR/src/terraform/jms.tf ]; then | ||
if [ ! -f $TARGET_DIR/jms_agent_deploy.sh ]; then | ||
get_output_from_tfstate "FLEET_OCID" "fleet_ocid" | ||
get_output_from_tfstate "INSTALL_KEY_OCID" "install_key_ocid" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
# Build_common.sh | ||
BIN_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
#!/bin/bash | ||
if [[ -z "${BIN_DIR}" ]]; then | ||
echo "Error: BIN_DIR not set" | ||
exit | ||
fi | ||
if [[ -z "${PROJECT_DIR}" ]]; then | ||
echo "Error: PROJECT_DIR not set" | ||
exit | ||
fi | ||
|
||
# SCRIPT_DIR should be set by the calling scripts | ||
APP_DIR=`echo ${SCRIPT_DIR} |sed -E "s#(.*)/(.*)#\2#"` | ||
cd $SCRIPT_DIR | ||
|
||
if [ -z "$TF_VAR_deploy_strategy" ]; then | ||
. $BIN_DIR/../env.sh | ||
. $PROJECT_DIR/env.sh | ||
else | ||
. $BIN_DIR/shared_bash_function.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Usage: python openapi_list.py <filename> | ||
# /app/dept | ||
# /app/info | ||
# Usage: python openapi_list.py <filename> <url_prefix> | ||
# Rest DB API: $URL_PREFIX/app/dept | ||
# Rest Info API: $URL_PREFIX/app/info | ||
|
||
import yaml, sys | ||
|
||
filename = sys.argv[1]; | ||
url_prefix = "" | ||
if len(sys.argv)>2: | ||
url_prefix = sys.argv[2]; | ||
|
||
with open(filename, "r") as stream: | ||
try: | ||
data = yaml.safe_load(stream) | ||
for key, value in data["paths"].items(): | ||
if url_prefix != "": | ||
print("- " + str(value["get"]["summary"]) +": " + url_prefix + str(key)) | ||
else: | ||
print(str(key)) | ||
except yaml.YAMLError as exc: | ||
print(exc) |
Oops, something went wrong.