Home  >  Article  >  Backend Development  >  How to do hot update in golang

How to do hot update in golang

(*-*)浩
(*-*)浩Original
2019-12-31 13:27:295442browse

How to do hot update in golang

The http part of the Golang standard library provides powerful web application support. Coupled with the support of middleware frameworks such as negroni, high-performance web applications can be developed (such as Restful's api service, etc.).                                                                                                                                                                                                                                                                . Cluster services. When the application version is upgraded, how to implement a more elegant polymorphic server version update?

Problem Analysis

When updating the Web application, I think there may be several issues that need to be considered:

Compile well The application binary files and configuration files are uploaded to the server; The application server can sense that a new version is uploaded;

Hot update version without stopping the service;

It is best that all update processes can be scripted to reduce manual operation errors.

Solution

In fact, the go community has some open source projects that can automatically detect changes in web applications and implement automatic updates, but these applications all detect source code, Update resource files, start the build process, and realize automatic compilation and restart. For example, gin and fresh, these applications are suitable for use in the development and testing stages. They may not be suitable for application deployment and updates, but they provide good ideas.

Upload the directory and version of the deployment environment

I will store the released application binary files and configuration files in a certain directory, such as ~/app/release , each version is retained in this directory, such as app.1.0, app.1.1, app.2.0. Once a problem is found, it can be rolled back in time

The above is the detailed content of How to do hot update in golang. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn