Using Stardog Service Broker for PCF

This topic describes how app developers use Stardog Service Broker for Pivotal Cloud Foundry (PCF).

Create an Instance

The Stardog Service Broker for PCF tile deploys a service broker into the PCF environment. This service broker is then used to connect PCF apps to the Stardog server or cluster.

Prerequisite: You must have admin access to a running Stardog server. For information about acquiring and running a Stardog server, see Download Stardog.

Follow the steps below to create an instance of a Stardog Service Broker for PCF service:

  1. Verify that you have the following for your pre-provisioned Stardog server:

    • The URL
    • The admin username (USERNAME)
    • The admin password (PASSWORD)
  2. On a local file system, create a JSON file with the following format:

      "url": "URL",
      "username": "USERNAME",
      "password": "PASSWORD"
    For example:
      "url": "",
      "username": "admin",
      "password": "somepassword"

    For information about how to run Stardog, see the Stardog 4: The Manual.

  3. Create a service with the following command, using the file created above as the parameter file:

    cf create-service Stardog perinstance MYSERVICE -c PATH/FILENAME.json

    Replace MYSERVICE with the name you want to identify the service in the Marketplace.
    Replace PATH/FILENAME.json with the path and name of the configuration file created above.
    For example:

    $ cf create-service Stardog perinstance stardogservice -c ~/service.json
    Creating service instance myservice in org stardog-service-broker-org / space stardog-service-broker-space as admin...

Stardog Service Broker for PCF instructs Stardog to create a new new database and associates it with the newly created PCF service instance. It is now ready to be bound to PCF apps.

Bind an App to a Service

There are a couple of ways to bind a PCF app to a service instance:

  • Use the cf bind-service command
  • Add a services stanza to the apps manifest.yml file

For general information about binding a service instance to an app, see Bind a Service Instance.

When a Stardog Service Broker for PCF service instance is bound to a PCF app, a new Stardog user is created, associated with that PCF app, and granted access to the Stardog database for the app.


After an app is bound to a service instance, the connection information and credentials are available to the PCF app in the VCAP_SERVICES environment variable. The Stardog entry has the following fields:

Field Type Description
url string The URL of the Stardog service that is bound to the app.
db_name string The Stardog database name to which the app is bound.
username string The username credential that the app can use to connect to the Stardog database.
password string The password credential that the app can use to connect to the Stardog database.

An example VCAP_SERVICES document is below:

     {"name": "stardog-service",
      "label": "Stardog",
      "tags": [],
      "plan": "shareddb",
      "credentials": {
          "db_name": "dbdbdbdbdbdbdbdbdb",
          "url": "",
          "password": "PasswordPasswordPassword",
          "username": "stardog1stardog"

Create a pull request or raise an issue on the source for this page in GitHub