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 myenv
After 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:
genesis do myenv bind-scheduler
This registers the scheduler service with your Cloud Foundry, making it available in the marketplace.
-
Verify Deployment with Smoke Tests:
genesis do myenv smoke-tests
This runs tests to verify that the scheduler is working properly.
After setting up the service broker, you can:
-
Create a service instance:
cf create-service scheduler dedicated my-scheduler
-
Create service keys for application access:
cf create-service-key my-scheduler my-scheduler-key cf service-key my-scheduler my-scheduler-key
-
Bind applications to use the scheduler:
cf bind-service my-app my-scheduler
-
Use the scheduler in your application by referencing the service binding credentials.
-
Schedule tasks using the CF CLI plugin:
cf schedule-job my-app "my-task" "0 * * * *" cf schedule-job my-app "my-task" --command "rake cleanup"
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: 40
The log level defaults to info
and can be set using the log_level
param:
params:
log_level: debug
The 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.