Project Configuration in CelerBuild
Project configuration can be managed by different roles depending on your CelerBuild version:
Standard Version
- Administrators: Full control over all project configurations
Pro Version
- Administrators: Full access to all project configurations
- Space Owners: Can configure projects within their spaces
- Project Owners: Can configure their own projects
CelerBuild project configuration consists of four main sections: Project Information, Repository Settings, Deployment Configuration, and Deployment Commands. This guide will help you understand and set up each section effectively.
Quick Start with Project Templates
CelerBuild provides example project templates for quick setup. You can import these templates to get started:
Available Templates
- Java Example (opens in a new tab)
- Python Example (opens in a new tab)
- Node.js Example (opens in a new tab)
- Go Example (opens in a new tab)
- PHP Example (opens in a new tab)
Each template includes:
- Development environment configuration
- Production environment configuration
- Pre-deployment and post-deployment commands
- Build commands examples
Configuration Overview
Space Selection
- Standard Version:
- Use the 'default' space.
- Pro Version:
- Create and manage multiple spaces.
- Organize projects by team or department.
1. Project Information
Basic information about your project:
-
Project Name
- Enter a unique, descriptive name
- Used to identify your project in CelerBuild
-
Environment
- Select deployment environment (dev, staging, production)
- Helps organize and manage different deployment stages
2. Repository Settings
Configure your source code repository settings:
-
Git Repository
- Enter your project's Git repository URL
- Supports GitHub, GitLab, Bitbucket, and other Git platforms
-
Branch/Tag Settings
- Branch: Specify which branches to use
- Tag: Set the number of latest tags to display
Note: Limiting branches/tags improves synchronization efficiency
3. Deployment Configuration
Set up your deployment environment:
-
Deployment User
- Specify user account for deployment execution
- Must exist on all cluster servers
- Requires necessary permissions
-
Target Deployment Path
- Specify the server path for project deployment
- Example:
/var/www/myapp
-
Target Deploy Warehouse Path
- Define storage location for project packages
- Example:
/var/repositories/myapp
-
Version Retention
- Set number of project versions to retain
- Helps manage disk space and rollback options
-
Server Cluster
- Pro Version:
- Choose a deployment server cluster.
- Server clusters must be imported into the current space resources to be selectable.
- Manage multiple servers as a single unit.
- Standard Version:
- Select server clusters from global options, as space resources management is not available.
- Manage multiple servers as a single unit.
- Pro Version:
4. Deployment Commands
Built-in Variables
CelerBuild provides several built-in variables for deployment commands:
Variable | Description | Source |
---|---|---|
${DEPLOY_USER} | User account for deployment execution, configured in project settings | From: Deployment Configuration > Deployment User |
${TARGET_DEPLOYMENT_PATH} | Base deployment path on target server | From: Deployment Configuration > Target Deployment Path |
${TARGET_DEPLOYMENT_PROJECT_NAME} | System-generated project directory name (format: project_[ID]) | System Generated: project_[ProjectID] |
${LOCAL_PACKAGE_FILE} | System-generated package filename (Note: Only valid in build commands) | See Note below |
${TASK_ID} | Current deployment task ID | System Generated |
${VERSION_COMMIT_HASH} | Git commit hash of current deployment | From: Git Repository |
Note:
- Package file path (
${LOCAL_PACKAGE_FILE}
) components:
- Base path: configured in local_deploy_warehouse_path
- Project folder: system generated project name
- File name: timestamp in YYYYMMDDHHMMSS format with .tar.gz extension
Configure the commands for your deployment process:
Build Commands
Example usage:
# Check the operating system type
OS=$(uname)
# Build the application
echo "Building the application..."
make build
# Change to build directory
cd build
# Create package based on OS type
if [ "$OS" = "Darwin" ]; then
# For macOS, include mac-specific options
tar --no-xattrs --no-mac-metadata -zcvf ${LOCAL_PACKAGE_FILE} *
else
# For Linux and other systems, use standard options
tar --no-xattrs -zcvf ${LOCAL_PACKAGE_FILE} *
fi
Key points about build commands:
- Keep
tar -zcvf ${LOCAL_PACKAGE_FILE} *
as the final command ${LOCAL_PACKAGE_FILE}
is a required CelerBuild variable
Pre-deployment Commands (Optional)
Commands executed before the main deployment:
Example usage:
# Define project directory path
PROJECT_DIR="${TARGET_DEPLOYMENT_PATH}/${TARGET_DEPLOYMENT_PROJECT_NAME}"
# Check if directory exists and execute stop script
if [ -d "$PROJECT_DIR" ]; then
# Change to project directory
cd "$PROJECT_DIR"
# Execute stop script
./stop.sh
else
# Print error message if directory not found
echo "Directory $PROJECT_DIR does not exist"
fi
Post-deployment Commands (Optional)
Commands executed after deployment completion:
Example usage:
# Change to project directory and execute start script
cd "${TARGET_DEPLOYMENT_PATH}/${TARGET_DEPLOYMENT_PROJECT_NAME}" && ./start.sh
Best Practices
Project Organization
- Use clear, descriptive project names
- Organize projects into appropriate spaces (Pro version)
- Maintain consistent environment naming
Repository Management
- Keep repository URLs up to date
- Limit branch/tag numbers for better performance
- Regular cleanup of unused branches and tags
Deployment Configuration
- Use appropriate deployment paths
- Set reasonable version retention limits
- Configure correct deployment user permissions
Command Configuration
- Optimize build commands for efficiency
- Test pre/post-deployment commands thoroughly
- Utilize built-in variables for consistency
Security
- Use secure repository URLs
- Implement proper user permissions
- Regular security audits of deployment scripts
Testing
- Test configuration in staging environment
- Verify all commands work as expected
- Document custom configurations