How to Hot-Deploy the Golang Revel Framework
Overview
I tried out the deployment methods listed on the official Revel site.
- Build the app locally and copy it to the server
- Pull the updated code on the server, then build and start it
- Use Heroku to manage the deployment
1. Local Build
1 | # アプリを実行しテストする |
This is the only way to deploy to an environment with the same architecture you develop on, or to configure your Go installation to build for the desired architecture by default.
2. Incremental Deployment
Since a statically linked binary bundled with the full asset set can become huge, incremental deployment is also supported.
1 | # アプリを一時ディレクトリにビルド |
Because rsync supports copying over ssh, you can deploy as follows, although it gets a bit more involved.
1 | # カスタム証明書、ログイン名、対象ディレクトリを指定しrsync |
3. Build on the Server
This method depends on a version control system. You need a server with Go installed. In return, you can avoid cross-compilation.
1 | $ ssh server |
Summary
Internally we currently use the 1. Local Build deployment method.
With 2. Incremental Deployment, the momentary disconnect on restart is a concern. I don’t think it’s well suited to Go, which we use to handle large-scale access.
With 3. Build on the Server, depending on how you operate it, there is a concern that compilation could stop if a conflict occurs in the production environment.
We manage and operate the 1. Local Build method with Jenkins, and so far we haven’t run into any particular problems.
Once I’ve organized the Jenkins configuration and so on, I’d like to publish it.
How to Hot-Deploy the Golang Revel Framework
https://kenzo0107.github.io/en/2015/08/21/go-revel-fw-hotdeploy/