8

What is the difference between the concepts of service/user provided service and apps in Cloud Foundry? After all both expose URLs

So when is it recommended to create a service and when an app?

data_henrik
  • 16,724
  • 2
  • 28
  • 49
John Jerrby
  • 1,683
  • 7
  • 31
  • 68
  • Many services expose URLs but there is no requirement that they do so. A service could expose credentials and connection values as discrete values like host, port, username, and password instead of a URL. Or a service could provide no connection details or credentials at all (e.g. a non-bindable service that only provisions resources). – Scott Frederick Jan 02 '17 at 16:17

2 Answers2

11

The app sits on top of the stack and often has a user-interface. It consumes services (is built on services). The Cloud Foundry app typically runs in the browser and is accessible via an URL. There are apps that have no route (not an accessible URL).

A service provides consumable functionality. It also has an URL, so that apps or other services can reach it. A typical service is a database or a bot / conversation / dialog service, a map or some sign-on / password service.

To make it more fun, there are services that wrap an app and make the app's functionality accessible via an URL. I would recommend reading the Cloud Foundry overview or Bluemix overview. You may also want to check out some samples here or here that demonstate how apps are built on services.

To answer the part about when to build a service or an app:
- Is the functionality for an end-user? Does it have a user interface? => app
- Is it going to be used by another app or service? => service

data_henrik
  • 16,724
  • 2
  • 28
  • 49
  • Thanks 1+ what is the use case of app without accesible URL ? – John Jerrby Jan 02 '17 at 16:21
  • in addtion As app is scoped to space, what about service to space 1. service - if I implement service (using service broker api ) in dev space does it visible in qa space 2 . user provided servcie - same question thanks – John Jerrby Jan 02 '17 at 16:23
  • I added a link to the "no route" section. That could be daemon apps, apps running in the background. Open another topic for your follow-up questions. – data_henrik Jan 02 '17 at 17:40
  • I would also add that services typically have some sort of persistent state or data. For example, a MySQL DB stores your data. Apps in CF don't, or shouldn't, have persistent state. They should bind with a service and use it to persist their data. – Daniel Mikusa Jan 03 '17 at 13:20
1

One way to consider this is by looking at it from a dependency perspective:

Applications typically depend on services such as databases or third-party SaaS providers. When a developer provisions and binds a service to an application, the service broker for that service is responsible for providing the service instance.

Source: https://docs.cloudfoundry.org/concepts/architecture/#services

On the flip side, services don't tend to depend on applications.

Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
  • Thanks 1+ , As app is scoped to space, what about service to space 1. service - if I implement service (using service broker api ) in dev space does it visible in qa/space 2 . user provided servcie - same questio – John Jerrby Jan 02 '17 at 16:23
  • I'm not sure of the answer - It may be worth posting a new question about this. – Chris Snow Jan 02 '17 at 16:26