This directory contains the packaging infrastructure for building the Distributed Regional Check Agent as .deb packages for Linux distributions.
# Build for all architectures (AMD64 and ARM64)
./build.sh
# Build for specific architecture
./build.sh amd64
./build.sh arm64
# Install the package
sudo dpkg -i build/distributed-regional-check-agent_1.0.0_amd64.debpackaging/
├── control # Debian package metadata
├── postinst # Post-installation script
├── prerm # Pre-removal script
├── postrm # Post-removal script
├── regional-check-agent.service # Systemd service file
└── regional-check-agent.conf # Default configuration template
make build- Build binary for current architecturemake build-amd64- Build binary for AMD64make build-arm64- Build binary for ARM64make deb- Create .deb package for current architecturemake deb-amd64- Create .deb package for AMD64make deb-arm64- Create .deb package for ARM64make deb-all- Create .deb packages for both architecturesmake clean- Clean build artifactsmake install- Install the package
The build.sh script provides a convenient wrapper:
./build.sh # Build for all architectures
./build.sh amd64 # Build only for AMD64
./build.sh arm64 # Build only for ARM64- Linux distribution with systemd
- libc6 (>= 2.17)
- ca-certificates
-
Install the package:
sudo dpkg -i distributed-regional-check-agent_1.0.0_amd64.deb
-
Configure the agent (REQUIRED):
sudo nano /etc/regional-check-agent/regional-check-agent.env
Set these required variables:
REGION_NAME=your-region-name AGENT_ID=your-unique-agent-id AGENT_IP_ADDRESS=your-agent-ip POCKETBASE_URL=http://your-pocketbase-server:8090
-
Enable and start the service:
sudo systemctl enable regional-check-agent sudo systemctl start regional-check-agent -
Verify the installation:
sudo systemctl status regional-check-agent curl http://localhost:8091/health
| Variable | Description | Required | Default |
|---|---|---|---|
REGION_NAME |
Name of the monitoring region | Yes | - |
AGENT_ID |
Unique identifier for this agent | Yes | - |
AGENT_IP_ADDRESS |
IP address of this agent | Yes | - |
POCKETBASE_URL |
PocketBase server URL | Yes | http://localhost:8090 |
PORT |
Port for the agent API | No | 8091 |
CHECK_INTERVAL |
Monitoring check interval | No | 30s |
- Service config:
/etc/regional-check-agent/regional-check-agent.env - Systemd service:
/etc/systemd/system/regional-check-agent.service - Working directory:
/var/lib/regional-check-agent - Log directory:
/var/log/regional-check-agent
# Start the service
sudo systemctl start regional-check-agent
# Stop the service
sudo systemctl stop regional-check-agent
# Restart the service
sudo systemctl restart regional-check-agent
# Check service status
sudo systemctl status regional-check-agent
# View logs
sudo journalctl -u regional-check-agent -f
# Enable auto-start
sudo systemctl enable regional-check-agent
# Disable auto-start
sudo systemctl disable regional-check-agentThe agent provides a health check endpoint:
curl http://localhost:8091/healthGET /health- Health checkPOST /operation- Perform monitoring operationsGET /operation/quick- Quick operation test
The package implements several security measures:
- Dedicated user: Runs as
regional-check-agentuser - Systemd hardening: Multiple security restrictions enabled
- File permissions: Proper ownership and permissions
- Network isolation: Only necessary network access
- No privilege escalation: NoNewPrivileges enabled
-
Service won't start
- Check configuration:
sudo systemctl status regional-check-agent - Verify environment variables are set correctly
- Check logs:
sudo journalctl -u regional-check-agent
- Check configuration:
-
Permission denied errors
- Ensure proper file ownership:
sudo chown -R regional-check-agent:regional-check-agent /var/lib/regional-check-agent
- Ensure proper file ownership:
-
Network connectivity issues
- Verify PocketBase URL is accessible
- Check firewall settings
- Test with curl:
curl http://your-pocketbase-url/api/health
- Systemd logs:
sudo journalctl -u regional-check-agent - Application logs:
/var/log/regional-check-agent/(if file logging is enabled)
# Remove package but keep configuration
sudo dpkg -r distributed-regional-check-agent
# Remove package and all configuration
sudo dpkg --purge distributed-regional-check-agent# Clone and build
git clone <repository>
cd micro-services/distributed-regional-check-agent
./build.sh# Run tests
make test
# Test installation
make install- Package name:
distributed-regional-check-agent - Version:
1.0.0 - Architectures:
amd64,arm64 - Dependencies:
libc6 (>= 2.17),ca-certificates - Service name:
regional-check-agent - Binary location:
/usr/bin/distributed-regional-check-agent