* Initial Work of Better Deployment Script * Checks if .secret is Present on Test Setup * Implements Custom Routing per Profile * Rewriting Setup Tools - Adds Postgres and Redis * Rewriting Setup Tools - Adds Frontend * Rewriting Setup Tools - Adds Backend * Rewriting Setup Tools - Adds CertManager * Rewriting Setup Tools - Adds Frontend * Adds Nginx-Ingress and Fixes Staging Environment * Updates CertManager and Nginx-Ingress * Implements New Setup Process Initial Adjustments to CI/CD Adjusts CI/CD test * Adds CI/CD for Prod Environment
This commit is contained in:
62
setup.sh
Executable file
62
setup.sh
Executable file
@@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
TEMPLATE='./template'
|
||||
WORK_DIR='./deployment'
|
||||
|
||||
|
||||
function set_working_dir {
|
||||
mkdir -p $WORK_DIR;
|
||||
mkdir -p $WORK_DIR/redis;
|
||||
mkdir -p $WORK_DIR/postgres;
|
||||
mkdir -p $WORK_DIR/frontend;
|
||||
mkdir -p $WORK_DIR/backend;
|
||||
|
||||
envsubst < $TEMPLATE/redis/redis-secret.template.yaml > $WORK_DIR/redis/redis-secret.yaml;
|
||||
envsubst < $TEMPLATE/postgres/postgres-secret.template.yaml > $WORK_DIR/postgres/postgres-secret.yaml;
|
||||
envsubst < $TEMPLATE/frontend/frontend-secret.template.yaml > $WORK_DIR/frontend/frontend-secret.yaml;
|
||||
envsubst < $TEMPLATE/backend/backend-secret.template.yaml > $WORK_DIR/backend/backend-secret.yaml;
|
||||
envsubst < $TEMPLATE/nginx-ingress/nginx-ingress-api.yaml > $WORK_DIR/nginx-ingress/nginx-ingress-api.yaml;
|
||||
envsubst < $TEMPLATE/nginx-ingress/nginx-ingress-root.yaml > $WORK_DIR/nginx-ingress/nginx-ingress-root.yaml;
|
||||
envsubst < $TEMPLATE/cert-manager/cert-manager-certificate.template.yaml > $WORK_DIR/cert-manager/cert-manager-certificate.yaml;
|
||||
}
|
||||
|
||||
|
||||
function main {
|
||||
if [[ $1 == "--prod" || $1 == "-a" ]]; then
|
||||
DOMAIN="hideyoshi.com.br"
|
||||
API_DOMAIN="api.hideyoshi.com.br"
|
||||
elif [[ $1 == "--staging" || $1 == "-a" ]]; then
|
||||
DOMAIN="staging.hideyoshi.com.br"
|
||||
API_DOMAIN="api.staging.hideyoshi.com.br"
|
||||
elif [[ $1 == "--dev" || $1 == "-d" ]]; then
|
||||
DOMAIN="hideyoshi.com.br"
|
||||
API_DOMAIN="api.hideyoshi.com.br"
|
||||
fi
|
||||
|
||||
[[ -z $2 ]] && secret_file=".secret" || secret_file=$2
|
||||
|
||||
if [[ -e $secret_file ]]; then
|
||||
|
||||
set -a
|
||||
while read line; do
|
||||
if [[ $line != "" ]]; then
|
||||
variable=$(echo -n "$line" | cut -f 1 -d '=')
|
||||
value=$(echo -n $(echo -n "$line" | cut -f 2- -d '=') | base64 -w 0)
|
||||
declare "$variable=$value"
|
||||
fi
|
||||
done < $secret_file
|
||||
set +a
|
||||
|
||||
else
|
||||
|
||||
echo "ERROR: Secret file not found.";
|
||||
exit 1;
|
||||
|
||||
fi
|
||||
|
||||
set_working_dir
|
||||
}
|
||||
|
||||
|
||||
main $@
|
||||
Reference in New Issue
Block a user