GCP
Set up and deploy a Granica Admin Server on Google Cloud Platform using Terraform.
Prerequisites
If you are working in Cloud Shell you must be logged in as Admin. If you are running from your laptop you will need GCloud command line credentials that give administrator access.
- Create your own GCP Project (by default you will have admin access for this project).
Instructions
1. Enable GCP APIs
gcloud services enable storage.googleapis.com
gcloud services enable iam.googleapis.com
gcloud services enable cloudresourcemanager.googleapis.com
gcloud services enable networkmanagement.googleapis.com
gcloud services enable container.googleapis.com
gcloud services enable logging.googleapis.com
gcloud services enable pubsub.googleapis.com
gcloud services enable compute.googleapis.com
gcloud services enable sqladmin.googleapis.com
gcloud services enable servicenetworking.googleapis.com2. Install Terraform
git clone https://github.com/tfutils/tfenv.git ~/.tfenv
mkdir ~/bin
ln -s ~/.tfenv/bin/* ~/bin/
export PATH="$HOME/.tfenv/bin:$PATH"
tfenv install 1.13.4
tfenv use 1.13.4
terraform --version
git clone https://github.com/granica-ai/granica-setup.git
cd granica-setup/gcp3. Create a GCS bucket for Terraform state
gcloud storage buckets create gs://<bucket-name> --location <region>4. Configure backend.conf
bucket = "<name of bucket that will host admin server tf state>"
prefix = "<prefix to store state>"5. Configure terraform.tfvars
project_id = "your-gcp-project-id"
region = "us-central1"
zone = "us-central1-a"
package_url = "https://granica.ai/granica.rpm"
server_name = "CHANGE_ME"6. Deploy the admin server
terraform init -backend-config=backend.conf
terraform apply7. Log in to the admin server
gcloud compute ssh granica-admin-server-{server_name} --project=<project-id> --zone=<zone> --tunnel-through-iapUse the
gcloudcommand printed at the end ofterraform applyto SSH into the admin server.
Once connected:
sudo su - granica # Use the granica user to run granica commands
# The Granica RPM takes around 10-15 minutes to install.
# Monitor progress:
tail -f /var/log/dnf.rpm.log
# For more debug output:
tail -f /var/log/startup-script.log
granica --help
granica deploy --var-file config.tfvars
# Cluster deployment takes around 10-15 minutes.Was this page helpful?