Skip to content

Terraform scripts for setting up MATLAB Web App Server on Google Cloud Platform.

License

Notifications You must be signed in to change notification settings

mathworks-ref-arch/matlab-web-app-server-on-gcp-using-terraform

Repository files navigation

Setting up MATLAB Web App Server® on Google Cloud Platform™ using Terraform®

The following guide will help you automate the process of running MATLAB Web App Server on the Google Cloud Platform™ (GCP). The automation is accomplished using Terraform™ scripts and is supported for Linux environments only.

Requirements:

Getting Started :

The following steps can help in getting started:

  1. Clone this repository as follows:
>> git clone https://github.com/mathworks-ref-arch/matlab-web-app-server-on-gcp-using-terraform.git
  1. Make sure you have an existing Network License Manager setup on Google Cloud as well. See instructions on setting up a Network License Manager on Google Cloud here.

  2. Install Google Cloud SDK. This step will ensure you are able to run gcloud and gsutil commands from the system provisioning Google Cloud resources. Perform gcloud authentication using command gcloud auth login. This will authorize the gcloud API to access the Cloud Platform with your Google user credentials.

  3. Install Terraform v1.0 on Linux.

  4. Terraform configuration uses some startup scripts for initialization of VMs. To authenticate Terraform requires metadata-based SSH key configurations. Create a set of SSH keys if one does not exist. See this link for steps. Provide the location of this key within variables.tf for both Build and Deploy stage as follows.

# Path to ssh key for gcloud login and authorization
variable "gce_ssh_key_file_path" {
  type = string
  description = "/home/local-gce-user/.ssh/google_compute_engine.pub"
  default = "/home/matlabuser/.ssh/google_compute_engine.pub"
}
  1. Configure the default values for variables within Software/variables.tf . For more details see Software/Readme.md.

  2. Run terraform init and terraform validate to make sure your current configuration based on default values set in variables.tf is intialized and valid.

  3. This repository includes an example script, which can used to standup a sample MATLAB Web App Server cluster on Google Cloud, provided all dependencies have been installed and authentication related steps have been followed. Note: The values used for the subset of variables initialized within the example.sh script will override the values for the variables set within variables.tf.

Authentication:

In order to make requests against any required Google Cloud Platform API, the user needs to authenticate himself/herself. The preferred method of provisioning resources with Terraform is to use a Google Cloud service account, that can be granted a limited set of IAM permissions scoped out by the platform administrator.

In order to access a set of credentials, a user can visit the service account key page in the Cloud Console and choose an accessible Google cloud project to list the existing service accounts. One can either choose an existing service account, or create a new one based on permissions. See steps for creating a service account. Once a service account is ready for use, the user needs to download the JSON key file from the selected service account on the local machine/VM being used for provisioning. The next step is to define an environment variable GOOGLE_APPLICATION_CREDENTIALS to provide application level access to the credentials. See instructions for setting the environment variable.

Also, provide the location of the credentials within variables.tf as shown below.

# Path to service account credentials 
variable "credentials_file_path"{
  type = string
  default = "credentials.json"
  description = "Provide full path to the credentials file for your service account"
}

For more details, see Terraform documentation on support for adding credentials.

Resources created by this Reference Architecture:

  • Google Compute instance to host the web app server.
  • VPC network (Optional):
    • Firewall rules allowing INGRESS for MATLAB Web App Server ports over http,https and ssh.
    • Target tags to apply Firewall rules for the selected Google Compute instance.

Architecture for MATLAB Web App Server setup on Google Cloud using the reference architecture :

Architecture

Quick Links:

License

The license for this reference architecture is available in the LICENSE.MD file in this repository. This package uses certain third-party content which is licensed under separate license agreements.

Enhancement Requests

Provide suggestions for additional features or capabilities using the following link: https://www.mathworks.com/products/reference-architectures/request-new-reference-architectures.html

Support

Email: [email protected]

About

Terraform scripts for setting up MATLAB Web App Server on Google Cloud Platform.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published