diff --git a/openvidu-deployment/community/singlenode/gcp/tf-gpc-openvidu-singlenode.tf b/openvidu-deployment/community/singlenode/gcp/tf-gpc-openvidu-singlenode.tf index 59dde71ff..ebedbcb50 100644 --- a/openvidu-deployment/community/singlenode/gcp/tf-gpc-openvidu-singlenode.tf +++ b/openvidu-deployment/community/singlenode/gcp/tf-gpc-openvidu-singlenode.tf @@ -84,16 +84,25 @@ resource "google_compute_address" "public_ip_address" { region = var.region } +#Check if ARM +locals { + is_arm_instance = startswith(var.instanceType, "c4a-") || startswith(var.instanceType, "t2a-") || startswith(var.instanceType, "n4a-") || startswith(var.instanceType, "a4x-") + yq_arch = local.is_arm_instance ? "arm64" : "amd64" + + ubuntu_image = local.is_arm_instance ? "ubuntu-os-cloud/ubuntu-2404-noble-arm64-v20241219" : "ubuntu-os-cloud/ubuntu-2404-noble-amd64-v20241219" +} + # Compute instance for OpenVidu resource "google_compute_instance" "openvidu_server" { name = lower("${var.stackName}-vm-ce") machine_type = var.instanceType + zone = var.zone tags = [lower("${var.stackName}-vm-ce")] boot_disk { initialize_params { - image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts" + image = local.ubuntu_image size = 100 type = "pd-standard" } @@ -155,8 +164,8 @@ apt-get update && apt-get install -y \ lsb-release \ openssl -wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\ -tar xz && mv yq_linux_amd64 /usr/bin/yq +wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\ +tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq # Configure gcloud with instance service account gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true diff --git a/openvidu-deployment/pro/elastic/gcp/tf-gpc-openvidu-elastic.tf b/openvidu-deployment/pro/elastic/gcp/tf-gpc-openvidu-elastic.tf index 76aa8faf6..72c4657b1 100644 --- a/openvidu-deployment/pro/elastic/gcp/tf-gpc-openvidu-elastic.tf +++ b/openvidu-deployment/pro/elastic/gcp/tf-gpc-openvidu-elastic.tf @@ -126,6 +126,7 @@ resource "google_compute_address" "public_ip_address" { resource "google_compute_instance" "openvidu_master_node" { name = lower("${var.stackName}-master-node") machine_type = var.masterNodeInstanceType + zone = var.zone tags = [lower("${var.stackName}-master-node")] @@ -598,7 +599,10 @@ resource "google_cloud_scheduler_job" "scale_scheduler" { # ------------------------- local values ------------------------- locals { - isEmpty = var.bucketName == "" + isEmpty = var.bucketName == "" + is_arm_instance = startswith(var.masterNodeInstanceType, "c4a-") || startswith(var.masterNodeInstanceType, "t2a-") || startswith(var.masterNodeInstanceType, "n4a-") || startswith(var.masterNodeInstanceType, "a4x-") + yq_arch = local.is_arm_instance ? "arm64" : "amd64" + install_script_master = <<-EOF #!/bin/bash -x set -e @@ -616,8 +620,8 @@ apt-get update && apt-get install -y \ lsb-release \ openssl -wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\ -tar xz && mv yq_linux_amd64 /usr/bin/yq +wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\ +tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq # Configure gcloud with instance service account gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true diff --git a/openvidu-deployment/pro/ha/gcp/tf-gpc-openvidu-ha.tf b/openvidu-deployment/pro/ha/gcp/tf-gpc-openvidu-ha.tf index e223a91c8..f0422bd68 100644 --- a/openvidu-deployment/pro/ha/gcp/tf-gpc-openvidu-ha.tf +++ b/openvidu-deployment/pro/ha/gcp/tf-gpc-openvidu-ha.tf @@ -933,6 +933,8 @@ resource "google_compute_region_autoscaler" "media_node_autoscaler" { locals { isEmptyAppData = var.GCSAppDataBucketName == "" isEmptyClusterData = var.GCSClusterDataBucketName == "" + is_arm_instance = startswith(var.masterNodesInstanceType, "c4a-") || startswith(var.masterNodesInstanceType, "t2a-") || startswith(var.masterNodesInstanceType, "n4a-") || startswith(var.masterNodesInstanceType, "a4x-") + yq_arch = local.is_arm_instance ? "arm64" : "amd64" install_script_master = <<-EOF #!/bin/bash -x @@ -952,8 +954,8 @@ apt-get update && apt-get install -y \ lsb-release \ openssl -wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\ -tar xz && mv yq_linux_amd64 /usr/bin/yq +wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\ +tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq # Configure gcloud with instance service account gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true diff --git a/openvidu-deployment/pro/singlenode/gcp/tf-gpc-openvidu-singlenode.tf b/openvidu-deployment/pro/singlenode/gcp/tf-gpc-openvidu-singlenode.tf index 668129046..5be2b6d2b 100644 --- a/openvidu-deployment/pro/singlenode/gcp/tf-gpc-openvidu-singlenode.tf +++ b/openvidu-deployment/pro/singlenode/gcp/tf-gpc-openvidu-singlenode.tf @@ -88,6 +88,7 @@ resource "google_compute_address" "public_ip_address" { resource "google_compute_instance" "openvidu_server" { name = lower("${var.stackName}-vm-pro") machine_type = var.instanceType + zone = var.zone tags = [lower("${var.stackName}-vm-pro")] @@ -137,7 +138,10 @@ resource "google_compute_instance" "openvidu_server" { # ------------------------- local values ------------------------- locals { - isEmpty = var.bucketName == "" + isEmpty = var.bucketName == "" + is_arm_instance = startswith(var.instanceType, "c4a-") || startswith(var.instanceType, "t2a-") || startswith(var.instanceType, "n4a-") || startswith(var.instanceType, "a4x-") + yq_arch = local.is_arm_instance ? "arm64" : "amd64" + install_script = <<-EOF #!/bin/bash -x set -e @@ -155,8 +159,8 @@ apt-get update && apt-get install -y \ lsb-release \ openssl -wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\ -tar xz && mv yq_linux_amd64 /usr/bin/yq +wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\ +tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq # Configure gcloud with instance service account gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true