Giter Club home page Giter Club logo

cloud-build-cloud-functions-pipeline's Introduction

cloud-build-cloud-functions-pipeline

1. Introduction

This is a simple project developed with the intent to show:

  • how to develop and debug your application locally with functions-framework-python.
  • how to automate the deployment of Cloud Functions with Cloud Build on Google Cloud Platform.

Check the complete tutorial here.

2. Environment setup

2.1. Get the code

git clone [email protected]:ivamluz/cloud-build-cloud-functions-pipeline.git
cd cloud-build-cloud-functions-pipeline

2.2. Virtualenv

  • Install Python 3.7+

  • Create and activate an isolated Python environment

    virtualenv --python `which python3.7` venv
    source ./venv/bin/activate
  • Install the dependencies

    pip install --upgrade -r requirements-dev.txt

3. Run and test the app locally

3.1 Testing the pub/sub example

From inside the /scripts folder:

./run-local-pubsub.sh

From a different terminal window:

./test-local-pubsub.sh "my message"

test-local-pubsub.sh does the following behind the scenes:

  • encodes the message passed as parameter in base64 format;
  • reads the contents of payloads/test-local-payload.json and replaces its data property with the base64 encoded message;
  • performs an HTTP post request to http://localhost:8080 (the default address the application runs when you execute ./run-local-pubsub.sh from the other terminal window), sending the modified JSON from the previous step in the payload.

On the terminal window where you ran ./run-local-pubsub.sh you should see some logs showing a message was received.

3.2 Testing the HTTP example

From inside the /scripts folder:

./run-local-http.sh

From a different terminal window:

./test-local-http.sh

test-local-http.sh performs a GET HTTP request to http://localhost:8080/?subject=FooBar and prints the response:

$ ./test-local-http.sh
Hello, FooBar!

After everything is running, please make sure to keep reading the tutorial.

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.