This document describes steps required to host the Silent Network node on Google Cloud. Audience of this documents are DevOps, or software engineers, preferably with basic knowledge of Google Cloud and the Shell.
Install gcloud
We will use official Google Cloud CLI for most of the time. Install it from
Create Project on Google Cloud
Follow official instructions . You also need to connect .
Enable Compute Engine API to allow start up the VM instances
Go to
Then click "Enable"
Enable secret manager api
Setup gcloud
Set the env variables that we will use over the course of this tutorial. The easiest way to do so, is to create a file with following content.
# Your project ID (not project number!)
export WORKLOAD_OPERATOR_PROJECT_ID=
# VM related parameters
export VM_ZONE=
export VM_NAME=operator
export VM_ADDRESS=
# Bucket where user's data shall be stored
export WORKLOAD_OPERATOR_OUTPUT_BUCKET_NAME=
export BUCKET_LOCATION=
# Do not change. Parameters for operator's container registry
export WORKLOAD_AUTHOR_PROJECT_ID=silent-network-426409
export REGISTRY_NAME=silent-network-registry
export CONTAINER_IMAGE=operator-container-image
export WORKLOAD_VERSION=v0.1.5
# Service account attached to the VM
export WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME=operator-service-account
The empty variables are going to be set in following sections:
Project
Please fill up WORKLOAD_OPERATOR_PROJECT_ID with the ID of the project you've created. Immediately after set valid project for gloud CLI, so subsequent commands will operate on valid project.
Make sure gcloud is pointing to valid project by calling
gcloud config set project $WORKLOAD_OPERATOR_PROJECT_ID
VM Zone
VM IP address
Set the static IP for the VM instance.
Pick region for the IP address. Needs to be the same as the one selected for the VM. The VM_ZONE variable contains zone, whereas for IP the region is needed. To get region from a zone, simply discard last two characters.
The read, write permissions to it are going to be set next.
Create Service Account
The Service Account will be attached to the VM, and used to access cloud resources. Create a service account by executing:
gcloud iam service-accounts create $WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME
Next, set valid permissions for the account
# grant workload SA serviceAccountUser, so can create VM workload
gcloud iam service-accounts add-iam-policy-binding \
$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--member=user:$(gcloud config get-value account) \
--role=roles/iam.serviceAccountUser
# grant workload SA the confidentialcomputing.workloadUser role, so it can generate an attestation token
gcloud projects add-iam-policy-binding $WORKLOAD_OPERATOR_PROJECT_ID \
--member=serviceAccount:$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--role=roles/confidentialcomputing.workloadUser
# grant workload SA the logging.logWriter role, so we can check progress of the workload
gcloud projects add-iam-policy-binding $WORKLOAD_OPERATOR_PROJECT_ID \
--member=serviceAccount:$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--role=roles/logging.logWriter
# grant workload SA storage.objectUser role, so can read delete and update from the bucket
gcloud storage buckets add-iam-policy-binding gs://${WORKLOAD_OPERATOR_OUTPUT_BUCKET_NAME} \
--member=serviceAccount:$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--role=roles/storage.objectUser
# grant the secretmanager.secretAccessor and viewer role, so can read secrets from secret manager
gcloud projects add-iam-policy-binding $WORKLOAD_OPERATOR_PROJECT_ID \
--member=serviceAccount:$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--role=roles/secretmanager.secretAccessor
gcloud projects add-iam-policy-binding $WORKLOAD_OPERATOR_PROJECT_ID \
--member=serviceAccount:$WORKLOAD_OPERATOR_SERVICE_ACCOUNT_NAME@$WORKLOAD_OPERATOR_PROJECT_ID.iam.gserviceaccount.com \
--role=roles/secretmanager.viewer
Remember to set valid path to thecontainer-env-file option (last line)
Troubleshooting
Check if the VM and the container started up without any problems:
curl ${VM_ADDRESS}
The command should return text response:ok
Error: The zone 'XXX' does not have enough resources available to fulfill the request.
There might be unlikely event upon VM start to face the error ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS. It means there are insufficient HW resources in the selected VM_ZONE Please choose different zone as described in VM Zone chapter.
There is no way to move the IP, across regions, so if new VM_ZONE is in different region, release old IP by calling:
And then create VM IP address in new region and try again.
Serial console
You can connect to serial port of the VM to read the logs of the Host OS before the container launches. It's helpful in case if container does not starts up.
# Enable serial port
gcloud compute instances add-metadata ${VM_NAME} \
--zone=${VM_ZONE} \
--metadata serial-port-enable=TRUE
# Connect to serial port to see the logging of the Host OS
gcloud compute connect-to-serial-port --zone=${VM_ZONE} ${VM_NAME}
If everything went well and the container started up, you should be able to see following logs:
[ 31.297213] konlet-startup[1705]: 2024/06/17 12:07:21 Starting a container with ID: 6c9f3fd7c8f89328d736ee7526d3f15648b94e5f6b897bc7de69bcbe693125ab
[ 31.395243] konlet-startup[1705]: 2024/06/17 12:07:21 Saving welcome script to profile.d
To exit the console, hit Enter, and then type: ~.
Logs from the container
If the VM is running, the output from serial console suggests container started up correctly, but there is no response from curl, SSH to the VM:
"message": "2024-07-09T15:30:03.686380Z INFO el_party_svc::signer: Master VK from GC Secret Manager: \"21dba548b92ad65bfdc6328e98f5099c17702f75d1fd82c98cff81e5abc26e29\"\n",
Please select a VM_ZONE for the hosted VM in Europe. Go to , filter location by Europe and machine series by N2D. Select one of available zones and set the VM_ZONE variable.
Select a location of a bucket from . Choose one from Europe. Set the BUCKET_LOCATION.
OPERATOR_ETH_ADDRESS the ETH address derived from public