From afc3a01cd820a12dbb4ba504bf4295201ea70171 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 10:23:32 -0400 Subject: [PATCH 1/9] feat(jvb): instance configuration includes common tags --- .../create-jvb-instance-configuration.tf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index 539f0ca0a..fc8697764 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -196,8 +196,14 @@ resource "oci_core_instance_configuration" "oci_instance_configuration" { file("${path.cwd}/${var.user_data_lib_path}/postinstall-header.sh"), # load the header file("${path.cwd}/${var.user_data_lib_path}/postinstall-lib.sh"), # load the lib file("${path.cwd}/${var.user_data_lib_path}/postinstall-eip-lib.sh"), # load the EIP lib - "\nexport INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo}\nexport INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo}\n", #repo variables - "\nexport NOMAD_FLAG=${var.nomad_flag}\n", # nomad variable + < /tmp/oracle_cache-${INSTANCE_ID} +EOT + , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations file("${path.cwd}/${var.user_data_lib_path}/postinstall-footer.sh") # load the footer ])) From 2d55417fa56c03d2901b88df21bf336fef662bd1 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 10:38:53 -0400 Subject: [PATCH 2/9] fix syntax --- .../create-jvb-instance-configuration.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index fc8697764..58e6ca7a0 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -201,7 +201,7 @@ export INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo} export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) -echo "${jsonencode(local.common_tags)}" | sed -e 's/${var.tag_namespace}\.//' > /tmp/oracle_cache-${INSTANCE_ID} +echo "${jsonencode(local.common_tags)}" | sed -e 's/${var.tag_namespace}\.//' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations From 7c649449164cfa7dd62bf62512ce605b88f00449 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 10:44:42 -0400 Subject: [PATCH 3/9] further attempt --- .../create-jvb-instance-configuration.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index 58e6ca7a0..d06f68ba1 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -201,7 +201,7 @@ export INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo} export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) -echo "${jsonencode(local.common_tags)}" | sed -e 's/${var.tag_namespace}\.//' > /tmp/oracle_cache-$INSTANCE_ID +echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/${var.tag_namespace}.//g' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations From b5a2ae2148d79f78430130199cc4980e50600c2c Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:08:24 -0400 Subject: [PATCH 4/9] reduce character count --- .../user-data/postinstall-runner-oracle.sh | 2 +- .../user-data/postinstall-runner-oracle.sh | 2 +- terraform/lib/postinstall-header.sh | 6 +- terraform/lib/postinstall-lib.sh | 127 +++++++++--------- 4 files changed, 69 insertions(+), 68 deletions(-) diff --git a/terraform/create-jigasi-instance-configuration/user-data/postinstall-runner-oracle.sh b/terraform/create-jigasi-instance-configuration/user-data/postinstall-runner-oracle.sh index 139cd07c6..9dbff497d 100644 --- a/terraform/create-jigasi-instance-configuration/user-data/postinstall-runner-oracle.sh +++ b/terraform/create-jigasi-instance-configuration/user-data/postinstall-runner-oracle.sh @@ -11,7 +11,7 @@ function dump() { function provisioning() { local status_code=0 - $TIMEOUT_BIN $PROVISIONING_TIMEOUT /usr/local/bin/postinstall-jigasi.sh >>/var/log/bootstrap.log 2>&1 || status_code=1 + $TMBIN $PTIMEOUT /usr/local/bin/postinstall-jigasi.sh >>/var/log/bootstrap.log 2>&1 || status_code=1 if [ $status_code -eq 1 ]; then echo 'Provisioning stage failed' > $tmp_msg_file; diff --git a/terraform/jibri-instance-configuration/user-data/postinstall-runner-oracle.sh b/terraform/jibri-instance-configuration/user-data/postinstall-runner-oracle.sh index 63fe511f1..8a9a1b569 100644 --- a/terraform/jibri-instance-configuration/user-data/postinstall-runner-oracle.sh +++ b/terraform/jibri-instance-configuration/user-data/postinstall-runner-oracle.sh @@ -34,7 +34,7 @@ fi function provisioning() { local status_code=0 - $TIMEOUT_BIN $PROVISIONING_TIMEOUT sudo /usr/local/bin/postinstall-jibri.sh >>/var/log/bootstrap.log 2>&1 || status_code=1 + $TMBIN $PTIMEOUT sudo /usr/local/bin/postinstall-jibri.sh >>/var/log/bootstrap.log 2>&1 || status_code=1 if [ $status_code -eq 1 ]; then echo 'Provisioning stage failed' >$tmp_msg_file fi diff --git a/terraform/lib/postinstall-header.sh b/terraform/lib/postinstall-header.sh index 2a036c845..e71881e4c 100644 --- a/terraform/lib/postinstall-header.sh +++ b/terraform/lib/postinstall-header.sh @@ -1,6 +1,6 @@ #!/bin/bash -v set -x EXIT_CODE=0 -tmp_msg_file='/tmp/postinstall_runner_message' -TIMEOUT_BIN="/usr/bin/timeout" -PROVISIONING_TIMEOUT="1200" +tmp_msg_file='/tmp/prm' +TMBIN="/usr/bin/timeout" +PTIMEOUT="1200" diff --git a/terraform/lib/postinstall-lib.sh b/terraform/lib/postinstall-lib.sh index 2331dedbe..d3403fab5 100644 --- a/terraform/lib/postinstall-lib.sh +++ b/terraform/lib/postinstall-lib.sh @@ -1,21 +1,21 @@ -BOOTSTRAP_DIRECTORY="/tmp/bootstrap" -LOCAL_REPO_DIRECTORY="/opt/jitsi/bootstrap" +BSD="/tmp/bootstrap" +LRD="/opt/jitsi/bootstrap" function check_private_ip() { local counter=1 - local ip_status=1 + local ips=1 while [ $counter -le 2 ]; do - local my_private_ip=$(curl -s curl http://169.254.169.254/opc/v1/vnics/ | jq .[0].privateIp -r) - if [ -z $my_private_ip ] || [ $my_private_ip == "null" ]; then + local pip=$(curl -s curl http://169.254.169.254/opc/v1/vnics/ | jq .[0].privateIp -r) + if [ -z $pip ] || [ $pip == "null" ]; then sleep 30 ((counter++)) else - ip_status=0 + ips=0 break fi done - if [ $ip_status -eq 1 ]; then - echo "Private IP still not available status: $ip_status" > $tmp_msg_file + if [ $ips -eq 1 ]; then + echo "Private IP still not available status: $ips" > $tmp_msg_file return 1 else return 0 @@ -140,12 +140,12 @@ mount_volume() { fi } function get_volumes() { - DETAILS="$1" - COMPARTMENT_ID="$(echo $DETAILS | jq -r .compartmentId)" - AD="$(echo $DETAILS | jq -r .availabilityDomain)" - REGION="$(echo $DETAILS | jq -r .regionInfo.regionIdentifier)" - ALL_VOLUMES=$($OCI_BIN bv volume list --compartment-id $COMPARTMENT_ID --lifecycle-state AVAILABLE --region $REGION --availability-domain $AD --auth instance_principal) - echo $ALL_VOLUMES + DTS="$1" + CID="$(echo $DTS | jq -r .compartmentId)" + AD="$(echo $DTS | jq -r .availabilityDomain)" + REGION="$(echo $DTS | jq -r .regionInfo.regionIdentifier)" + AVS=$($OCI_BIN bv volume list --compartment-id $CID --lifecycle-state AVAILABLE --region $REGION --availability-domain $AD --auth instance_principal) + echo $AVS if [[ $? -ne 0 ]]; then echo "Failed to get list of volumes" return 4 @@ -154,33 +154,33 @@ function get_volumes() { function mount_volumes() { if [[ "$VOLUMES_ENABLED" == "true" ]]; then [ -z "$TAG_NAMESPACE" ] && TAG_NAMESPACE="jitsi" - INSTANCE_DATA="$(curl --connect-timeout 10 -s curl http://169.254.169.254/opc/v1/instance/)" - INSTANCE_ID="$(echo $INSTANCE_DATA | jq -r .id)" - GROUP_INDEX="$(echo $INSTANCE_DATA | jq -r '.freeformTags."group-index"')" - ROLE="$(echo $INSTANCE_DATA | jq -r .definedTags.$TAG_NAMESPACE."role")" - ALL_VOLUMES="$(get_volumes "$INSTANCE_DATA")" + IDATA="$(curl -m 10 -s curl http://169.254.169.254/opc/v1/instance/)" + IID="$(echo $IDATA | jq -r .id)" + GI="$(echo $IDATA | jq -r '.freeformTags."group-index"')" + ROLE="$(echo $IDATA | jq -r .definedTags.$TAG_NAMESPACE."role")" + AVS="$(get_volumes "$IDATA")" if [[ $? -eq 0 ]]; then - ROLE_VOLUMES="$(echo $ALL_VOLUMES | jq ".data | map(select(.\"freeform-tags\".\"volume-role\" == \"$ROLE\"))")" - GROUP_VOLUMES="$(echo $ROLE_VOLUMES | jq "map(select(.\"freeform-tags\".\"volume-index\" == \"$GROUP_INDEX\"))")" - GROUP_VOLUMES_COUNT="$(echo $GROUP_VOLUMES | jq length)" - if [[ "$GROUP_VOLUMES_COUNT" -gt 0 ]]; then - for i in `seq 0 $((GROUP_VOLUMES_COUNT-1))`; do - VOLUME_DETAIL="$(echo $GROUP_VOLUMES | jq -r ".[$i]")" - VOLUME_TYPE="$(echo $VOLUME_DETAIL | jq -r .\"freeform-tags\".\"volume-type\")" - VOLUME_LABEL="$VOLUME_TYPE-$GROUP_INDEX" - mount_volume "$VOLUME_DETAIL" $VOLUME_LABEL $INSTANCE_ID + RVS="$(echo $AVS | jq ".data | map(select(.\"freeform-tags\".\"volume-role\" == \"$ROLE\"))")" + GVS="$(echo $RVS | jq "map(select(.\"freeform-tags\".\"volume-index\" == \"$GI\"))")" + GVC="$(echo $GVS | jq length)" + if [[ "$GVC" -gt 0 ]]; then + for i in `seq 0 $((GVC-1))`; do + VD="$(echo $GVS | jq -r ".[$i]")" + VT="$(echo $VD | jq -r .\"freeform-tags\".\"volume-type\")" + VL="$VT-$GROUP_INDEX" + mount_volume "$VD" $VL $IID done else - echo "No volumes found matching role $ROLE and group index $GROUP_INDEX" + echo "No volumes found matching role $ROLE and group index $GI" fi - NON_GROUP_VOLUMES="$(echo $ROLE_VOLUMES | jq "map(select(.\"freeform-tags\".\"volume-index\" == null))")" - NON_GROUP_VOLUMES_COUNT="$(echo $NON_GROUP_VOLUMES | jq length)" - if [[ "$NON_GROUP_VOLUMES_COUNT" -gt 0 ]]; then - for i in `seq 0 $((NON_GROUP_VOLUMES_COUNT-1))`; do - VOLUME_DETAIL="$(echo $NON_GROUP_VOLUMES | jq -r ".[$i]")" - VOLUME_TYPE="$(echo $VOLUME_DETAIL | jq -r .\"freeform-tags\".\"volume-type\")" - VOLUME_LABEL="$VOLUME_TYPE" - mount_volume "$VOLUME_DETAIL" $VOLUME_LABEL $INSTANCE_ID + NGVS="$(echo $RVS | jq "map(select(.\"freeform-tags\".\"volume-index\" == null))")" + NGVSC="$(echo $NGVS | jq length)" + if [[ "$NGVSC" -gt 0 ]]; then + for i in `seq 0 $((NGVSC-1))`; do + VD="$(echo $NGVS | jq -r ".[$i]")" + VT="$(echo $VD | jq -r .\"freeform-tags\".\"volume-type\")" + VL="$VOLUME_TYPE" + mount_volume "$VD" $VL $IID done else echo "No volumes found matching role $ROLE with no group index" @@ -206,62 +206,63 @@ function set_hostname() { #clear domain if null [ "$DOMAIN" == "null" ] && DOMAIN= [ -z "$DOMAIN" ] && DOMAIN="oracle.jitsi.net" - MY_COMPONENT_NUMBER="$(echo $MY_IP | awk -F. '{print $2"-"$3"-"$4}')" - MY_HOSTNAME="$CLOUD_NAME-$TYPE-$MY_COMPONENT_NUMBER.$DOMAIN" + mcn="$(echo $MY_IP | awk -F. '{print $2"-"$3"-"$4}')" + MY_HOSTNAME="$CLOUD_NAME-$TYPE-$mcn.$DOMAIN" fi hostname $MY_HOSTNAME grep $MY_HOSTNAME /etc/hosts || echo "$MY_IP $MY_HOSTNAME" >> /etc/hosts echo "$MY_HOSTNAME" > /etc/hostname } function checkout_repos() { - [ -d $BOOTSTRAP_DIRECTORY/infra-configuration ] && rm -rf $BOOTSTRAP_DIRECTORY/infra-configuration - [ -d $BOOTSTRAP_DIRECTORY/infra-customizations ] && rm -rf $BOOTSTRAP_DIRECTORY/infra-customizations + [ -d $BSD/infra-configuration ] && rm -rf $BSD/infra-configuration + [ -d $BSD/infra-customizations ] && rm -rf $BSD/infra-customizations if [ ! -n "$(grep "^github.com " ~/.ssh/known_hosts)" ]; then ssh-keyscan github.com >> ~/.ssh/known_hosts 2>/dev/null; fi - mkdir -p "$BOOTSTRAP_DIRECTORY" - if [ -d "$LOCAL_REPO_DIRECTORY" ]; then - echo "Found local repo copies in $LOCAL_REPO_DIRECTORY, using instead of clone" - cp -a $LOCAL_REPO_DIRECTORY/infra-configuration $BOOTSTRAP_DIRECTORY - cp -a $LOCAL_REPO_DIRECTORY/infra-customizations $BOOTSTRAP_DIRECTORY - cd $BOOTSTRAP_DIRECTORY/infra-configuration + mkdir -p "$BSD" + if [ -d "$LRD" ]; then + echo "Found local repo copies in $LRD, using instead of clone" + cp -a $LRD/infra-configuration $BSD + cp -a $LRD/infra-customizations $BSD + cd $BSD/infra-configuration git pull cd - - cd $BOOTSTRAP_DIRECTORY/infra-customizations + cd $BSD/infra-customizations git pull cd - else echo "No local repos found, cloning directly from github" - git clone $INFRA_CONFIGURATION_REPO $BOOTSTRAP_DIRECTORY/infra-configuration - git clone $INFRA_CUSTOMIZATIONS_REPO $BOOTSTRAP_DIRECTORY/infra-customizations + git clone $INFRA_CONFIGURATION_REPO $BSD/infra-configuration + git clone $INFRA_CUSTOMIZATIONS_REPO $BSD/infra-customizations fi - cd $BOOTSTRAP_DIRECTORY/infra-configuration + cd $BSD/infra-configuration git checkout $GIT_BRANCH git submodule update --init --recursive git show-ref heads/$GIT_BRANCH || git show-ref tags/$GIT_BRANCH cd - - cd $BOOTSTRAP_DIRECTORY/infra-customizations + cd $BSD/infra-customizations git checkout $GIT_BRANCH git submodule update --init --recursive git show-ref heads/$GIT_BRANCH || git show-ref tags/$GIT_BRANCH - cp -a $BOOTSTRAP_DIRECTORY/infra-customizations/* $BOOTSTRAP_DIRECTORY/infra-configuration + cp -a $BSD/infra-customizations/* $BSD/infra-configuration cd - } function run_ansible_playbook() { - cd $BOOTSTRAP_DIRECTORY/infra-configuration + cd $BSD/infra-configuration PLAYBOOK=$1 VARS=$2 DEPLOY_TAGS=${ANSIBLE_TAGS-"all"} + sc=0 ansible-playbook -v \ -i "127.0.0.1," \ -c local \ --tags "$DEPLOY_TAGS" \ --extra-vars "$VARS" \ --vault-password-file=/root/.vault-password \ - ansible/$PLAYBOOK || status_code=1 - if [ $status_code -eq 1 ]; then + ansible/$PLAYBOOK || sc=1 + if [ $sc -eq 1 ]; then echo 'Provisioning stage failed' > $tmp_msg_file; fi cd - - return $status_code + return $sc } function default_dump() { sudo /usr/local/bin/dump-boot.sh @@ -277,7 +278,7 @@ function default_main() { return $EXIT_CODE } function default_provision() { - local status_code=0 + local sc=0 . /usr/local/bin/oracle_cache.sh fetch_credentials $ENVIRONMENT [ -z "$HOST_ROLE" ] && HOST_ROLE="$SHARD_ROLE" @@ -298,19 +299,19 @@ function default_provision() { export INFRA_CONFIGURATION_REPO="https://github.com/jitsi/infra-configuration.git" fi checkout_repos - run_ansible_playbook "$ANSIBLE_PLAYBOOK" "$ANSIBLE_VARS" || status_code=1 - return $status_code; + run_ansible_playbook "$ANSIBLE_PLAYBOOK" "$ANSIBLE_VARS" || sc=1 + return $sc; } function default_terminate() { - echo "Terminating the instance; we enable debug to have more details in case of oci cli failures" + echo "Terminating" INSTANCE_ID=`curl --connect-timeout 10 -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id` sudo /usr/local/bin/oci compute instance terminate --debug --instance-id "$INSTANCE_ID" --preserve-boot-volume false --auth instance_principal --force RET=$? # infinite loop on failure if [ $RET -gt 0 ]; then - echo "Failed to terminate instance, exit code: $RET, sleeping 10 then retrying" + echo "Failed to terminate, exit code: $RET, sleep 10 retry" sleep 10 default_terminate fi } -# end of postinstall-lib, this space intentionally left blank +# end of postinstall-lib, next line blank From 69c3dbb95bd8a7b5761a1ee7d93c47317e1a016d Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:12:38 -0400 Subject: [PATCH 5/9] missing trailing slash --- .../create-jvb-instance-configuration.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index d06f68ba1..f61d37480 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -201,7 +201,7 @@ export INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo} export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) -echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/${var.tag_namespace}.//g' > /tmp/oracle_cache-$INSTANCE_ID +echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/${var.tag_namespace}\.//g' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations From 08457cdbf33e4b99870f0ffec0cf4411edc96cff Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:18:59 -0400 Subject: [PATCH 6/9] only replace tag namespace --- .../create-jvb-instance-configuration.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index f61d37480..446f5f8e6 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -201,7 +201,7 @@ export INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo} export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) -echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/${var.tag_namespace}\.//g' > /tmp/oracle_cache-$INSTANCE_ID +echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/"${var.tag_namespace}\./"/g' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations From a8db4793b6d11363021b2b4fa6a59e2ad1f0d2eb Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:22:23 -0400 Subject: [PATCH 7/9] fix bootstrap directory reference --- terraform/lib/postinstall-lib.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/lib/postinstall-lib.sh b/terraform/lib/postinstall-lib.sh index d3403fab5..75345b803 100644 --- a/terraform/lib/postinstall-lib.sh +++ b/terraform/lib/postinstall-lib.sh @@ -1,5 +1,6 @@ -BSD="/tmp/bootstrap" +BOOTSTRAP_DIRECTORY="/tmp/bootstrap" +BSD="$BOOTSTRAP_DIRECTORY" LRD="/opt/jitsi/bootstrap" function check_private_ip() { local counter=1 From 8e5e64b379c860a3908086a169de3d790a3b2a41 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:38:49 -0400 Subject: [PATCH 8/9] another try --- .../create-jvb-instance-configuration.tf | 14 ++++++++------ terraform/lib/postinstall-lib.sh | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index 446f5f8e6..54d2b40c9 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -83,6 +83,11 @@ locals { "${var.tag_namespace}.use_eip" = var.use_eip "${var.tag_namespace}.autoscaler_sidecar_jvb_flag" = var.autoscaler_sidecar_jvb_flag } + freeform_tags = { + configuration_repo = var.infra_configuration_repo + customizations_repo = var.infra_customizations_repo + shape = var.shape + } } data "oci_core_vcns" "vcns" { @@ -201,7 +206,8 @@ export INFRA_CONFIGURATION_REPO=${var.infra_configuration_repo} export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) -echo ${jsonencode(jsonencode(local.common_tags))} | sed -e 's/"${var.tag_namespace}\./"/g' > /tmp/oracle_cache-$INSTANCE_ID +echo ${jsonencode(jsonencode(merge(local.common_tags, local.freeform_tags)))} | sed -e 's/"${var.tag_namespace}\./"/g' > /tmp/oracle_cache-$INSTANCE_ID +(echo (cat /tmp/oracle_cache-$INSTANCE_ID) | jq -s 'add' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations @@ -211,11 +217,7 @@ EOT } defined_tags = local.common_tags - freeform_tags = { - configuration_repo = var.infra_configuration_repo - customizations_repo = var.infra_customizations_repo - shape = var.shape - } + freeform_tags = local.freeform_tags } } } diff --git a/terraform/lib/postinstall-lib.sh b/terraform/lib/postinstall-lib.sh index 75345b803..d3403fab5 100644 --- a/terraform/lib/postinstall-lib.sh +++ b/terraform/lib/postinstall-lib.sh @@ -1,6 +1,5 @@ -BOOTSTRAP_DIRECTORY="/tmp/bootstrap" -BSD="$BOOTSTRAP_DIRECTORY" +BSD="/tmp/bootstrap" LRD="/opt/jitsi/bootstrap" function check_private_ip() { local counter=1 From 2482867c4b0ad210fb36333045585be670f8dea1 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Thu, 25 Jul 2024 11:44:32 -0400 Subject: [PATCH 9/9] fix --- .../create-jvb-instance-configuration.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf index 54d2b40c9..0816b8958 100644 --- a/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf +++ b/terraform/create-jvb-instance-configuration/create-jvb-instance-configuration.tf @@ -207,7 +207,6 @@ export INFRA_CUSTOMIZATIONS_REPO=${var.infra_customizations_repo} export NOMAD_FLAG=${var.nomad_flag} INSTANCE_ID=$(curl -s curl http://169.254.169.254/opc/v1/instance/ | jq -r .id) echo ${jsonencode(jsonencode(merge(local.common_tags, local.freeform_tags)))} | sed -e 's/"${var.tag_namespace}\./"/g' > /tmp/oracle_cache-$INSTANCE_ID -(echo (cat /tmp/oracle_cache-$INSTANCE_ID) | jq -s 'add' > /tmp/oracle_cache-$INSTANCE_ID EOT , # write the common tags to a file file("${path.cwd}/${var.user_data_file}"), # load our customizations