How to Use MS SQL Server with Cloud Foundry v2 (New Service Broker Available)

Sergey Marudenko

We’ve just finalized the .NET Cloud Foundry Service, a Microsoft .NET-based service broker that provides a possibility to use MS SQL Server with Cloud Foundry v2. The broker allows for easy developing and deploying Cloud Foundry services using the Microsoft technology stack. For example, you can quickly add support for unsupported databases, since you only need to implement a single interface.

Right now, the broker is distributed with one default service implementation (MS SQL Server). Below is a step-by-step video and tutorial on how to install and use it for your project.

Step-by-step tutorial

Before you start, make sure that you have the Cloud Foundry Command Line Interface. Installation instructions are available here. Alternatively, you can use the GCF client, which is a more up-to-date version of the CF tool. Then follow the steps below.

1. Installing the .NET Cloud Foundry Service Broker

  • Install the BrockerServiceSetup.exe package on your target machine.
  • Configure the network environment to make the service accessible from Cloud Foundry.
  • Update the application configuration file with proper settings (add the connection string to Microsoft SQL Server, its public address, etc.) The default configuration file is located here.
  • Re-start the service using the service console to apply all configuration changes.

2. Registering the .NET Service Broker in Cloud Foundry

  • Indicate the target cloud; select your organization and space: cf target [your cloud foundry api url]
  • Authenticate with the target Cloud Foundry login. Here you have to use an admin account with corresponding access rights.
  • View existing service-brokers: cf service-brokers
  • Register the Dot Net Cloud Foundry Service Broker in Cloud Foundry:

    cf add-service-broker TestDotNetServiceBroker --username s --password p --url [your BrokerWindowsService url]

    Registering a broker causes the cloud controller to fetch and validate catalog information from this broker and save the catalog to the cloud controller database.

  • View existing service brokers: cf service-brokers

3. Making your plan public (Before using the service, you have to register at least one service plan as public.)

  • Get the service plan GUID: cf services --marketplace –trace
  • Make the service plan public by running the following command with the service plan GUID: cf curl PUT /v2/service_plans/[plan_guid_obtained_on_previous_step] -b '{"public":'true'}'
  • To check that you plan has been successfully set to public, run this command again and see the “public” field: cf services --marketplace –trace

4. Getting your service up and running

  • Create a new service instance, choose the required service type, and set the service name and plan: cf create-service
  • Display the information about current service instances in the current space: cf services

5. Deploying and running an application with the new services

  • Change the current directory to the directory with the app you would like to deploy (the manifest file must be available)
  • Deploy the new application: cf push
  • Bind the service to the application (select the deployed application and service while the command is running): cf bind-service
  • Re-start the application: cf restart [deployed app]
  • Now the application is ready to use the new service.

6. Removing service bindings from your application

  • To remove the service binding from the application (select the deployed application and service while the command is running), use: cf unbind-service
  • To delete the service (select the deployed application and service while the command is running), use: cf delete-service

We are also planning to implement sharded deployment and reshape the cluster. Follow @altoros to get updated.

No Comments

Benchmarks and Research

Subscribe to new posts

Get new posts right in your inbox!