A Go application for monitoring REST API endpoints on a schedule, making decisions based on response data, and providing a web interface for visualization and control.
- π Scheduled API Calls: Execute REST API requests on configurable cron schedules
- π Web Dashboard: Real-time visualization of API call results and status
- βοΈ Configurable Endpoints: YAML-based configuration for easy endpoint management
- π― Rule Engine: Define conditions and actions based on API responses
- π³ Docker Support: Multi-platform Docker images (linux/amd64, linux/arm64)
- π CI/CD Ready: GitHub Actions workflow for automated testing and builds
- πͺ Cross-Platform: Runs on macOS, Linux (Ubuntu Server, etc.)
- Go 1.21+ (for local development)
- Docker & Docker Compose (for containerized deployment)
# Using Homebrew
brew install go
# Verify installation
go version# Download and install
wget https://go.dev/dl/go1.21.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
# Add to PATH (add to ~/.profile or ~/.bashrc)
export PATH=$PATH:/usr/local/go/bin
# Verify installation
go version# Clone the repository
git clone <your-repo-url>
cd axeos-regulator
# Install dependencies
go mod download
# Run the application
go run main.go
# Or use Make
make runThe web interface will be available at http://localhost:8080
# Using Docker Compose (recommended)
docker-compose up -d
# Or build and run manually
docker build -t axeos-regulator .
docker run -p 8080:8080 -v $(pwd)/config.yaml:/root/config.yaml axeos-regulatorEdit config.yaml to configure your API endpoints:
endpoints:
- name: "My API Health Check"
url: "https://api.example.com/health"
method: "GET"
schedule: "*/5 * * * *" # Every 5 minutes
headers:
Authorization: "Bearer YOUR_TOKEN"
rules:
- name: "Check Status"
condition: "status_code_not_200"
action: "log_alert"The schedule uses standard cron syntax:
ββββββββββββββ minute (0 - 59)
β ββββββββββββββ hour (0 - 23)
β β ββββββββββββββ day of month (1 - 31)
β β β ββββββββββββββ month (1 - 12)
β β β β ββββββββββββββ day of week (0 - 6) (Sunday to Saturday)
β β β β β
* * * * *
Examples:
*/5 * * * *- Every 5 minutes0 * * * *- Every hour0 0 * * *- Daily at midnight0 9-17 * * 1-5- Every hour 9am-5pm, Monday-Friday*/15 9-17 * * 1-5- Every 15 minutes during business hours
Built-in conditions:
status_code_not_200- HTTP status is not 200status_code_error- HTTP status >= 400has_error- Request encountered an error
axeos-regulator/
βββ main.go # Application entry point
βββ go.mod # Go module definition
βββ config.yaml # Configuration file
βββ Dockerfile # Docker image definition
βββ docker-compose.yml # Docker Compose setup
βββ Makefile # Build automation
βββ internal/
β βββ config/ # Configuration management
β β βββ config.go
β βββ scheduler/ # API scheduler & executor
β β βββ scheduler.go
β βββ web/ # Web server & UI
β βββ server.go
βββ .github/
βββ workflows/
βββ ci.yml # GitHub Actions CI/CD
The web server exposes several REST endpoints:
GET /- Web dashboardGET /api/results- JSON of all resultsPOST /api/execute/{name}- Execute endpoint immediatelyGET /api/config- View current configurationGET /health- Health check endpoint
make help # Show all available commands
make build # Build the application
make run # Run the application
make test # Run tests
make clean # Clean build artifacts
make docker # Build Docker image
make docker-run # Run with Docker Compose
make build-all # Build for all platforms# Run all tests
go test -v ./...
# Run tests with coverage
go test -v -race -coverprofile=coverage.txt ./...
# View coverage
go tool cover -html=coverage.txt# Linux (amd64)
GOOS=linux GOARCH=amd64 go build -o axeos-regulator-linux-amd64
# Linux (arm64) - for Raspberry Pi, AWS Graviton, etc.
GOOS=linux GOARCH=arm64 go build -o axeos-regulator-linux-arm64
# macOS (Intel)
GOOS=darwin GOARCH=amd64 go build -o axeos-regulator-darwin-amd64
# macOS (Apple Silicon)
GOOS=darwin GOARCH=arm64 go build -o axeos-regulator-darwin-arm64
# Or use Make
make build-allThe project includes a CI/CD pipeline that:
- Tests: Runs on every push and PR
- Builds: Creates binaries for multiple platforms
- Docker: Builds multi-platform Docker images
- Release: Automatically publishes on GitHub releases
To enable automatic Docker image publishing:
- Create Docker Hub account and repository
- Add GitHub repository secrets:
DOCKER_USERNAME: Your Docker Hub usernameDOCKER_PASSWORD: Your Docker Hub token/password
# Download the binary
wget https://github.com/yourusername/axeos-regulator/releases/latest/download/axeos-regulator-linux-amd64
# Make executable
chmod +x axeos-regulator-linux-amd64
# Create config
nano config.yaml
# Run
./axeos-regulator-linux-amd64 -config config.yaml -port 8080Create /etc/systemd/system/axeos-regulator.service:
[Unit]
Description=Axeos Regulator API Monitor
After=network.target
[Service]
Type=simple
User=axeos
WorkingDirectory=/opt/axeos-regulator
ExecStart=/opt/axeos-regulator/axeos-regulator -config /opt/axeos-regulator/config.yaml
Restart=on-failure
[Install]
WantedBy=multi-user.targetsudo systemctl enable axeos-regulator
sudo systemctl start axeos-regulator
sudo systemctl status axeos-regulator./axeos-regulator -h
Options:
-config string
Path to configuration file (default "config.yaml")
-port string
Web server port (default "8080")Key differences in Go:
- No classes: Go uses structs and interfaces instead
- Explicit error handling: No try/catch, functions return errors
- Goroutines: Lightweight threads using
go func() - Channels: Built-in message passing between goroutines
- No package manager like npm: Go modules are built-in (
go.mod) - Static typing: All types are explicit
- Compiled: Single binary, no runtime needed
- Fast: Compiles and runs very quickly
MIT License - see LICENSE file for details
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request