Performance and reliable data layers for developers who'd rather spend their time building apps than managing databases.
compose-broker is a Compose.io service broker for Cloud Foundry and Kubernetes
It supports databases and services such as:
- π PostgreSQL
- π¬ MySQL
- π» RethinkDB
- π ScyllaDB (Cassandra)
- π· Elasticsearch
- π¦ Redis
- π etcd
- π RabbitMQ
- create an API Token on your Compose.io account
- pick a Cloud Foundry provider. I'd suggest the Swisscom AppCloud
- push the app, providing the API key and a username/password to secure the service broker with
- register the service broker in your space (
--space-scoped
) - check
cf marketplace
to see your new available service plans
- create a new service instance (
cf cs
) - bind the service instance to your app (
cf bs
), or create a service key (cf csk
) - inspect the service binding/key, have a look at the credentials (
cf env
/cf sk
) - use the given credentials to connect to your new database
- enjoy!
All configuration of the service broker is done through environment variables (provided by manifest.yml
during a cf push
) and the included catalog.yml
.
Possible configuration values are:
BROKER_LOG_LEVEL: info # optional, can be set to debug, info, warning, error or fatal, defaults to info
BROKER_LOG_TIMESTAMP: false # optional, add timestamp to logging messages (not needed when deployed on Cloud Foundry), defaults to false
BROKER_SKIP_SSL_VALIDATION: false, # optional, disables SSL certificate verification for API calls, defaults to false
BROKER_AUTH_USERNAME: broker-username # required, HTTP basic auth username to secure service broker with
BROKER_AUTH_PASSWORD: broker-password # required, HTTP basic auth password to secure service broker with
BROKER_CATALOG_FILENAME: catalog.yml # optional, filename containing all catalog information, defaults to catalog.yml
COMPOSE_API_URL: https://api.compose.io/2016-07/ # optional, Base URL of Compose.io API, defaults to https://api.compose.io/2016-07
COMPOSE_API_TOKEN: e7fb89a0-26f8-4ee5-890e-3c68079b15ea # required, Compose.io API Token
COMPOSE_API_DEFAULT_DATACENTER: gce:europe-west1 # optional, defaults to aws:eu-central-1
COMPOSE_API_DEFAULT_ACCOUNT_ID: 586eab527c65836dde5533e8 # optional, service broker will try to read it from Compose.io API if not set
The service brokers provided catalog.yml
configures all available services offerings and plans. (See OSBAPI spec)
Adjust this file to define your own different service plans with different deployment sizes / units. A plan's metadata allows for optionally configuring custom unit sizes, enabling/disabling Redis' cache mode, specifying explicit software versions or the datacenter to host the deployment.
Review the included Redis example plans for these properties:
Lines 19 to 59 in f7331ef
metadata:
# Number of resource units to allocate to the deployment (optional, defaults to 1)
units: 2
# Whether to optimize the deployment to be used as a cache (optional, Redis only)
cache_mode: true
# Version of the software to deploy (optional)
version: "4.0.14"
# Datacenter to use for deployment (optional, defaults to $COMPOSE_API_DEFAULT_DATACENTER)
datacenter: aws:eu-central-1
By default the service broker will provision new database deployments with the configured account id COMPOSE_API_DEFAULT_ACCOUNT_ID
and datacenter COMPOSE_API_DEFAULT_DATACENTER
(see manifest.yml
).
If no account id is configured it will try to read the value over the Compose.io API and take the first account it finds.
Similarly if no datacenter is configured it will use aws:eu-central-1
as default value.
When issuing service provisioning requests to the service broker it is possible to provide the account id and/or the datacenter as additional parameters.
cf create-service etcd default my-etcd -c '{
"account_id": "454f3deb8cad236ffb3452e9",
"datacenter": "gce:europe-west1"
}'
When issuing service provisioning requests to the service broker it is also possible to request a specific unit size (which basically determines the scaling for your Compose.io deployments, memory and disk space) instead of the configured value in the service brokers catalog.yml
.
It is also possible to update existing service instances with cf update-service
.
cf create-service scylla default my-scylla-db -c '{ "units": 10 }'
# or
cf update-service my-postgres-db -c '{ "units": 4 }'
Last but not least it is also possible during service provisioning to request specific software versions for your database deployments. You can get all available versions from the Compose.io API: https://api.compose.io/2016-07/databases
cf create-service rethink default my-rethinkdb -c '{ "version": "2.3.7" }'