Service is one of the important factor in recommended 12 factor apps also a commonly used feature in cloud application deployment. Services has to be attached to resources either in the local or in production environment. Cloud Foundry build up on that idea where resource and provides the service instances. The basic idea what we have here is,
On-demand resources = Services
We can manage application services in two ways by using CF CLI and another is form marketplace. Marketplace helps you to use readily available services in Pivotal Cloud Foundry. You simply go to services tab in the Cloud Foundry or Marketplace to look services available. Assume that you want to see MySQL database in Cloud Foundry that locates in Marketplace. As on when you bind that service, you have service ready to use. This is also called as Provisioning.
Cloud Foundry services uses a provisions as a service. There is a command for managing services of application. That is, CF SERVICE command. There are two types of service instances,
Manage Service Instance
User provided Service Instance
Manage Service Instance: An instance which is created from the marketplace service is called as Manage service instance. which all services available in market place to bind with our application, these type of services called as managed services. As part of this, we use only create-service and bind-service commands to create and bind service with our application.
User provided Service Instance: An instance which is created from the user provided service is called as User provided service instance. The services which are not present in marketplace and created by the user is called as User provided services. To create user provided service, we use the command called create-user-provided-service. This command also has the alias name called as cups.
List of Service Commands:
Many service instances are advance that we use in Cloud Foundry itself. Such as the MySQL etc. These services are using Service Broker API to implement their all services. Cloud Foundry Marketplace advertise these all services and shows you all available services you can use.
As on when we select a service there will be options shows start, shutdown and bind. These are manage by Service Broker APIs. Once we can get the instance of manage broker API, we can use of it in our applications through binding. We can use CF BIND command in our manifest file.
So, when we pushed our application into Cloud Foundry, that service will be bind to our application. After that we can start using immediately. We can insert data, pull data and so on, it is a database instance.
Will definitely have demonstration of both the sides like managed and user defined services. User defined services are advance that we can provide to our applications and actual user seemly like to case in the manage services. Let’s assume that we have some environment variables that other people or application developers to use. So, we can create a User defined service and provide your variables through it. It works just like the manage services, so you can manifest to bind it to application or simply go to dashboard and bind it manually with the application.
Multiple Deployment Options:
There are couple of deployment options we have in Cloud Foundry which we can make use of it. So for service to be available for binding on the requirement is that, it should implement Service Broker API.
So assume that, we want to have a service definition, which goes into category of user defined service. We can simply attach that service as a resource to our application or for the other service deployment options, we can have our service defined and deployed in Cloud Foundry. Cloud Foundry platform is really flexible allowing use to know how we want it.