我正在尝试一个与图像中详细描述的设置非常相似的设置:https://raw.githubusercontent.com/Oreste-Luci/netflix-oss-example/master/netflix-oss-example.png
在我的设置中,我使用的是客户端应用程序(https://www.joedog.org/siege-home/),代理(Zuul),发现服务(Eureka)和简单的微服务.一切都部署在PWS上.
我想从我的简单微服务的一个版本迁移到下一个版本,没有任何停机时间.最初我开始使用这里描述的技术:https://docs.cloudfoundry.org/devguide/deploy-apps/blue-green.html
在我看来,这种方法与Eureka等发现服务并不"兼容".实际上,我的服务的新版本在Eureka中注册并且甚至在我可以重新映射所有路由(CF路由器)之前接收流量.
这引出了另一种方法,我依赖于Spring Cloud/Netflix中的故障转移机制:
据我所知,Zuul在引擎盖下使用了Ribbon(负载均衡),所以在旧实例仍然在Eureka但实际上关闭的那一瞬间,我期望在新实例上重试而不会对客户端产生任何影响.
但是,我的假设是错误的.我的客户端出现了几个502错误:
Lifting the server siege... done.
Transactions: 5305 hits
Availability: 99.96 %
Elapsed time: 59.61 secs
Data transferred: 26.06 MB
Response time: 0.17 secs
Transaction rate: 89.00 trans/sec
Throughput: 0.44 MB/sec
Concurrency: 14.96
Successful transactions: 5305
Failed transactions: 2
Longest transaction: 3.17
Shortest transaction: 0.14
Run Code Online (Sandbox Code Playgroud)
我的application.yml的一部分
server:
port: ${PORT:8765}
info:
component: proxy
ribbon:
MaxAutoRetries: 2 # Max number of retries …Run Code Online (Sandbox Code Playgroud) blue-green-deployment spring-cloud pivotal-cloud-foundry spring-cloud-netflix
Kubernetes 等平台支持活性和就绪探针:https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes
基本上,(Web)应用程序需要提供一个特定的http端点,平台每隔几秒调用一次。如果应用程序运行状况不佳(通常由 5xx 错误指示),平台将重新启动应用程序。
Heroku如何处理这个问题?
我一直在试验jhipster.我已将我的应用配置为使用oauth2.为此,我在application.yml中有一个客户端密码
根据我在这个主题上发现的几篇文章,客户秘密应该始终保密.例如,请检查https://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified
客户机密必须保密.如果部署的应用程序无法保密,例如Javascript或本机应用程序,则不使用该机密.
我注意到生成的auth.oauth2.service.js包含纯文本的秘密:
return {
login: function(credentials) {
var data = "username=" + credentials.username + "&password="
+ credentials.password + "&grant_type=password&scope=read%20write&" +
"client_secret=mySecretOAuthSecret&client_id=myapp";
return $http.post('oauth/token', data, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "application/json",
"Authorization": "Basic " + Base64.encode("myapp" + ':' + "mySecretOAuthSecret")
}
}).success(function (response) {
var expiredAt = new Date();
expiredAt.setSeconds(expiredAt.getSeconds() + response.expires_in);
response.expires_at = expiredAt.getTime();
localStorageService.set('token', response);
return response;
});
},Run Code Online (Sandbox Code Playgroud)
我知道在缩小的javascript中找到它会有点困难,但是任何寻找'client_secret'的人都会很快获得奖励.
我错过了什么吗?或者jHipster oauth实施是不安全的?
谢谢,安迪