github.com/mre-fog/trillianxx@v1.1.2-0.20180615153820-ae375a99d36a/docs/CloudSpanner.md (about)

     1  Trillian on Cloud Kubernetes with Cloud Spanner
     2  ====================================================
     3  
     4  This document outlines the steps necessary to get an instance of Trillian up
     5  and running on Google Cloud.
     6  
     7   1. Create a Google Cloud project (we'll call it's project ID `${PROJECT_ID}` below)
     8   2. Enable APIs
     9      1. Kubernetes
    10      2. Cloud Spanner
    11      3. ...
    12  
    13   3. Create the public API key (see https://cloud.google.com/kubernetes-engine/docs/tutorials/authenticating-to-cloud-platform)
    14     1. From the APIs & Services > Credentials page, click Create credentials > API key.
    15        A key will automatically be created.
    16     2. Restrict API key to only have access to:
    17        * Google Cloud APIs
    18        * Cloud Spanner API
    19     3. Download service account key (we'll call that file `service-key.json`)
    20     4. run: `kubectl create secret generic spanner-key --from-file=key.json=service-key.json`
    21  
    22   4. Create Spanner instance & database
    23     1. Click on menu > Cloud Spanner
    24     2. Click on "Create Instance" (we'll call its instance ID `${SPANNER_INSTANCE}`)
    25     4. Choose region (we'll call that ${REGION})
    26     5. Choose number of nodes
    27     6. Click create Database
    28       1. Fill in a name (we'll call the DB instance `${DATABASE_INSTANCE}`)
    29       2. Click continue
    30       4. In `Define your database schema`, click the `Edit as text` slider
    31       3. paste contents of [spanner.sd](storage/cloudspanner/spanner.sdl) into the text box (you may need to remove the SQL comments prefixed with `--` at the top)
    32       4. Click on create
    33  
    34   5. Create kubernetes cluster
    35     1. menu > Kubernetes
    36     2. click on Create Cluster
    37     3. Set cluster name to something (we'll call this `${CLUSTER_NAME}`)
    38     4. Set zone to something inside ${REGION}
    39     5. Click create
    40  
    41   6. Start initial jobs
    42     1. Edit [scripts/deploy_gce.sh](scripts/deploy.sh) and configure the environment variables for your deployment.
    43     1. run: `./scripts/deploy_gce.sh`
    44  
    45  
    46  Setting up continuous integration with Travis
    47  =============================================
    48  
    49  Now that you have a working Trillian-on-cloud instance, you can integrate it with Travis
    50  so that pushes to master update your Trillian instance.
    51  
    52   1. Create service account credentials
    53     1. In your Cloud Platform Console project, open the Credentials page.
    54     2. Click Create credentials > Service account key.
    55     3. Under Service account select New service account.
    56     4. Enter a Service account name, e.g. trillian-pusher-ci
    57     5. Under Role, select Project > Editor.
    58     6. Under Key type, select JSON.
    59     7. Click Create. The Cloud Platform Console downloads a new JSON file to your computer. The name of this file starts with your project ID.
    60     8. In your project's Travis settings page, add a new Environment Variable called `GCLOUD_SERVICE_KEY_CI`, and set it to the output from the following command:
    61           `base64 service-key.json | tr -d '\040\011\012\015'`
    62        *Ensure that _Display value in build log_ switch is set to OFF!*
    63