aws lambda上的pythonic微服务

psychic_disco的Python项目详细描述


精神迪斯科

  • 你是不是一个需要部署程序的笨蛋?
  • 需要制作一个演示,但还没有击中支付污垢?
  • 喜欢python开发,但不喜欢产品交付?

那就让灵媒迪斯科成为你公开展示作品的主要代表吧!

通过利用aws lambda和无服务器网络的开拓性领域,通灵迪斯科甚至允许像你和我这样的平民傻瓜廉价地扩展我们梦想的平台。

臭烘烘的徽章

https://travis-ci.org/robertdfrench/psychic-disco.svg?branch=masterhttps://coveralls.io/repos/github/robertdfrench/psychic-disco/badge.svg?branch=master

安装

按如下方式安装:

pip install psychic_disco

假设

  • All your microservices live in python modules
  • All your entrypoints are decorated with @lambda_entry_point

声明入口点和api方法

创建新入口点:

@lambda_entry_point
def handler(event, context):
  # important code here

创建新的api方法会自动注册入口点:

@api_method("POST", "/cereal"):
def create_cereal(event, context):
  # cereal creation logic here

api方法的定义可在psychic_disco.Api中找到。

发现入口点

做这件事:

psychic_disco discover_entrypoints

或者,如果您的代码存在于其他地方:

psychic_disco --repo path/to/st/elsewhere discover_entrypoints

创建部署包

做这件事:

psychic_disco bundle

这将创建一个virtualenv,安装您的依赖项,并为您压缩所有内容。这假设在psychic_disco_config.py

中定义了psychic_disco.config.default_s3_bucket

部署lambda函数

一旦将部署包上传到amazon s3,就可以安装您定义的lambda函数,如下所示:

psychic_disco deploy_lambdas

这假设在psychic_disco_config.py

中定义了psychic_disco.config.default_iam_role

查询aws

通过运行:

psychic_disoc show_installed_routes <api-name>

它将输出如下内容:

verbpathlambda-function
GET/usersusers-list_all
POST/usersusers-create_new
PATCH/user/7users-update

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java根据两个数组的值对数组进行排序   具有自签名证书和NTLM代理的java Maven SSL repo错误   java自定义字体按钮不工作AndroidStudio   java通过Spring MVC web应用程序向客户端发送文本文件   Java Spring Web服务SOAP身份验证   ANT property environment=“env”无法在JAVA中检索它,但如果作为ANT命令运行,则可以正常工作   java是为spring mvc rest api或spring boot api对应用服务器的每个新请求创建的服务、存储库和组件的新实例吗?   java私有静态最终字符串未完成其工作   PKCS12的安全Java密钥重新处理   java JPA继承表每类SQLSyntaxErrorException