Deploying Node.js Projects with CelerBuild Pro Using the Express Framework Example

This guide demonstrates how to deploy a Node.js project using CelerBuild Pro Version, covering branch deployment, tag deployment, and tag version rollback operations with multiple roles. We'll use the celerbuild-example-nodejs (opens in a new tab) project built with the Express framework.

Note This tutorial uses the Pro Version. For Standard Version features, please refer to the Standard Version Guide.

Prerequisites

1. System Prerequisites

Complete all Prerequisites setup steps.

2. Node.js Environment Setup

Installing Node.js and npm

macOS
# Using Homebrew
brew install node
 
# Verify installation
node --version
npm --version
Ubuntu/Debian
# Update package list
sudo apt update
 
# Install Node.js and npm
sudo apt install nodejs npm
 
# Verify installation
node --version
npm --version
CentOS/RHEL
# Install Node.js repository
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
 
# Install Node.js and npm
sudo yum install nodejs
 
# Verify installation
node --version
npm --version

3. PM2 Setup

Installing PM2

# Install PM2 globally
sudo npm install -g pm2
 
# Verify installation
pm2 --version
 
# Setup PM2 to start on system boot
pm2 startup

Role Setup and Permissions

1. Team Structure

2. Initial Setup Process (by Tom)

2.1 Create Users

  1. Navigate to Base/Users
  2. Create team members' accounts:
Create Jerry's account:
- Username: jerry
- Email: [email protected]

Create Bob's account:
- Username: bob
- Email: [email protected]

Note:

  • By default, there is an admin user
  • You can promote yourself (Tom) to admin and then delete the default admin user
  • At least one admin user must exist in the system at all times

create-user-1

create-user-2

2.2 Create Space

  1. Navigate to Global/Spaces
  2. Create new space:
    • Name: nodejs-example-space

image

2.3 Import Space Members

Import members from the global user pool to ensure team members have access and can collaborate.

  1. Locate the space you just added.
  2. In the corresponding Actions menu, find and click the Members button.
  3. Click on Import Members to proceed with the import.

image

image

image

2.4 Set Space Owner

Designate a member as the space owner, responsible for managing resources and permissions within the space. In this example, set Tom as the Space Owner.

  1. Locate the user named Tom.
  2. In the corresponding Actions menu, click Edit.
  3. Change his permissions to Owner.

image

image

image

3. Create Server Infrastructure

3.1 Create Server Clusters

  1. Navigate to Global/Server Clusters
  2. Create development cluster:
    • Click "New"
    • Fill in cluster details:
      • Name: pro-example-nodejs-server-cluster(dev)
      • Select Environment: dev
      • Select Status: Available
    • Click "Create"

image

  1. Create production cluster:
    • Click "New"
    • Fill in cluster details:
      • Name: pro-example-nodejs-server-cluster(prod)
      • Select Environment: prod
      • Select Status: Available
    • Click "Create"

image

3.2 Add Servers

  1. Navigate to Global/Servers

  2. Add development server:

    • Click "New"
    • Fill in server details:
      • Select cluster: pro-example-nodejs-server-cluster(dev)
      • Server Name: pro-nodejs-dev-server-1
      • Server IP: Your server IP
      • SSH Port: Your SSH port (default: 22)
    • Click "Create"

image

  1. Add production server:
    • Click "New"
    • Fill in server details:
      • Select cluster: pro-example-nodejs-server-cluster(prod)
      • Server Name: pro-nodejs-prod-server-1
      • Server IP: Your server IP
      • SSH Port: Your SSH port (default: 22)
    • Click "Create"

image

Note:

  • Server names are prefixed with "pro-" to distinguish from standard version
  • Ensure SSH access is properly configured for each server
  • Multiple servers can be added to each cluster if needed

3.3 Import Space Server Clusters

  1. Locate the left navigation and select Space Resources, then choose Server Cluster.
  2. Switch to the space you created earlier, nodejs-example-space.
  3. Click the "Import Server Clusters" button and select the existing server cluster from Global to import.

Once imported, the space server cluster can be used as a selectable server cluster list for projects within the current space.

image

image

image

4. Create Projects and Import Project Members

4.1 Development Project

image

Import Template

The imported project name, Space, and server cluster need to be changed, and others need to be modified according to your own requirements

  1. Navigate to Projects/Projects
  2. Click "Import YAML"
  3. Upload the downloaded template
  4. Configure development project:
    • Project name: "pro-celerbuild-example-nodejs-dev"
    • Select cluster: "pro-example-nodejs-server-cluster(dev)"
    • The development environment can choose not to enable deployment approval (It is off by default)
  5. Click "Create Project"

image

image

image

Import Project Members
  1. In the newly created project, find Members under the Actions menu and click to import project members.
  2. Click "Import Members" to add project members.
  3. After importing, assign specific roles to the members:
    • Set Tom as the Project Owner
    • Set Jerry as the Project Master
    • Set Bob as the Developer

image

image

image

image

image

4.2 Production Project

Download Template

image

Import Template

The imported project name and server cluster need to be changed, and others need to be modified according to your own requirements

  1. Navigate to Projects/Projects
  2. Click "Import YAML"
  3. Upload the downloaded template
  4. Configure production project:
    • Project name: "pro-celerbuild-example-nodejs-prod"
    • Select cluster: "pro-example-nodejs-server-cluster(prod)"
  5. Click "Create Project"
  6. Enable deployment approval requirement

image

image

Import Project Members
  1. In the newly created project, find Members under the Actions menu and click to import project members.
  2. Click "Import Members" to add project members.
  3. After importing, assign specific roles to the members:
  • Set Tom as the Project Owner
  • Set Jerry as the Project Master
  • Set Bob as the Developer

image

image

image

image

image

Note:

  • Development project allows direct deployment without approval
  • Production project requires approval from Project Owner (Tom) or Project Master (Jerry)
  • Make sure to review project settings before creation

Deployment Workflows

Development Environment

Note: Development environment deployments don't require approval

Developer Role (Developer A or B)

  1. Create deployment application
  2. Execute deployment directly
  3. Monitor deployment status

Production Environment

1. Regular Deployment

Developer Role (Developer A or B):

  • Create deployment application
  • Fill in deployment details
  • Submit for review
  • Execute approved deployment after review
  • Monitor deployment process

Project Owner/Master Role (Leader/Developer A):

  • Review deployment application
  • Approve/Reject with comments
  • Monitor deployment status

2. Rollback Deployment

Developer Role (Developer A or B):

  • Create rollback application
  • Select version to rollback
  • Submit for review
  • Execute approved rollback after review
  • Monitor rollback process

Project Owner/Master Role (Leader/Developer A):

  • Review rollback application
  • Approve/Reject with comments
  • Monitor rollback status

Note:

  • The developer who creates the deployment/rollback application is responsible for executing it after approval
  • Project Owner/Master can review and approve but typically don't execute the deployment/rollback
  • This workflow ensures that the developer who initiated the change is also responsible for its execution

Example Deployment Scenarios

Scenario 1: Development Branch Deployment

  1. Developer B (Bob) creates deployment for dev environment:

Navigate to Operations/Applications

  • Select the space nodejs-example-space.
  • Select project "pro-celerbuild-example-nodejs-dev"
  • Fill in:
    • Title: "Deploy version update to Dev"
    • Description: "Deploy version update to Dev.Branch: dev"
  • Select dev branch (click the branch sync icon, and select the latest version)
  • Click "Submit Application"

image

image

  1. Developer B (Bob) executes deployment:

Navigate to Operations/Tasks

  • Find the deployment task
  • Click "Deploy"
  • Click "Start Deploy"
  • Monitor deployment progress in Operation Logs

image

image

image

  1. Verify deployment:
# Check version endpoint
curl http://server:8082/version
{"version":"1.0.1"}
 
# Check main endpoint
curl http://server:8082/
{"message":"Hello World from CelerBuild!"}

Note:

  • Replace "server" with your actual server IP address
  • A response similar to {"version":"1.0.1"} indicates successful deployment
  • If you cannot access the endpoint, check:
    • Server firewall settings
    • Port 8082 accessibility
    • Application running status

Scenario 2: Production Tag Deployment

  1. Developer B (Bob) creates deployment for prod environment:

Navigate to Operations/Applications

  • Select project "pro-celerbuild-example-nodejs-prod"
  • Fill in:
    • Title: "Deploy v1.0.0 to Production"
    • Description: "Deploy v1.0.0 to Production"
  • Submit for review

image

image

Note:

  • Here we select v1.0.0 as an example
  • The deployment process remains the same regardless of which tag version you select
  1. Developer A (Jerry) reviews and approves:
    1. After logging in, ensure the correct space is selected.
    1. Check the notification icon for new messages. You'll see a new ticket assigned to you; click "View Details".
    1. Click "Review", select "Approved", provide feedback, and finally click "Submit Review".

image

image

  1. Developer B (Bob) executes deployment:
    1. After logging in, ensure the correct space is selected.
    1. Check the notifications for new messages. You'll see your ticket has been reviewed and approved; click "View Details".
    1. In the ticket details, click the "Deploy" button.
    1. Navigate to the specific task page, click "Start Deployment" to begin the deployment.
    1. Monitor the logs and server status. If any issues arise, a prompt will provide guidance.

image

image

image

image

  1. Verify deployment:
# Check version endpoint
curl http://server:8082/version
{"version":"1.0.0"}
 
# Check main endpoint
curl http://server:8082/
{"message":"Hello World from CelerBuild!"}

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
  • Rollback can only be performed to previously deployed tags in the system

Tag Deployment Rollback Example

1. Initial Deployment (v1.0.0)

For detailed deployment steps, refer to the Production Tag Deployment section above.

  1. Developer B (Bob) creates deployment:

Navigate to Operations/Applications

  • Select project "pro-celerbuild-example-nodejs-prod"
  • Fill in:
    • Title: "Initial Deploy v1.0.0"
    • Description: "Initial production deployment:Version: v1.0.0"
  • Select tag "v1.0.0"
  • Submit for review
  1. Developer A (Jerry) reviews and approves
  2. Developer B (Bob) executes deployment
  3. Verify deployment:
curl http://server:8082/version
{"version":"1.0.0"}

2. Upgrade to v1.0.1

For detailed deployment steps, refer to the Production Tag Deployment section above.

  1. Developer B (Bob) creates deployment:

Navigate to Operations/Applications

  • Select project "pro-celerbuild-example-nodejs-prod"
  • Fill in:
  • Title: "Upgrade to v1.0.1"
  • Description: "Production version upgrade: From v1.0.0 To v1.0.1"
  • Select tag "v1.0.1"
  • Submit for review
  1. Developer A (Jerry) reviews and approves

  2. Developer B (Bob) executes deployment

  3. Verify upgrade:

curl http://server:8082/version
{"version":"1.0.1"}

3. Rollback to v1.0.0

  1. Developer B (Bob) initiates rollback:

Navigate to Operations/Applications

  • Find project
  • Click Actions → "Apply Rollback"
  • Fill in:
    • Title: "Rollback from v1.0.1 to v1.0.0"
    • Description: "Rolling back production version"
  • Select rollback version v1.0.0
  • Submit for review

image

image

  1. Leader (Tom) reviews and approves:

Navigate to Operations/Applications

  • Review rollback request
  • Select Review Status "Approved"
  • Add approval comments: "Rollback to v1.0.0 approved."
  • Click "Submit Review"

image

image

Note:

  • Both Project Owner (Tom) and Project Master (Jerry) have permission to review rollback requests
  • In this example, we demonstrate Tom reviewing the rollback for clarity of role responsibilities
  • In practice, Jerry could also review and approve this rollback request
  1. Developer B (Bob) executes rollback:
  • Check the notifications for new messages. You'll see your ticket has been reviewed and approved; click "View Details".
  • Click "Rollback"
  • Click "Start Rollback"
  • Monitor rollback progress

image

image

image

image

  1. Verify rollback:
curl http://server:8082/version
{"version":"1.0.0"}

For detailed rollback instructions, see:

Congratulations! You have successfully learned how to deploy Express Framework using CelerBuild Pro Edition, including team-based deployment workflows, approval processes, and version management! 🎉