Spring Boot和Continuous Delivery简单管道 [英] Spring Boot and Continuous Delivery simple pipeline

查看:101
本文介绍了Spring Boot和Continuous Delivery简单管道的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到任何示例或文章,当我们使用Spring Boot + Jenkins时,连续交付管道会是什么样子.

在Java EE中,我通常这样做:

  • 将更改推送到存储库
  • Jenkins每5分钟检查一次更改
  • 如果有更改,Jenkins会拉出源代码并运行maven build
  • 使用wildfly maven插件在服务器上运行重新部署

通常,我想知道使用Spring Boot时最后要做什么.应用程序打包到单个JAR中,并在单独的进程中运行,因此在Spring Boot中实际上没有诸如重新部署之类的东西.我是否必须先编写一些脚本来杀死旧进程,然后运行新工件?或者也许有诸如"spring boot cli"之类的东西,我可以管理所有正在运行的spring boot应用程序?

解决方案

您需要终止旧进程,并将新进程作为服务运行. 在 Spring Boot应用程序即服务中对此进行了很好的解释. >

我们为jenkins使用了一个不错的ssh插件: https ://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin

  1. 将jar复制到服务器
  2. 停止旧服务
  3. 运行新服务

添加了用于将Spring Boot作为服务运行的Spring Boot参考- http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html @Vaelyr

I can't find any example or article how can the continuous delivery pipeline look like when we are using Spring Boot + Jenkins.

In Java EE I usually do it like this:

  • Push changes to repository
  • Jenkins checks for changes every 5 minutes
  • if there was a change, Jenkins pulls the sources and run maven build
  • using wildfly maven plugin I run redeploy on server

And generally I wonder what to do in last point when I'm using Spring Boot. Application is packaged into single JAR and run in separate process so in Spring Boot there is actually no such thing like redeploy. Do I have to write some script to kill old process first and then run the new artifact? Or maybe there is something like "spring boot cli" where I could manage all running spring boot apps?

解决方案

You need to kill old process and run new process as a service. It is all very well explained here Spring Boot application as a Service.

There is nice ssh plugin for jenkins that we use : https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin

  1. Copy jar to the server
  2. Stop old service
  3. Run new service

EDIT : Added Spring boot reference for running spring boot as a service - http://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html @Vaelyr

这篇关于Spring Boot和Continuous Delivery简单管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆