Skip to content

raphaelsar/Google-Cloud-Render-Form-Serverless

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Google Cloud Render Template Serverless

This sample demonstrates how to render a template form from Google Storage using Cloud Functions.

Functions Code

Form Template See file functions/gcf-form-template/main.py for the code. The dependencies are listed in functions/gcf-form-template/requirements.txt.

Trigger rules

The functions triggers on http request.

Setting up the sample

This sample comes with a Function and web-based UI for testing the function. To configure it:

  1. Create a Google Cloud Project using the Console GCP
  2. Create billing account Console Billing
  3. Enable the Cloud Functions API Console Cloud Functions
  4. Enable the Cloud Storage API Console Cloud Storage

Deploy and test

To test the sample:

  1. Download and install gcloud command line tool Console
  2. From function path functions/gcf-render-template/ execute:
export FUNCTION_NAME="gcf-form-template";
export PATH_FILE="gcf-form-template.html";
export BUCKET_NAME="gcf-static-files";
gcloud beta functions deploy ${FUNCTION_NAME} --entry-point execute --set-env-vars BUCKET_NAME=${BUCKET_NAME},PATH_FILE=${PATH_FILE} --memory 128MB --runtime python37 --trigger-http;
  1. Return something like that:
Deploying function (may take a while - up to 2 minutes)...done.                                                                                                                                            
availableMemoryMb: 128
entryPoint: execute
httpsTrigger:
  url: https://[region]-[project id].cloudfunctions.net/gcf-form-template
labels:
  deployment-tool: cli-gcloud
name: projects/[project id]/locations/[region]/functions/gcf-form-template
runtime: python37
serviceAccountEmail: [service account email]
status: ACTIVE
timeout: 60s
updateTime: '2018-11-22T16:05:07Z'
versionId: '1'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.9%
  • HTML 26.1%