19 Star 91 Fork 21

onlinetool / liudao

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
EPL-1.0
typora-root-url
./

流刀上线工具客户端

流刀上线工具客户端是什么?

使用过 gitlab cicd 功能的朋友应该都知道,这是gitlab提供的能够在你提交代码时触发的持续集成功能。使用cicj需要在您服务器的内网中安装一个 runner。流刀上线工具客户端的作用和这个runner其实差不多,是帮助您团队实现在测试、预发布、线上环境进行部署的一个工具

流刀上线工具和gitlab的cicj有什么区别?和 瓦力部署系统 又有什么区别?

无论是瓦力还是cicj,重点都放在了部署上,且重点都放在了代码级别的部署上。cicj相对来说功能更强大,但配置繁琐。cicj的语法规则非专业人事很难配置。流刀上线工具 http://h5.companyclub.cn/ 相对他们来说除了能够完成代码级别的部署功能以外,还拥有以下特色:

  1. 上线流程规范化 互联网公司的核心是软件产品,软件产品的迭代重点是流程。从pm提出需求到程序员实现需求,然后测试去进行功能把关,代码review人员进行代码把关,必要时进行预发布环境的测试,最后进行上线流程并通知pm。这一系列的过程都需要严格的流程管控。流刀上线工具则将这种流程固化了下来,程序员提交上线单点击开始测试按钮后,会以钉钉、企业微信、邮件的方式通知测试人员,测试人员测试完成,点击通过按钮时候,也会同样的触发这一流程推送到上线人员那里,直到最后代码上线。
  2. 更适用于微服务批量上线的场景 无论是瓦力还是gitlab,都是把单个git资源作为独立的上线模块看待。然而在微服务场景下,每个版本的更新迭代需要上线的微服务少则六七个,多达十几个,为了走完整个上线流程真是苦不堪言。流刀上线工具解决该问题的方式是:程序员提交的上线单包含了需要上线的一系列微服务(git库),无论是测试人员部署到测试环境还是上线人员把他部署到预发布、线上环境,都是以上线单为单位,对上线涉及到的这一系列的微服务实行并发部署方式,缩减上线所需要消耗的时间。
  3. 不只是代码级别的上线 程序员提交的上线单中还可以包含数据库的操作内容,job(常驻脚本)的操作内容(创建、重启)。通过流刀上线工具会在合适的时间点自动进行数据库、job的相关操作。这恐怕是你用任何一种上线工具都无法提供的功能点吧~

体验账号

地址:http://h5.companyclub.cn/login 账号:test@qq.com 密码:Test123456

线上部署

线上部署

上线流程图

主要功能:

  • 项目/微服务管理

    每个项目由一个或多个微服务构成。

    微服务管理 可以配置微服务名称、git文件夹目录、主分支、线上服务器、线上数据库、部署目录、打包前执行的名称、需要打包的目录、打包排除文件、部署后执行命令等。

    微服务配置

  • 提交上线单

    勾选该项目下需要上线的微服务,填写微服务需要上线的分支,如需在线上建表,可填写sql语句。另外也支持配置job服务器执行job指令等。

  • 完整的上线流程管控

    提交上线单->部署到测试环境->测试环境测试通过->部署到预发布环境->预发布环境测试通过->代码上线。

    全流程自动化。各流程通过企业微信/钉钉进行通知相关人员。

    流程管控

使用流程:

  1. 注册账号 点击跳转到 流刀上线工具 注册

  2. 部署客户端工具(参照下面的方法在自己团队的服务器上部署客户端工具,并开放9535端口对团队成员开放)

  3. 在网页 团队设置 - 客户端 中填写 客户端工具部署的对团队成员开放的ip和端口号。

  4. 创建项目。

创建时可以填钉钉、企业微信的机器人hook,上线工具用于团队成员自动发布各种通知。
创建完成后进行到项目中的项目设置页面,需要填写项目的开发、测试、上线人员(可以是同一个人)。
  1. 创建微服务。
在创建该微服务之前,先登录到您安装客户端工具的那台服务器,cd 到 /usr/local/onlinetool/reponsitory/ 目录下(无论你是用那种方式安装的客户端工具,运行后都会自动创该目录的)。执行类似如下命令 `git clone [该微服务的地址] -b [微服务的主分支] [项目名(英文)]_[微服务名(英文)]`
创建微服务时的 **git文件夹目录** 填写上面的  **[项目名(英文)]_[微服务名(英文)]`** ,创建微服务时会涉及到您填写测试、预发布、线上环境服务器、数据库的连接信息,不用担心这些隐私泄露的问题,因为这心内容不会上传到平台,保存在您运行客户端工具的服务器上的的 `/usr/local/onlinetool/config` 文件中。其他内容根据您团队项目的实际情况填写。
  1. 提交上线单。
在项目左侧的列表中点击提交上线单,主要填写的内容是您本次上线的内容描述,需要上线的微服务,每个微服务需要上线的分支,这个微服务上线前需要执行哪些sql语句。上线完成之后需要创建、重启哪些job等。
上线工具会将上线流程推送到测试人员那边,有他选择测试环境进行自动部署,测试人员点击测试通过后会推送到上线人员那里,由他来决定是否在预发布环境测试或者直接上线。

问答:

  1. 上线工具上线的原理是什么?

    在测试、预发布环境部署是通过连接到部署的服务器,执行分支切换脚本、源代码编译脚本以及job相关脚本进行部署的。在线上服务器部署,我们在客户端服务器上进行分支合并、代码编译最后将部署内容打包成tar包,分发到需要部署的每一台服务器上。最后进行压缩包的解压部署流程。

  2. 如何进行迭代部署?如何进行重新部署?

    在测试、预发布、线上每一次部署之前,我们都会在客户端机器下记录当前git的commitID,当前部署已经成功执行掉的sql语句,已经成功创建的job。无论是迭代部署还是重新部署,已经执行过的sql语句都不会重复执行,已经创建的job也不会重复创建(但会重新reload相关job)。迭代部署相对于重新部署,会检测对应git的commitID是否发生变化,只部署在上次部署之后,发生过代码变化的分支,也只执行之前没有执行过的sql语句和job脚本。

  3. 可能存在哪些问题?

    该部署工具在原理上参照 瓦力上线工具 ,是通过在目标服务器上创建文件的方式进行部署,可能存在上线过程中出现线上服务有报错的情况。因此,应尽量避免业务访问高峰时上线代码。同时,如果做好负载均衡,通过切换部署服务器的方式也可以避免这样的问题。

客户端工具部署方式:

从发布页面下载jar包:https://gitee.com/onlinetool/liudao/releases ,然后有两种方式可供选择。

  • 自己安装jdk进行部署

    1. 下载jdk1.8以上
    2. 创建/usr/local/onlinetooll文件夹 mkdir /usr/local/onlinetool && chown -R [当前用户名]:[当前用户所在的组] /usr/local/onlinetool
    3. 运行下载的jar包。nohub java -jar onlinetool_client-1.0.1.jar &
  • 使用docker部署

    1. Dockerfile 内容如下(读者根据实际情况进行修改):

      FROM openjdk:8-jdk-alpine
      VOLUME /tmp
      ADD ./.ssh /root/.ssh
      ADD onlinetool_client-1.0.1.jar app.jar
      EXPOSE 9535
      # 这是我为了远程调试用的的
      # EXPOSE 5005
      # ENTRYPOINT ["java", "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", "-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n", "-jar", "/app.jar"]
      ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
    2. 编译镜像 docker build -t onlinetool_client .

    3. 运行容器 docker run -it -d -p 9535:9535 -v /usr/local/onlinetool:/usr/local/onlinetool onlinetool_client

联系我

使用中有任何问题可以直接与我沟通,微信如下:

加我微信

联系作者

我的邮箱

微信

fanghailiang2023

Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

简介

流刀上线工具 互联网企业产品开发上线流程规范化管理自动工具 展开 收起
Java
EPL-1.0
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/onlinetool/liudao.git
git@gitee.com:onlinetool/liudao.git
onlinetool
liudao
liudao
master

搜索帮助