Skip to content

Commit

Permalink
WIP: Deploy multiapps controller
Browse files Browse the repository at this point in the history
  • Loading branch information
bonzofenix committed Jun 10, 2024
1 parent 280b101 commit 77e93bc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
35 changes: 33 additions & 2 deletions ci/infrastructure/scripts/deploy-multiapps-controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,36 @@
# shellcheck disable=SC2086
set -euo pipefail

echo "multiapps controller manifest content:"
cat multiapps-controller-repo/multiapps-controller-web/manifests/manifest.yml
set -x
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
source "${script_dir}/vars.source.sh"
source "${script_dir}/utils.source.sh"

function create_user_provided_service() {
postgres_username=pgadmin
postgres_database_name=multiapps_controller
postgres_hostname=$(credhub get -n /bosh-autoscaler/postgres/postgres_host_or_ip -q)
postgres_password=$(credhub get -n /bosh-autoscaler/postgres/pgadmin_database_password -q)

cf cups deploy-service-database -p "{ \"uri\": \"sqlserver://${postgres_hostname}:5524;database=${postgres_database_name}\", \"username\": \"${postgres_username}\", \"password\": \"${postgres_password}\" }"
}

function deploy() {
cp multiapps-controller-repo/manifests/manifest.yml multiapps-controller-artifact/manifest.yml

pushd multiapps-controller-artifact
yq -i '.applications[0].path = "updated_path.war"' mannifest.yml
yq -i '.applications[0].env.VERSION = "1.0.0"' manifest.yml
cf push -f manifest.yml
popd




yq e '.applications[0].env.VERSION = "1.0.0"' your_file.yml > temp.yml && mv temp.yml your_file.yml
}

load_bbl_vars
cf_login
create_user_provided_service
deploy
2 changes: 1 addition & 1 deletion ci/infrastructure/scripts/deploy-postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function deploy () {
ops_files_to_use="${ops_files_to_use} -o ${OPS_FILE}"
done

add_var_to_bosh_deploy_opts "postgres_host_or_ip" "10.0.255.2"
credhub set -n /bosh-autoscaler/postgres/postgres_host_or_ip -t value -v "10.0.255.2"

step "Deploying release with name '${deployment_name}' "
log "using Ops files: '${ops_files_to_use}'"
Expand Down
11 changes: 11 additions & 0 deletions ci/infrastructure/scripts/utils.source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function load_bbl_vars() {

director_store="${bbl_state_path}/vars/director-vars-store.yml"
log "director_store = '${director_store}'"
if [[ ! -d ${bbl_state_path} ]]; then
echo "FAILED: Did not find bbl-state folder at ${bbl_state_path}"
echo "Make sure you have checked out the app-autoscaler-env-bbl-state repository next to the app-autoscaler-release repository to run this target or indicate its location via BBL_STATE_PATH";
exit 1;
fi

pushd "${bbl_state_path}" > /dev/null || exit
eval "$(bbl print-env)"
Expand All @@ -59,3 +64,9 @@ function add_var_to_bosh_deploy_opts() {
local var_value=$2
bosh_deploy_opts="${bosh_deploy_opts} -v ${var_name}=${var_value}"
}

function cf_login(){
cf api "https://api.${system_domain}" --skip-ssl-validation
CF_ADMIN_PASSWORD=$(credhub get -n /bosh-autoscaler/cf/cf_admin_password -q)
cf auth admin "$CF_ADMIN_PASSWORD"
}

0 comments on commit 77e93bc

Please sign in to comment.