本文介绍了在微服务架构中设置开发环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正朝着在微服务架构中开发Web应用程序发展.
我们考虑过在API网关后面运行服务,该网关将处理身份验证并将请求转发给适当的服务.
设置开发环境时我们遇到了问题.我们如何在本地计算机(笔记本电脑)中开发服务,并以与生产类似的方式(在网关后面)测试和运行它?

We are moving towards developing a web app in a micro-services architecture.
We thought about running the services behind a API gateway that will handle authentication and will proxy the requests to the appropriate services.
We have encountered a problem while setting up the development environment. How can we develop a service in a local machine (laptop) and test and run it in a way that is similar to the production (behind the gateway)?

请考虑以下要求:

  • 进程间通信(B2B)
  • 管理和同步不同的版本
  • 使用身份验证令牌(由网关生成)访问服务

推荐答案

为微服务设置开发环境的难度与微服务的数量成正比.我的笔记本电脑上有2个微服务以及eureka,带有oAuth2的zuul网关,授权服务器和spring cloud config的运行设置.除此之外,我还没有尝试过,因为它将开始变得难以管理.

Difficulty to setup development environment for microservices is proportional to the number of microservices. I have a running setup on my laptop with 2 microservices along with eureka, zuul gateway with oAuth2, an authorization server and spring cloud config. Beyond this I have not tried as it will start becoming unmanageable.

在这种情况下,最好将开发环境放在云上.您可以选择任何云提供商,并在一段时间内免费订阅.例如.亚马逊每月为您提供750个小时的免费Linux时间.您可以根据需要创建任意数量的实例(免费使用后成本最低).

In this case it is better to have the development environment on cloud. You can choose any cloud provider and avail a free subscription for sometime. For eg. Amazon gives you 750 hours of linux time free for a month. You can create any number of instances as you need(with minimal cost after free usage).

这篇关于在微服务架构中设置开发环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:07