This document outlines the steps necessary to get an instance of Trillian up and running on Google Cloud.
-
Create a Google Cloud project (we'll call it's project ID
${PROJECT_ID}
below) -
Enable APIs
- Kubernetes
- Cloud Spanner
- ...
-
Create the public API key (see https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform)
-
From the APIs & Services > Credentials page, click Create credentials > API key. A key will automatically be created.
-
Restrict API key to only have access to:
- Google Cloud APIs
- Cloud Spanner API
-
Download service account key (we'll call that file
service-key.json
) -
run:
kubectl create secret generic spanner-key --from-file=key.json=service-key.json
-
Create Spanner instance & database
-
Click on menu > Cloud Spanner
-
Click on "Create Instance" (we'll call its instance ID
${SPANNER_INSTANCE}
) -
Choose region (we'll call that ${REGION})
-
Choose number of nodes
-
Click create Database 1. Fill in a name (we'll call the DB instance
${DATABASE_INSTANCE}
) 2. Click continue 4. InDefine your database schema
, click theEdit as text
slider 3. paste contents of spanner.sd into the text box (you may need to remove the SQL comments prefixed with--
at the top) 4. Click on create -
Create kubernetes cluster
-
menu > Kubernetes
-
click on Create Cluster
-
Set cluster name to something (we'll call this
${CLUSTER_NAME}
) -
Set zone to something inside ${REGION}
-
Click create
-
Start initial jobs
-
Edit scripts/deploy_gce.sh and configure the environment variables for your deployment.
-
run:
./scripts/deploy_gce.sh
Now that you have a working Trillian-on-cloud instance, you can integrate it with CI/CD so that pushes to master update your Trillian instance.
- Create service account credentials
- In your Cloud Platform Console project, open the Credentials page.
- Click Create credentials > Service account key.
- Under Service account select New service account.
- Enter a Service account name, e.g. trillian-pusher-ci
- Under Role, select Project > Editor.
- Under Key type, select JSON.
- Click Create. The Cloud Platform Console downloads a new JSON file to your computer. The name of this file starts with your project ID.
- Provide the service key to the deploy script that CI runs. You might need
the output of the following command:
base64 service-key.json | tr -d '\040\011\012\015'
- Ensure that the key is hidden from build logs (example: Cloud Build).