Deploying Go Projects with CelerBuild Using the Gin Framework Example
This guide demonstrates how to deploy a Go project using CelerBuild Standard Version, including:
- Branch deployment for development environment
- Tag deployment for production environment
- Tag version rollback operations
We'll use the celerbuild-example-go (opens in a new tab) project built with the Gin framework.
Note:
- This tutorial uses the Standard Version with the admin user
- For Pro Version features with multiple roles and approval process, please refer to the Pro Version Guide
Prerequisites
1. System Prerequisites
Complete all Prerequisites setup steps
2. Go Environment Setup
Installing Go
macOS
# Using Homebrew
brew install go
# Verify installation
go version
Ubuntu/Debian
# Add the repository
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
# Install Go
sudo apt install golang-go
# Verify installation
go version
CentOS/RHEL
# Install Go
sudo yum install epel-release
sudo yum install golang
# Verify installation
go version
Manual Installation (Recommended for specific versions)
# Download Go (replace version as needed)
wget https://go.dev/dl/go1.24.0.linux-amd64.tar.gz
# Remove any existing Go installation
sudo rm -rf /usr/local/go
# Extract to /usr/local
sudo tar -C /usr/local -xzf go1.24.0.linux-amd64.tar.gz
# Verify installation
/usr/local/go/bin/go version
Environment Variables
Add these lines to your shell profile (~/.bashrc, ~/.zshrc, etc.):
For yum installation (CentOS/RHEL):
export GOPATH=$HOME/go
export GOROOT=/usr/lib/golang
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
For apt installation (Ubuntu/Debian):
export GOPATH=$HOME/go
export GOROOT=/usr/lib/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
For manual installation:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH # Put the new Go binary path first
Verify configuration:
# Reload profile
source ~/.bashrc # or source ~/.zshrc
# Check environment
go env GOROOT
go env GOPATH
go version
Important Notes:
- Minimum Go version required: 1.23.1 or later
- For production use, we recommend using the manual installation method to ensure version consistency
- The deployment process uses makefile (opens in a new tab) for building and testing
- Make sure to reload your shell profile after setting environment variables
- Different Linux distributions may have different Go installation paths
3. Build Tools Setup
Installing Make Tool
macOS
# make is included in Command Line Tools
xcode-select --install
# Verify installation
make --version
Ubuntu/Debian
# make is usually pre-installed, if not:
sudo apt update
sudo apt install make
# Verify installation
make --version
CentOS/RHEL
# make is usually pre-installed, if not:
sudo yum install make
# Verify installation
make --version
Note:
- Most Unix-like systems (macOS, Linux) come with
make
pre-installed- For macOS, if
make
is not found, installing Command Line Tools will include it- The deployment process requires
make
for building and packaging operations
Branch Deployment
1. Create Server Infrastructure
Create Server Cluster
- Navigate to
Global/Server Clusters
- Create a cluster named "example-go-server-cluster(dev)"
Add Server
- Navigate to the
Global/Servers
section or go to theActions
menu of the newly createdexample-go-server-cluster(dev)
and select "Servers" - Select cluster "example-go-server-cluster(dev)"
- Fill in:
- Server Name
- Server IP
- SSH Port (default: 22)
2. Import Project Template
Download Template
- Download project template: celerbuild-example-go-dev.yaml
- Template source: celerbuild-example-go dev template (opens in a new tab)
Import Template
- Navigate to
Projects/Projects
- Click "Import YAML"
- Upload the downloaded template
Create Project
- Review and confirm project settings
- Click "Create Project" to finish
3. Initiating Deployment
- Go to
Operations/Applications
- Select project "celerbuild-example-go-dev"
- Fill in Title and Description
- Click sync icon next to "Branch" and select latest dev branch
- Click "Submit Application"
For detailed steps, see Creating Deployment
4. Executing Deployment
- In
Operations/Tasks
, find your project task - Click "Deploy" button
- On the task page, click "Start Deploy"
- Monitor Server Status and Operation Logs
- If issues occur, check error messages and retry deployment after fixing
For detailed steps, see Execute Deployment Task
5. Verification
Access http://server:8080/version
(replace "server" with your server address)
# Example command
➜ ~ curl http://server:8080/version
# Expected response
{"version":"1.0.9"}
Note:
- Replace "server" with your actual server IP address
- A response similar to
{"version":"1.0.9"}
indicates successful deployment- If you cannot access the endpoint, check:
- Server firewall settings
- Port 8080 accessibility
- Application running status
Tag Deployment
1. Create Server Infrastructure
Create Server Cluster
- Navigate to
Global/Server Clusters
- Create a cluster named "example-go-server-cluster(prod)"
Add Server
-
Navigate to the
Global/Servers
section or go to theActions
menu of the newly createdexample-go-server-cluster(prod)
and select "Servers" -
Select cluster "example-go-server-cluster(prod)"
-
Fill in:
- Server Name
- Server IP
- SSH Port (default: 22)
2. Import Project Template
Download Template
- Download project template: celerbuild-example-go-prod.yaml
- Template source: celerbuild-example-go prod template (opens in a new tab)
Import Template
- Navigate to
Projects/Projects
- Click "Import YAML"
- Upload the downloaded template
Create Project
- Review and confirm project settings
- Click "Create Project" to finish
3. Initiating Deployment
- Go to
Operations/Applications
- Select project "celerbuild-example-go-prod" and Click "Apply Deploy"
- Fill in Title and Description
- Click sync icon next to "Tag" and select latest tag
- Click "Submit Application"
For detailed steps, see Creating Deployment
4. Executing Deployment
Follow the same steps as branch deployment execution.
5. Verification
Access http://server:8080/version
(replace "server" with your server address)
# Example command
➜ ~ curl http://server:8080/version
# Expected response
{"version":"1.0.5"}
Note:
- Replace "server" with your actual server IP address
- A response similar to
{"version":"1.0.5"}
indicates successful deployment- If you cannot access the endpoint, check:
- Server firewall settings
- Port 8080 accessibility
- Application running status
Rollback Operations
Note: Branch deployment rollback is not demonstrated here because the system only maintains the latest committed version. We'll demonstrate rollback using tag deployments instead.
Tag Deployment Rollback Example
1. Initial Deployment (v1.0.5)
For detailed deployment steps, refer to:
- Go to
Operations/Applications
- Select project "celerbuild-example-go-prod"
- Fill in deployment information:
- Title: "Deploy v1.0.5"
- Description: "Initial deployment of v1.0.5"
- Click sync icon next to "Tag" and select "v1.0.5"
- Click "Submit Application"
- Execute deployment and verify:
curl http://server:8080/version
{"version":"1.0.5"}
2. Upgrade to v1.0.6
For detailed deployment steps, refer to:
- Go to
Operations/Applications
- Create new deployment
- Fill in deployment information:
- Title: "Upgrade to v1.0.6"
- Description: "Upgrading from v1.0.5 to v1.0.6"
- Select tag "v1.0.6"
- Submit and execute deployment
- Verify upgrade:
curl http://server:8080/version
{"version":"1.0.6"}
3. Rollback to v1.0.5
- In
Operations/Applications
, find your project - Click Actions (three dots) and select "Apply Rollback"
- Fill in rollback information:
- Title: "Rollback to v1.0.5"
- Description: "Rolling back from v1.0.6 to v1.0.5"
- Click sync icon next to "Select Rollback Tag"
- Select "v1.0.5" from the available tags
- Click "Submit Rollback"
4. Execute Rollback
- Go to
Operations/Tasks
- Find your rollback task
- Click "Rollback" in Actions
- Click "Start Rollback" on the task page
- Monitor Server Status and Operation Logs
- Verify rollback success:
curl http://server:8080/version
{"version":"1.0.5"}
For detailed rollback instructions, see:
Congratulations! You have successfully learned how to deploy Gin Framework using CelerBuild Standard Edition, including branch deployment, tag deployment, and tag version rollback operations! 🎉