Compile consul source code and generate executable scripts

Recently I have some special requirements which ask to compile consul source code and generate executable scripts, below are the general steps:

1. Make sure you have installed docker, go, nodejs

xxx@xxx consul $ docker version && node --version && go version
Client: Docker Engine - Community
 Version:           18.09.2
 API version:       1.39
 Go version:        go1.10.8
 Git commit:        6247962
 Built:             Sun Feb 10 04:12:39 2019
 OS/Arch:           darwin/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.2
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       6247962
  Built:            Sun Feb 10 04:13:06 2019
  OS/Arch:          linux/amd64
  Experimental:     false
v11.14.0
go version go1.12.4 darwin/amd64

2. Download consul source code

cd $GO_HOME && mkdir -p src/github.com/hashicorp
cd src/github.com/hashicorp
git clone https://github.com/hashicorp/consul.git
cd consul && git checkout v1.4.4 -b <BRANCH_NAME>

3. Modify UI templates under ui-v2/app/templates/

4. Compile & generate executable scripts

export RELEASE_UNSIGNED=1
export ALLOW_DIRTY_GIT=1
sh build-support/scripts/release.sh --tag false --sign false --release <RELEASE_NAME>

5. Test consul

bin/consul agent 
           -datacenter='207' 
           -bind='10.49.32.224' 
           -bootstrap-expect=1 
           -data-dir="data/" 
           -log-level=INFO 
           -server 
           -ui

NOTE:

  1. generate consul packages locations: bin/consul, pkg/bin, pkg/dist
  2. reference: https://github.com/hashicorp/consul/blob/master/.github/CONTRIBUTING.md