A lightweight, statically compiled Go microservice for scheduling and managing cron jobs with webhook capabilities.
- Cron Job Scheduling: Schedule webhooks using standard cron expressions
- Webhook Support: Execute GET and POST requests to configured endpoints
- Webhook Chaining: Save output from primary webhook and forward to secondary webhook
- Embedded Web UI: Minimalist web interface using embedded filesystem and htmx
- Light/Dark Mode: UI supports both light and dark themes
- YAML Configuration: Simple YAML-based configuration management
- Test Functionality: "Test Now" button to immediately execute any cron job
- Static Binary: Single statically compiled binary with embedded frontend
cron-microservice/
├── cmd/cron-service/ # Main application entry point
├── internal/
│ ├── config/ # YAML configuration management
│ ├── scheduler/ # Cron scheduler and webhook executor
│ └── server/ # HTTP server with embedded filesystem
├── web/
│ ├── static/ # Static assets (CSS, JS)
│ └── templates/ # HTML templates
├── go.mod # Go module definition
├── Makefile # Build automation
└── README.md # This file
- Go 1.24 or later
- Make (optional, for using Makefile)
# Clone the repository
git clone <repository-url>
cd cron-microservice
# Download dependencies
go mod download
# Build the binary
make build
# Or build manually
go build -o cmd/cron-service/bin/cron-service ./cmd/cron-service# Run with default settings (config.yaml, :8080)
./cmd/cron-service/bin/cron-service
# Specify custom configuration file and address
./cmd/cron-service/bin/cron-service -config /path/to/config.yaml -addr :9090The service uses a YAML configuration file to store cron job definitions. On first run, it will create an empty configuration file if one doesn't exist.
jobs:
- id: unique-job-id
name: "Job Name"
schedule: "* * * * *" # Standard cron format
enabled: true
description: "Optional description"
primary:
url: "https://api.example.com/webhook"
method: "POST"
headers:
Content-Type: "application/json"
Authorization: "Bearer token"
body: '{"key": "value"}'
secondary:
url: "https://api.example.com/secondary"
method: "POST"
headers:
Content-Type: "application/json"
save_output: true # Save primary output and send to secondaryThe service uses standard cron format: Minute Hour Day Month Weekday
* * * * *- Every minute0 * * * *- Every hour0 0 * * *- Daily at midnight0 0 * * 0- Weekly on Sunday0 0 1 * *- Monthly on the 1st
- URL: The endpoint to call
- Method: HTTP method (GET or POST)
- Headers: Optional HTTP headers as key-value pairs
- Body: Request body for POST requests
- URL: Second endpoint to call
- Method: HTTP method (GET or POST)
- Headers: Optional HTTP headers
When save_output: true is set:
- Primary webhook executes and response is saved
- Secondary webhook receives the saved output as its body
- Useful for processing or logging responses
The service provides a web interface at http://localhost:8080 (or your configured address).
- Job Management: Add, edit, and delete cron jobs
- Real-time Status: View job status and configuration
- Test Execution: "Test Now" button for immediate job execution
- Theme Toggle: Switch between light and dark modes
- Responsive Design: Works on desktop and mobile
- Add a Job: Click "Add Job" and fill in the form
- Edit a Job: Click "Edit" on any existing job
- Test a Job: Click "Test Now" to execute immediately
- Delete a Job: Click "Delete" and confirm
GET /api/jobs- List all jobsPOST /api/jobs- Create a new jobGET /api/jobs/{id}- Get specific jobPUT /api/jobs/{id}- Update a jobDELETE /api/jobs/{id}- Delete a jobPOST /api/jobs/test/{id}- Test execute a job
GET /- Main UI pageGET /static/*- Static assets
- Backend: Pure Go with standard library
- Frontend: Vanilla JavaScript with htmx for dynamic updates
- Styling: Custom CSS with CSS variables for theming
- Database: File-based YAML configuration (no external DB required)
# Build optimized binary
make build
# The binary is statically compiled and includes all web assets
# Copy to target system and run
./cron-service -config /path/to/config.yamlmake build- Build the binarymake run- Build and run the servicemake test- Run testsmake clean- Clean build artifactsmake fmt- Format Go codemake lint- Run linter (requires golangci-lint)make deps- Download and tidy dependenciesmake install- Install binary to /usr/local/bin
jobs:
- id: health-check
name: "Health Check"
schedule: "*/5 * * * *" # Every 5 minutes
enabled: true
primary:
url: "https://api.example.com/health"
method: "GET"jobs:
- id: daily-report
name: "Daily Report"
schedule: "0 9 * * *" # Daily at 9 AM
enabled: true
primary:
url: "https://api.example.com/reports/daily"
method: "POST"
headers:
Content-Type: "application/json"
Authorization: "Bearer your-token-here"
body: '{"type": "daily", "format": "json"}'jobs:
- id: process-and-log
name: "Process and Log"
schedule: "0 */6 * * *" # Every 6 hours
enabled: true
primary:
url: "https://api.example.com/process-data"
method: "POST"
headers:
Content-Type: "application/json"
body: '{"action": "process"}'
secondary:
url: "https://api.example.com/log-result"
method: "POST"
headers:
Content-Type: "application/json"
save_output: true- Jobs not executing: Check that jobs are enabled and schedule is correct
- Webhook failures: Verify URLs, methods, and authentication headers
- Configuration errors: Ensure YAML syntax is valid
- Port conflicts: Use
-addrflag to specify different port
The service logs to stdout. Check the console output for execution errors and webhook responses.
This project is part of the Mule AI development tools suite.