CI/CD Workflows
CI/CD Workflows¶
Back to Home
This document describes the GitHub Actions workflows that automate building worker binaries and deploying the ByteBiota server. These workflows provide automated CI/CD capabilities for both development and production releases.
Overview {#overview}¶
ByteBiota uses two main GitHub Actions workflows to automate the build and deployment process:
- Build Worker Workflow - Creates cross-platform worker binaries for distribution
- Deploy Workflow - Deploys the server to production environments
Both workflows support both automatic triggers (via git tags) and manual dispatch for flexibility in development and release processes.
Build Worker Workflow {#build-worker-workflow}¶
File: .github/workflows/build-worker.yml
Purpose: Builds standalone worker binaries for Linux, macOS, and Windows platforms
Triggers {#build-worker-triggers}¶
The workflow runs automatically on:
- Tag pushes matching patterns:
worker-v*(e.g.,worker-v2025.01.15)worker/v*(e.g.,worker/v2025.01.15)-
v*(e.g.,v2025.01.15) -
Manual dispatch via GitHub Actions UI with optional inputs:
version: Override the worker version (e.g.,2025.02.14.1)server_url: Server URL baked into the binary (default:https://www.bytebiota.com)
Build Matrix {#build-matrix}¶
The workflow builds for multiple platforms in parallel:
| Platform | OS | Architecture | Python Version |
|---|---|---|---|
| Linux | ubuntu-latest | amd64 | 3.11 |
| macOS | macos-latest | amd64 | 3.11 |
| Windows | windows-latest | amd64 | 3.11 |
Build Process {#build-process}¶
Each platform build follows these steps:
- Checkout code - Gets the latest source code
- Setup Python - Installs the specified Python version
- Cache dependencies - Caches pip downloads for faster builds
- Install dependencies - Installs requirements.txt and PyInstaller
- Resolve metadata - Determines version and server URL from inputs or git tags
- Build binary - Runs
python scripts/build_worker.py --profile release - Upload artifacts - Uploads built binaries and archives
Version Resolution {#version-resolution}¶
The workflow automatically determines the version using this priority:
- Manual input - If
versionis provided via workflow_dispatch - Git tag parsing - Extracts version from tag name:
worker-v1.2.3β1.2.3worker/v1.2.3β1.2.3v1.2.3β1.2.3- Default - Falls back to empty string if no version found
Server URL Configuration {#server-url-config}¶
The server URL is determined by:
- Manual input - If
server_urlis provided via workflow_dispatch - Default - Uses
https://www.bytebiota.com
Output Artifacts {#build-artifacts}¶
Each successful build produces:
- Binary distribution in
dist/bytebiota-worker-{version}-{platform}-{arch}/ - Archive files in
releases/: - Linux/macOS:
bytebiota-worker-{version}-{platform}-{arch}.tar.gz - Windows:
bytebiota-worker-{version}-windows-amd64.zip - Checksums for integrity verification
Artifacts are uploaded to GitHub Actions and available for download for 90 days.
Deploy Workflow {#deploy-workflow}¶
File: .github/workflows/deploy.yml
Purpose: Deploys the ByteBiota server to production environments
Triggers {#deploy-triggers}¶
The workflow runs automatically on:
- Tag pushes matching patterns:
release/server-*(e.g.,release/server-2025.01.15)-
server-v*(e.g.,server-v2025.01.15) -
Manual dispatch via GitHub Actions UI with optional input:
ref: Git reference (branch or tag) to deploy (defaults to current ref)
Required Configuration {#deploy-config}¶
The workflow requires these GitHub repository secrets:
| Secret | Description | Example |
|---|---|---|
DEPLOY_KEY |
SSH private key for server access | -----BEGIN OPENSSH PRIVATE KEY-----... |
DEPLOY_USER |
Username for SSH connection | bytebiota |
DEPLOY_HOST |
Server hostname or IP address | prod.bytebiota.com |
And this repository variable:
| Variable | Description | Example |
|---|---|---|
DEPLOY_PATH |
Target directory on server | /opt/bytebiota |
Deployment Process {#deployment-process}¶
The deployment follows these steps:
- Checkout code - Gets the specified git reference
- SSH setup - Configures SSH key and known hosts
- Sync code - Uses rsync to transfer files to server
- Install dependencies - Sets up Python virtual environment and installs packages
- Restart service - Restarts the systemd service
Code Synchronization {#code-sync}¶
The rsync command excludes these directories/files:
.git- Git repository data.github- GitHub Actions workflows__pycache__- Python cache files.env*- Environment files*.env- Environment filesdata/- Runtime datalogs/- Log files*.pyc- Python bytecode.pytest_cache- Test cache*.egg-info- Python package inforeleases/- Release artifactscheckpoints/- Checkpoint data
Service Management {#service-management}¶
The deployment assumes a systemd service named bytebiota is configured on the target server. The workflow:
- Installs dependencies in a virtual environment
- Installs the package in development mode (
pip install -e .) - Restarts the service with
sudo systemctl restart bytebiota
Usage Examples {#usage-examples}¶
Triggering Worker Builds {#trigger-worker-builds}¶
Automatic Build via Tag¶
# Create and push a tag to trigger automatic build
git tag worker-v2025.01.15
git push origin worker-v2025.01.15
# Or use a generic version tag
git tag v2025.01.15
git push origin v2025.01.15
Manual Build with Custom Parameters¶
- Go to GitHub Actions β "Build worker artifacts"
- Click "Run workflow"
- Fill in optional parameters:
- Version:
2025.01.15.1 - Server URL:
https://staging.bytebiota.com - Click "Run workflow"
Triggering Server Deployments {#trigger-server-deployments}¶
Automatic Deployment via Tag¶
# Create and push a server release tag
git tag release/server-2025.01.15
git push origin release/server-2025.01.15
# Or use server version tag
git tag server-v2025.01.15
git push origin server-v2025.01.15
Manual Deployment of Specific Branch¶
- Go to GitHub Actions β "Deploy ByteBiota"
- Click "Run workflow"
- Fill in optional parameter:
- Ref:
feature/new-feature(branch name) orcommit-hash - Click "Run workflow"
Downloading Build Artifacts {#download-artifacts}¶
- Go to GitHub Actions β "Build worker artifacts"
- Click on a successful workflow run
- Scroll to "Artifacts" section
- Download the platform-specific archive:
bytebiota-worker-linux-amd64for Linuxbytebiota-worker-macos-amd64for macOSbytebiota-worker-windows-amd64for Windows
Troubleshooting {#troubleshooting}¶
Build Failures {#build-failures}¶
Common issues:
- Dependency installation fails
- Check that
requirements.txtis valid -
Verify PyInstaller compatibility with Python 3.11
-
Version resolution fails
- Ensure tag names match expected patterns
-
Check that manual version input is valid
-
Platform-specific build errors
- Review build logs for platform-specific issues
- Test build script locally on target platform
Deployment Failures {#deployment-failures}¶
Common issues:
- SSH connection fails
- Verify
DEPLOY_KEYsecret is correctly formatted - Check that
DEPLOY_HOSTis accessible -
Ensure SSH key has proper permissions
-
Permission denied errors
- Verify
DEPLOY_USERhas sudo access for service restart -
Check that
DEPLOY_PATHis writable by the user -
Service restart fails
- Ensure systemd service
bytebiotaexists - Check service configuration and dependencies
- Verify virtual environment setup
Debugging Workflows {#debugging}¶
- Enable debug logging - Add
ACTIONS_STEP_DEBUG: trueto workflow secrets - Check workflow logs - Review detailed logs in GitHub Actions UI
- Test locally - Run build script locally to isolate issues
- Verify secrets - Ensure all required secrets are properly configured
Security Considerations {#security}¶
Build Security {#build-security}¶
- No secrets in build - Worker binaries don't contain sensitive information
- Version verification - Use checksums to verify binary integrity
- Source validation - Only build from trusted git references
Deployment Security {#deployment-security}¶
- SSH key management - Use dedicated deployment keys with minimal permissions
- Network security - Deploy over secure connections (SSH)
- Access control - Limit deployment user permissions to necessary operations
- Audit trail - GitHub Actions provides complete deployment history
Best Practices {#best-practices}¶
Tagging Strategy {#tagging-strategy}¶
- Worker releases: Use
worker-v{version}for worker-specific releases - Server releases: Use
release/server-{version}for server deployments - Generic releases: Use
v{version}for combined releases - Semantic versioning: Follow semantic versioning (e.g.,
2025.01.15)
Release Process {#release-process}¶
- Test locally - Verify builds work on target platforms
- Create release branch - Use dedicated branches for releases
- Tag appropriately - Use descriptive tag names
- Monitor deployment - Watch workflow execution and logs
- Verify deployment - Test deployed services after completion
Maintenance {#maintenance}¶
- Regular updates - Keep GitHub Actions and dependencies updated
- Monitor usage - Track runner minutes and optimize workflows
- Documentation - Keep this documentation current with workflow changes
- Testing - Test workflow changes in development before production use
Related Documentation {#related}¶
- Deployment Guide - Complete deployment instructions
- Worker Build Process - Detailed build process documentation
- Environment Configuration - Environment variables and configuration
- Runtime Operations - Production operations and monitoring