Skip to content

RobustMQ Build and Package Guide

This guide covers how to build and package RobustMQ.

📦 Build Artifacts Overview

RobustMQ build process generates the following types of artifacts:

Artifact TypeFile FormatBuild CommandPurpose
Installation Package.tar.gz archivemake build / make build-fullBinary package for user download and installation
Docker ImageDocker imagemake release-dockerContainerized deployment
GitHub ReleaseOnline release pagemake releaseUser download and view releases

Artifact Details

  • .tar.gz Installation Package: Contains Rust-compiled binaries, configuration files, startup scripts, etc. Users can extract and run directly
  • Docker Image: Containerized RobustMQ application, supports Docker and Kubernetes deployment (optimized with cargo-chef dependency caching)
  • GitHub Release: Online release page, users can download installation packages through browser

🚀 Quick Start

CommandFunctionVersion SourceDescription
make buildBasic buildAuto-read from Cargo.tomlBuild current platform package (without frontend)
make build-fullFull buildAuto-read from Cargo.tomlBuild complete package with frontend
make build-version VERSION=v0.1.30Specific version buildManual specificationBuild package with specific version

Version Note: When version is not specified, all build commands automatically read the current version number from the Cargo.toml file in the project root directory.

🐳 Docker Image Build

Application Image

CommandFunctionVersion SourceDescription
make release-dockerGHCR app imageAuto-read from Cargo.tomlBuild and push to GitHub Container Registry (org=robustmq)

Version Note: The release-docker command automatically reads the version number from Cargo.toml and uses robustmq as the organization name.

🚀 Version Release

CommandFunctionVersion SourceDescription
make releaseCreate new releaseAuto-read from Cargo.tomlCreate GitHub release and upload package
make release-dockerRelease Docker imageAuto-read from Cargo.tomlBuild and push Docker image to GHCR
make release-version VERSION=v0.1.30Specific version releaseManual specificationCreate GitHub release with specific version

Prerequisites

bash
# Set GitHub Token (required)
export GITHUB_TOKEN="your_github_token_here"

Permission Note:

  • Application images are pushed to specified organization or user account
  • Ensure your GITHUB_TOKEN has write:packages permission

📦 Output Results

Build Artifacts

Artifact TypeFile LocationContent DescriptionPurpose
Installation Packagebuild/robustmq-{version}-{platform}.tar.gzCompressed binary installation packageUser download and install RobustMQ
Package Infobuild/robustmq-{version}-{platform}/package-info.txtVersion, platform, build time metadataUnderstand package details
Docker Imagerobustmq/robustmq:{version}Containerized RobustMQ application (with cargo-chef optimization)Docker deployment and running
GitHub Releasehttps://github.com/robustmq/robustmq/releases/tag/{version}Online release pageUser download and view release notes

Installation Package Structure

Directory/FileContent TypeSpecific ContentPurpose
bin/Startup scriptsrobust-server, robust-ctl, robust-benchSystem startup and management scripts
libs/Binary executablesbroker-server, cli-command, cli-benchCore Rust-compiled binary programs
config/Configuration filesserver.toml, server-tracing.tomlService configuration and logging configuration
dist/Frontend static filesHTML, CSS, JavaScript filesWeb management interface (if frontend included)
LICENSELicense fileApache 2.0 license textLegal license information
package-info.txtMetadata fileVersion, platform, build time, binary listPackage detailed information

📋 Use Cases

ScenarioCommandArtifactDescription
Development Testingmake buildLocal .tar.gz installation packageQuick build test package for local development and testing
Release Preparationmake build-fullLocal complete .tar.gz installation packageBuild complete release package with frontend for official release
Application Deploymentmake release-dockerDocker application imageBuild and push application image to GitHub Container Registry (with cargo-chef automatic dependency caching)
Version Releasemake releaseGitHub release page + installation packageCreate GitHub release and upload installation package for user download

🔧 Docker Build Optimization

cargo-chef Dependency Caching

Approach: RobustMQ uses cargo-chef for efficient dependency layer caching, eliminating the need for separate deps images.

How it works:

  1. Planner Stage: Analyzes Cargo.toml and Cargo.lock to generate dependency recipe (recipe.json)
  2. Builder Stage: Compiles dependencies from recipe first, then application code
  3. Layer Caching: Re-compiles dependencies only when Cargo.lock changes, otherwise uses cached layers

Advantages:

  • ✅ Automated dependency cache management, no manual maintenance
  • ✅ Docker native layer caching, fast builds
  • ✅ Caches only pure dependencies, excludes application code
  • ✅ Automatically updates when dependencies change, reuses cache when only app code changes

Build Acceleration Tips

Clean cache rebuild:

bash
# Clean Docker build cache
docker builder prune -f

# Rebuild image without cache
docker build --no-cache -f docker/robustmq/Dockerfile -t robustmq:latest .

Multi-stage builds:

  • Development stage: Includes debugging tools for development and debugging
  • Runtime stage: Streamlined production image with only runtime essentials

⚠️ Notes

Build Script Limitations

FeatureStatusDescription
Current system platformOnly builds for current system platform
Auto version detectionAutomatically reads version from Cargo.toml
Release mode buildUses cargo build --release
Auto frontend cloneAutomatically clones frontend code
Cross-compilationDoes not support cross-compilation

Release Script Limitations

FeatureStatusDescription
Frontend buildAlways includes frontend build
Current platformAlways builds current system platform

🔧 Environment Requirements

TypeToolPurposeRequired
BasicRust (cargo, rustup)Rust compilation✅ Required
FrontendpnpmFrontend package management🔶 Optional
FrontendgitClone frontend code🔶 Optional
DockerdockerDocker environment🔶 Optional
ReleasecurlAPI requests🔶 Optional
ReleasejqJSON parsing🔶 Optional
ReleaseGITHUB_TOKENGitHub access token🔶 Optional

🆘 Common Issues

Build Failure Troubleshooting

IssueCheck CommandSolution
Rust environment issuecargo --versionInstall Rust environment
Docker environment issuedocker infoStart Docker service
Network connection issueping github.comCheck network connection

Docker Build Failure Troubleshooting

IssueCheck CommandSolution
Docker environment issuedocker infoStart Docker service
Permission issueecho $GITHUB_TOKENSet correct GitHub Token
Network connection issuedocker pull rust:1.90.0-bookwormCheck Docker Hub connection
Image push failuredocker login ghcr.ioManually login to GitHub Container Registry

Release Failure Troubleshooting

IssueCheck CommandSolution
GitHub Token issueecho $GITHUB_TOKENSet correct Token
Token permission issuecurl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/userCheck Token permissions
Network connection issuecurl -I https://api.github.comCheck network connection

View Build Artifacts

OperationCommandDescription
View build directoryls -la build/View all build artifacts
Extract and testtar -xzf build/robustmq-*.tar.gzExtract installation package
Test binary./robustmq-*/libs/broker-server --helpTest executable files
View package infocat robustmq-*/package-info.txtView package detailed information

View Docker Images

OperationCommandDescription
View local images`docker imagesgrep robustmq`
Test imagedocker run --rm robustmq/robustmq:latest --helpTest application image
View image historydocker history robustmq/robustmq:latestView image build history
View image sizedocker images robustmq/robustmq --format "\{\{.Size\}\}"View image size