This kit allows you to deploy the OCF Scheduler service for Cloud Foundry, which enables applications to schedule tasks to run at specified times.
- Scheduler Service: Deploys the OCF Scheduler API and configurable number of workers
- Database Options:
- Internal PostgreSQL database (default, colocated)
- External PostgreSQL database (configurable via parameters or vault)
- CF Integration:
- Automatic route registration with your Cloud Foundry deployment
- Service broker for application integration
- Operations:
- Smoke tests to verify deployment functionality
- CF CLI plugin setup for direct interaction with the scheduler
- A running Cloud Foundry deployment created with Genesis
- Vault for credential management
- BOSH director with sufficient resources
- Genesis v3.1.0 or later
# create a scheduler-deployments repo using the latest version of the scheduler kit
genesis init --kit ocf-scheduler
# OR specify a specific version
genesis init --kit ocf-scheduler/1.0.0# Create a new environment file
cd scheduler-deployments
genesis new myenv# Deploy your environment
genesis deploy myenvAfter deploying the scheduler, you'll need to:
-
Install CF CLI Scheduler Plugin:
genesis do myenv setup-cf-plugin [-f]This adds the OCF scheduler plugin to your CF CLI.
-
Register and Configure Service Broker(Not Yet Implemented):⚠️ Note: Thebind-scheduleraddon is currently disabled. The upstream OCF Scheduler application does not implement the Cloud Foundry Service Broker API. Use the scheduler directly via the CF CLI plugin commands instead. -
Verify Deployment with Smoke Tests:
genesis do myenv smoke-testsThis runs tests to verify that the scheduler is working properly.
After setting up the CLI plugin, you can schedule jobs directly:
-
Create a job:
cf create-job my-app my-job-name "rake db:migrate" -
Schedule the job with a cron expression:
cf schedule-job my-job-name "0 2 * * *" # Run daily at 2 AM
-
List all jobs:
cf jobs -
View job schedules:
cf job-schedules
-
Run a job immediately:
cf run-job my-job-name
-
View job execution history:
cf job-history my-job-name
For more detailed usage instructions, please see the MANUAL.md file.
By default, an internal (colocated) PostgreSQL database is deployed. You can configure an external PostgreSQL database in two ways:
Add credentials to vault:
safe set secret/myenv/ocf-scheduler/db \
hostname="my-database-host.example.com" \
port="5432" \
username="scheduler" \
password="superSecretPassword" \
scheme="postgres://" \
sslmode="disable" \
database="scheduler"Add the following to your environment file:
params:
pg_scheme: "postgres://"
pg_username: "scheduler"
pg_password: "superSecretPassword"
pg_hostname: "my-database-host.example.com"
pg_port: "5432"
pg_sslmode: "disable"
pg_database: "scheduler"By enabling the cf-route-registrar feature, the kit will extract CF deployment information required to register the scheduler API with CF at scheduler.<cf_system_domain>.
The number of workers defaults to 10 and can be set using the worker_count param:
params:
worker_count: 40The log level defaults to info and can be set using the log_level param:
params:
log_level: debugThe scheduler service is golang-based and requires:
- Sufficient CPU resources (recommended: 2 dedicated cores)
- If using internal postgres (default), allocate additional resources for PostgreSQL
- Default VM and disk types can be overridden using the following parameters:
params:
vm_type: "medium"
disk_type: "medium"
network: "cf-services"
availability_zones: ["z1", "z2"]For more detailed information, please refer to:
- MANUAL.md - Detailed usage instructions
- docs/ - Additional documentation for specific features
- Official OCF Scheduler Documentation
For troubleshooting common issues, see the Troubleshooting Guide.