mirror of https://github.com/OpenVidu/openvidu.git
openvidu-deployment: GCP - Added ARM64 support
parent
41dc440ef8
commit
05697f7ab3
|
|
@ -84,16 +84,25 @@ resource "google_compute_address" "public_ip_address" {
|
||||||
region = var.region
|
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
|
# Compute instance for OpenVidu
|
||||||
resource "google_compute_instance" "openvidu_server" {
|
resource "google_compute_instance" "openvidu_server" {
|
||||||
name = lower("${var.stackName}-vm-ce")
|
name = lower("${var.stackName}-vm-ce")
|
||||||
machine_type = var.instanceType
|
machine_type = var.instanceType
|
||||||
|
zone = var.zone
|
||||||
|
|
||||||
tags = [lower("${var.stackName}-vm-ce")]
|
tags = [lower("${var.stackName}-vm-ce")]
|
||||||
|
|
||||||
boot_disk {
|
boot_disk {
|
||||||
initialize_params {
|
initialize_params {
|
||||||
image = "projects/ubuntu-os-cloud/global/images/family/ubuntu-2204-lts"
|
image = local.ubuntu_image
|
||||||
size = 100
|
size = 100
|
||||||
type = "pd-standard"
|
type = "pd-standard"
|
||||||
}
|
}
|
||||||
|
|
@ -155,8 +164,8 @@ apt-get update && apt-get install -y \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
openssl
|
openssl
|
||||||
|
|
||||||
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\
|
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\
|
||||||
tar xz && mv yq_linux_amd64 /usr/bin/yq
|
tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq
|
||||||
|
|
||||||
# Configure gcloud with instance service account
|
# Configure gcloud with instance service account
|
||||||
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ resource "google_compute_address" "public_ip_address" {
|
||||||
resource "google_compute_instance" "openvidu_master_node" {
|
resource "google_compute_instance" "openvidu_master_node" {
|
||||||
name = lower("${var.stackName}-master-node")
|
name = lower("${var.stackName}-master-node")
|
||||||
machine_type = var.masterNodeInstanceType
|
machine_type = var.masterNodeInstanceType
|
||||||
|
zone = var.zone
|
||||||
|
|
||||||
tags = [lower("${var.stackName}-master-node")]
|
tags = [lower("${var.stackName}-master-node")]
|
||||||
|
|
||||||
|
|
@ -599,6 +600,9 @@ resource "google_cloud_scheduler_job" "scale_scheduler" {
|
||||||
|
|
||||||
locals {
|
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
|
install_script_master = <<-EOF
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -616,8 +620,8 @@ apt-get update && apt-get install -y \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
openssl
|
openssl
|
||||||
|
|
||||||
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\
|
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\
|
||||||
tar xz && mv yq_linux_amd64 /usr/bin/yq
|
tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq
|
||||||
|
|
||||||
# Configure gcloud with instance service account
|
# Configure gcloud with instance service account
|
||||||
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
||||||
|
|
|
||||||
|
|
@ -933,6 +933,8 @@ resource "google_compute_region_autoscaler" "media_node_autoscaler" {
|
||||||
locals {
|
locals {
|
||||||
isEmptyAppData = var.GCSAppDataBucketName == ""
|
isEmptyAppData = var.GCSAppDataBucketName == ""
|
||||||
isEmptyClusterData = var.GCSClusterDataBucketName == ""
|
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
|
install_script_master = <<-EOF
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
|
|
@ -952,8 +954,8 @@ apt-get update && apt-get install -y \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
openssl
|
openssl
|
||||||
|
|
||||||
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\
|
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\
|
||||||
tar xz && mv yq_linux_amd64 /usr/bin/yq
|
tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq
|
||||||
|
|
||||||
# Configure gcloud with instance service account
|
# Configure gcloud with instance service account
|
||||||
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,7 @@ resource "google_compute_address" "public_ip_address" {
|
||||||
resource "google_compute_instance" "openvidu_server" {
|
resource "google_compute_instance" "openvidu_server" {
|
||||||
name = lower("${var.stackName}-vm-pro")
|
name = lower("${var.stackName}-vm-pro")
|
||||||
machine_type = var.instanceType
|
machine_type = var.instanceType
|
||||||
|
zone = var.zone
|
||||||
|
|
||||||
tags = [lower("${var.stackName}-vm-pro")]
|
tags = [lower("${var.stackName}-vm-pro")]
|
||||||
|
|
||||||
|
|
@ -138,6 +139,9 @@ resource "google_compute_instance" "openvidu_server" {
|
||||||
|
|
||||||
locals {
|
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
|
install_script = <<-EOF
|
||||||
#!/bin/bash -x
|
#!/bin/bash -x
|
||||||
set -e
|
set -e
|
||||||
|
|
@ -155,8 +159,8 @@ apt-get update && apt-get install -y \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
openssl
|
openssl
|
||||||
|
|
||||||
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_amd64.tar.gz -O - |\
|
wget https://github.com/mikefarah/yq/releases/download/$${YQ_VERSION}/yq_linux_${local.yq_arch}.tar.gz -O - |\
|
||||||
tar xz && mv yq_linux_amd64 /usr/bin/yq
|
tar xz && mv yq_linux_${local.yq_arch} /usr/bin/yq
|
||||||
|
|
||||||
# Configure gcloud with instance service account
|
# Configure gcloud with instance service account
|
||||||
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
gcloud auth activate-service-account --key-file=/dev/null 2>/dev/null || true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue