prasanjit101 / gcp-functions

A gcp function template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Cloud Function Template

What can this repository do?

  • Get you started quickly with Google Cloud Functions
  • Has provision for a basic middleware (like auth and cors)
  • Uses @google-cloud/functions-framework for local development
  • Includes deployment script deploy-to-cloud.sh

How to setup on local?

  • Clone this template project
  • Rename and go inside
  • On your terminal, run this command: npm install
  • Then run this command: npm run dev
  • That's all! It should be running at http://localhost:8081/

How to deploy manually using 'gcloud deploy' script?

  • Edit file deploy-to-cloud.sh
  • Replace <function-name> with actual name of the cloud function, for example: image-resizer
  • Replace <gcp-project-name> with actual name of the gcp project
  • Replace <gcp-region> with actual name of the gcp region
  • Setup Gcloud SDK into your terminal, Gcloud SDK
  • On your terminal, Run ./deploy-to-cloud.sh

How to deploy automatically using CI/CD (bitbucket pipeline)?

  • Edit file deploy-to-cloud.sh
  • Replace <function-name> with actual name of the cloud function, for example: image-resizer
  • Replace <gcp-project-name> with actual name of the gcp project
  • Replace <gcp-region> with actual name of the gcp region
  • Moment you commit your code to master branch of your repository, build pipeline will start and the Google cloud function will be deployed automatically.
  • Wait for a couple of minutes, the project should be deployed to Google cloud functions
  • Check whether it's running properly at the console

About

A gcp function template


Languages

Language:JavaScript 91.2%Language:Shell 8.8%