如何在App Engine中设置简单的微服务架构 [英] how to setup a simple microservices architecture in app engine
问题描述
我已经在应用引擎中成功设置了一个应用. 现在,我想部署2-3个微服务和
I had successfully setup a single app in the app engine. Now I want to deploy 2-3 micro service and
阅读了一些有关该主题的文章,但我真正想要的是一个简单的教程.
read a few articles on the subject but what I really want is a simple tutorial .
https://cloud.google.com/appengine/docs/python/模块/转换
任何人都可以发布有关如何执行此操作的简单文件结构:
can anyone post a simple file structure as to how to do this :
- app.yaml
- micorservice1
- 文件夹1
- lib1
- lib2
- app.yaml
- micorservice1
- folder1
- lib1
- lib2
- 文件夹1
- lib1
- lib2
- folder1
- lib1
- lib2
但是app.yaml中到底是什么?
but what is in app.yaml exactly?
我如何准确地部署到每个微服务?
how do I deploy to each microservice exactly ?
如何仅在微服务之间启用内部通信?我不希望直接通过负载平衡器来打外部电话.
how do enable INTERNAL communication only between the microservices? I don't want external calls directly at them but via a load balancer.
推荐答案
截至2018年,您可以在一个项目中创建多个服务.这些服务不过是微服务.早期的GCP具有微服务模块的概念.
As of year 2018 you can create multiple services within a project. These services are nothing but micro-services. Earlier GCP had the concept of modules for micro-services.
例如:
GAE灵活应用程序,其中app.yaml为
A GAE flexible application with app.yaml as
运行时:自定义
env:flexruntime: custom
env: flex可以使用以下命令进行部署:
gcloud应用程序部署can be deployed using command:
gcloud app deploy此命令将启动服务为'默认'的应用程序.可以通过URL-> http://your-project-id.appspot.com 进行访问
您可以在Google Cloud Console上进行验证.跟随导航器链接App Engine->服务This command will start an application with service as 'default'. It can be accessed through URL -> http://your-project-id.appspot.com
You can verify this on Google Cloud Console. Follow the navigator links App Engine -> Services类似地,您可以在同一项目中使用app.yaml作为(附加参数-服务)启动另一个服务
Similarly you can start another service in the same project with app.yaml as (additional parameter - service)
运行时:自定义
env:flex
服务:您的服务IDruntime: custom
env: flex
service: your-service-id可以再次使用相同的命令进行部署:
gcloud应用程序部署It can again be deployed using the same command:
gcloud app deploy这将启动一个服务ID为your-service-id的新应用程序.可以通过url访问该服务: http://your-service-id -dot-your-project-id.appspot.com 或 http: //your-service-id.our-project-id.appspot.com
This will start a new application with service id as your-service-id. The service can be accessed through url : http://your-service-id-dot-your-project-id.appspot.com or http://your-service-id.our-project-id.appspot.com
遵循相同的方法在同一项目中创建更多服务.每个服务都是一个具有自己的app.yaml
Follow the same approach to create more services in the same project. Each service is an application with it's own app.yaml
这篇关于如何在App Engine中设置简单的微服务架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
- folder1
- 文件夹1