Zabbix APK Builder
Automated Alpine Linux package builder for Zabbix Agent and Proxy with CI/CD pipeline integration.
Features
- 🔄 Automatic Version Detection: Monitors Zabbix releases using official Bitbucket API
- 🏗️ Docker-based Building: Consistent, reproducible builds in isolated environment
- 🚀 CI/CD Pipeline: Full automation from version detection to package deployment
- 📦 Multi-package Support: Builds agent, proxy, and main packages
- 🧪 Automated Testing: Tests package installation in Alpine containers
- 📊 Gitea Integration: Publishes packages to your private Gitea repository
Quick Start
1. Repository Setup
# Clone this repository
git clone <your-repo-url>
cd zabbix-apk-builder
# Make build script executable
chmod +x build.sh setup-cicd.sh
2. Manual Build
# Build packages locally
./build.sh
# Packages will be in ./packages/
ls -la packages/
3. CI/CD Setup
# Run the setup script
./setup-cicd.sh
# Follow the prompts to configure GitHub secrets
Package Information
Built Packages
- zabbix-agent - Zabbix Agent only
- zabbix-proxy - Zabbix Proxy (without LDAP)
- zabbix - Main package with libraries
Current Version
- Zabbix Version: 7.4.2
- Alpine Base: 3.18
- Architecture: x86_64
Dependencies Removed
- LDAP support removed from proxy build
- Simplified configuration for smaller footprint
CI/CD Pipeline
Automatic Triggers
- Daily: Checks for new Zabbix versions at 6 AM UTC
- Push: Builds when code changes in main/test branches
- Manual: Force builds via GitHub Actions
Version Detection
Uses Zabbix Bitbucket API:
https://git.zabbix.com/rest/api/1.0/projects/ZBX/repos/zabbix/tags
Pipeline Jobs
- check-version: Detects new Zabbix releases
- update-version: Updates APKBUILD automatically
- build-packages: Builds APK packages
- publish-to-gitea: Deploys to your repository
- deploy-test: Tests installation (test branch)
Configuration
GitHub Secrets Required
GITEA_SSH_KEY # SSH private key for Gitea access
File Structure
.
├── APKBUILD # Alpine package definition
├── build.sh # Build automation script
├── Dockerfile # Build environment
├── .github/workflows/ # CI/CD pipeline
├── packages/ # Built packages
├── zabbix-agent.initd # Agent init script
├── zabbix-agent.confd # Agent config
├── zabbix-proxy.initd # Proxy init script
└── zabbix-proxy.confd # Proxy config
Usage
Install Packages
# Add repository
echo "http://gitea-repo/mbuz/Zabbix/raw/branch/main/alpine/v3.18/main" >> /etc/apk/repositories
# Update and install
apk update
apk add zabbix-agent
# Enable and start
rc-update add zabbix-agent default
rc-service zabbix-agent start
Configuration
# Configure agent
vim /etc/zabbix/zabbix_agentd.conf
# Set server IP
Server=your.zabbix.server
# Restart service
rc-service zabbix-agent restart
Development
Local Testing
# Test build locally
./build.sh
# Test in Docker
docker run --rm -it \
-v $(pwd)/packages:/packages \
alpine:3.18 sh -c "
apk add --allow-untrusted /packages/zabbix-agent-*.apk
zabbix_agentd --version
"
Branch Strategy
- main: Production releases, auto-deployed
- test: Testing and validation, no auto-deploy
Making Changes
- Create feature branch from
test - Test changes thoroughly
- Merge to
testfor CI validation - Merge to
mainfor production release
Troubleshooting
Build Issues
# Check build logs
docker logs $(docker ps -l -q)
# Manual build debug
docker run -it --rm -v $(pwd):/build alpine:3.18 sh
cd /build && ./build.sh
Version Detection
# Test API manually
curl -s "https://git.zabbix.com/rest/api/1.0/projects/ZBX/repos/zabbix/tags?limit=100" | \
jq -r '.values[].displayId' | \
grep -E '^[0-9]+\.[0-9]+\.[0-9]+
| \
sort -V | tail -1
CI/CD Issues
- Check GitHub Actions logs
- Verify SSH key permissions
- Test Gitea connectivity
- Validate APKBUILD syntax
Documentation
- CI-CD-DOCS.md: Comprehensive CI/CD documentation
- setup-cicd.sh: Setup script for CI/CD configuration
Security
- Uses SSH keys for Gitea access
- Minimal package dependencies
- Regular security updates via automated builds
- No secrets stored in repository
Contributing
- Fork the repository
- Create feature branch
- Test changes in
testbranch - Submit pull request to
main
License
This project follows the same license as Zabbix (GPL v2).
Support
For issues:
- Check troubleshooting section
- Review CI/CD logs
- Test manual build process
- Check Zabbix API connectivity
Built with ❤️ for Alpine Linux and Zabbix monitoring