简体   繁体   English

如何在kubernetes上使用mongodb部署playframework

[英]how to deploy playframework with mongodb on kubernetes

I want to deploy our project built with nginx, playframework,and mongodb etc. to Kubernetes. 我想将使用nginx,playframework和mongodb等构建的项目部署到Kubernetes。

However, i couldn't find any tutorials on internet how to do that. 但是,我在互联网上找不到任何教程。 Could anyone advise where i can find the steps to integrate playframework, nginx and mongodb on Kubernetes? 谁能建议我在哪里可以找到在Kubernetes上集成playframework,nginx和mongodb的步骤?

In my project i use DockerPlugin to create docker images and to push them to AWS registry (ECR). 在我的项目中,我使用DockerPlugin创建Docker映像并将其推送到AWS注册表(ECR)。 So every time i want to update a backend image i run sbt and it pushes a new version to docker repository. 因此,每次我想更新后端映像时,我都会运行sbt,它将新版本推送到docker存储库。

To work with mongo i use morphia , it's not reactive, but easy to use. 与mongo一起使用 ,我使用morphia ,它不具有反应性,但易于使用。 If performance is very important for you i would recommend you to use async driver, but the code will be less easy to read. 如果性能对您很重要,我建议您使用异步驱动程序,但是代码不太容易阅读。 Here you can see example of how to add morphia to play!. 在这里,您可以看到如何添加语素的示例!

Once you have your play project built and stored as docker image you can deploy it to kubernetes, for that you will need provide a deployment and service . 构建好游戏项目并将其存储为docker映像后,您可以将其部署到kubernetes,为此,您需要提供部署服务 In service you should open just default port 9000 to your play deployment. 在使用中,您应该仅打开默认端口9000即可进行游戏部署。

Next step is to deploy nginx, just use standard image from here . 下一步是部署nginx,只需使用此处的标准映像即可。 Actually, you can use ingress instead, it will wrap nginx version which is more kuberenetess friendly. 实际上,您可以改用Ingress ,它将包装Nginx版本,这对kuberenetess更为友好。 Once you have nginx you need to add there a route, from port 80 or 443 to your play server to port 9000. 有了nginx之后,您需要在此添加一条路由,从端口80或443到您的播放服务器到端口9000。

This is very high level description, hope it helps. 这是非常高级的描述,希望对您有所帮助。 I don't post here build.sbt, deployment, services and nginx configuration files since they are very long. 我不在这里发布build.sbt,部署,服务和Nginx配置文件,因为它们很长。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM