Git Product home page Git Product logo

continuous-deployment-circle's Introduction

Sample of how to deploy from Circle CI and run an end-to-end test

This repo demonstrates how to deploy to Google Cloud from a Circle CI file and run an end to end test (in e2e_test.py) against a staging environment.

See the managed_vms branch for a similar repo and Circle deployment using Managed VMs.

Prerequisites

First, you must create a Cloud project. Two types of credentials are required. The first is a service account to authorize the gcloud command line tool in the Circle CI environment, which is used to deploy the project. The second is an API key used to access the Books API.

  • Create a Cloud project using the Google Cloud Console
  • Under API Manager -> Google APIs, search and enable the Books API and the App Engine Admin APIs
  • Under Api Manager -> Credentials, click New Credentials -> API Key -> Server Key. Copy the key into api_key.py , see api_key.py.sample as a reference. Don't check api_key.py into the repository (it's already in the .gitignore).
  • Under Api Manager -> Credentials -> Service Account key, create a JSON key and download it.

Both of the credentials need to be base64 encoded and added to the Circle CI project as an environment variable.

  • Go to Circle CI. If you haven't already done so, create an account and enable your project.

  • On the top right, click Project Settings, then on the left click Environment Variables.

  • Base64 encode the client secret JSON file

    base64 <your_secret.json>

  • Copy the output of the base64 command into the 'Value' form, with the name CLIENT_SECRET, then click Save Variable.

  • Base64 encdode the api_key.py file

    base64 api_key.py

  • Copy the output of the base64 command into the 'Value' form, with the Name field set to API_KEY. Click Save Variable.

  • In the circle.yaml file, replace the in gcloud config set project with your project id.

  • In e2e_test.py, replace the in the HOST variable with the URL your project will be deployed to https://your-project-id.appspot.com.

  • Commit and push your changes. The circle project should run the local tests, then use the gcloud SDK (authenticated with the client-secret) to deploy to the appspot URL, then run the e2e tests against that URL.

Contributing changes

Licensing

  • See LICENSE

Copyright (C) 2015 Google Inc.

continuous-deployment-circle's People

Contributors

tswast avatar vyper avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.