Deploying Java Projects with CelerBuild Pro Using the Spring Boot Framework Example

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

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

Prerequisites

Important Note:

  • For this tutorial, Java and Maven installation is required on the target server
  • Local Java and Maven installation is recommended depending on your build strategy:
    • If building locally and uploading to remote server: both local and remote installation needed
    • If building only on remote server: only remote installation needed
  • The System Service Setup must be configured on the target deployment server

1. System Prerequisites

Complete all Prerequisites setup steps.

2. Java Environment Setup

Installing Java and Maven

macOS
# Using Homebrew
brew install openjdk@17
brew install maven
 
# Create system Java symlink
sudo ln -sfn /usr/local/opt/openjdk@17/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-17.jdk
 
# Add to ~/.zshrc
echo 'export PATH="/usr/local/opt/openjdk@17/bin:$PATH"' >> ~/.zshrc
echo 'export JAVA_HOME="/usr/local/opt/openjdk@17"' >> ~/.zshrc
 
# Verify installation
java --version
mvn --version
Ubuntu/Debian
# Update package list
sudo apt update
 
# Install Java and Maven
sudo apt install openjdk-17-jdk maven
 
# Verify installation
java --version
mvn --version
CentOS/RHEL
# Install Java and Maven
sudo yum install java-17-openjdk-devel maven
 
# Verify installation
java --version
mvn --version

3. System Service Setup

On the target deployment server, create a systemd service file for managing the Spring Boot application. This step is required for proper application management and auto-restart capabilities.

Important: This setup must be performed on each target deployment server.

sudo vim /etc/systemd/system/celerbuild-example-java.service

Add the following content:

[Unit]
Description=CelerBuild Example Java Application
After=network.target
 
[Service]
User=ubuntu
WorkingDirectory=/home/ubuntu/celerbuild-example-java
Environment=SPRING_PROFILES_ACTIVE=dev
ExecStart=java -jar app.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE}
SuccessExitStatus=143
TimeoutStopSec=10
Restart=on-failure
RestartSec=5
 
[Install]
WantedBy=multi-user.target

Configuration Notes:

  • User:
    • Change ubuntu to your actual service user
    • Ensure the user has proper permissions to run the application
    • Example: User=deploy if using a deploy user
  • WorkingDirectory:
    • Adjust /home/ubuntu/... to match your user's home directory
    • Must be an absolute path
    • Example: /home/deploy/celerbuild-example-java for deploy user
  • Environment:
    • Set SPRING_PROFILES_ACTIVE=dev for development environment
    • Set SPRING_PROFILES_ACTIVE=prod for production environment
    • This value determines which Spring profile to use
  • ExecStart:
    • The path to Java executable should be accessible to the service user
    • The jar file name should match your actual application jar
    • Example: ExecStart=/usr/bin/java -jar app.jar

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: java-example-space
    • Description (Optional): A dedicated space for Java language deployment examples, including Spring Boot framework and other Java-based applications.

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

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

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-java-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-java-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-java-server-cluster(dev)
    • Server Name: pro-java-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-java-server-cluster(prod)
    • Server Name: pro-java-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, java-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

Download Template

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-java-dev"
    • Select cluster: "pro-example-java-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-java-prod"
    • Select cluster: "pro-example-java-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 java-example-space.
  • Select project "pro-celerbuild-example-java-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:8083/version
{"version":"1.0.1"}
 
# Check main endpoint
curl http://server:8083/
{"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 8083 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-java-prod"
  • Fill in:
    • Title: "Deploy v1.0.0 to Production"
    • Description: "Updating production version to v1.0.0"
  • Submit for review

image

image

Note:

  • Here we select v1.0.0 as an example
  • For testing rollback operations, you can:
    1. First deploy v1.0.0 (refer to Rollback Operations)
    2. Then deploy v1.0.1
    3. Finally perform rollback to v1.0.0
  • 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:8083/version
{"version":"1.0.0"}
 
# Check main endpoint
curl http://server:8083/
{"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-java-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:8083/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-java-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:8083/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:8083/version
{"version":"1.0.0"}

For detailed rollback instructions, see:

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