Git Product home page Git Product logo

cookiecutter-gcp-cloud-function-python's Introduction

cookiecutter-gcp-cloud-function-python

This script is tailored for deploying 1gen environment functions

Features

  • Environment variables management by pydantic (support for .env.yaml file)
  • Project dependency management via Poetry (pyproject.toml)
  • Uses Flask development server for local testing
  • (Re)Deployment script

Requirements

Usage

$ cookiecutter gh:idle-code/cookiecutter-gcp-cloud-function-python
project_name [My GCP Cloud Function]: 
project_slug [my_gcp_cloud_function]: 
gcp_project []: # Your Google project ID goes here; if empty - your current gcloud configuration will define it
Select gcp_function_region:
1 - asia-east1
2 - asia-east2
3 - asia-northeast1
4 - asia-northeast2
5 - asia-northeast3
6 - asia-south1
7 - asia-southeast1
8 - asia-southeast2
9 - australia-southeast1
10 - europe-central2
11 - europe-west1
12 - europe-west2
13 - europe-west3
14 - europe-west6
15 - northamerica-northeast1
16 - southamerica-east1
17 - us-central1
18 - us-east1
19 - us-east4
20 - us-west1
21 - us-west2
22 - us-west3
23 - us-west4
Choose from 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 [1]:
gcp_cloud_function_name [my_gcp_cloud_function]: # This is how function will be named in GCP console
code_entry_point [on_request_received]: # This is python function name as seen in the source code
Select memory:
1 - 128MB
2 - 256MB
3 - 512MB
4 - 1024MB
5 - 2048MB
6 - 4096MB
7 - 8192MB
Choose from 1, 2, 3, 4, 5, 6, 7 [1]: 
min_auto_scaling_instances [0]:
max_auto_scaling_instances [3000]:
Select runtime:
1 - python310
2 - python39
3 - python38
4 - python37
Choose from 1, 2, 3, 4 [1]: 
Select timeout:
1 - default (1m)
2 - 30s
3 - 1m
4 - 2m
5 - 5m
6 - 9m
Choose from 1, 2, 3, 4, 5, 6 [1]: 
Select allow_unauthenticated:
1 - y
2 - n
Choose from 1, 2 [1]: 
author_full_name: Pawel Zukowski
author_email: [email protected]

$ poetry shell
$ poetry update

Local testing

Enter created directory and execute:

$ poetry shell
$ poetry update
$ ./main.py
 * Serving Flask app "main" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!

Deployment

You can use generated deploy.sh script but double check it for your use case!

cookiecutter-gcp-cloud-function-python's People

Contributors

idle-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kabuku zpyoung

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.