|
2 | 2 | [[appendix-cloud-foundry]]
|
3 | 3 | == Running a Task App on Cloud Foundry
|
4 | 4 |
|
5 |
| -This section will discuss how to deploy a Spring Cloud Task application onto |
6 |
| -the Cloud Foundry platform. |
| 5 | +The simplest way to launch a Spring Cloud Task application as a task on Cloud Foundry |
| 6 | +is to use Spring Cloud Data Flow. Via Spring Cloud Data Flow you can register your task application, |
| 7 | +create a definition for it and then launch it. You then can track the task execution(s) |
| 8 | +via a RESTful API, the Spring Cloud Data Flow Shell, or the UI. To learn out to get started installing Data Flow |
| 9 | +follow the instructions in the |
| 10 | +https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#getting-started[Getting Started] |
| 11 | +section of the reference documentation. For info on how to register and launch tasks, see the https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_the_lifecycle_of_a_task[Lifecycle of a Task] documentation. |
7 | 12 |
|
8 |
| -There are 3 steps to deploying your Spring Cloud Task application: |
9 |
| - |
10 |
| -. We must push your application to the platform using the `cf push command`. |
11 |
| -This command pushes your jar to the Cloud Foundry platform. |
12 |
| - |
13 |
| -. We need to stop the application from running once the push is complete. |
14 |
| -Cloud Foundry has to run the application to stage it. But when Cloud Foundry |
15 |
| -runs the application at this time it is treating the application as a LRP (Long Running Process) |
16 |
| -which means once the task is complete it will restart it. This is not the desired |
17 |
| -behavior for our task, thus we must stop it from running. To stop the LRP execution, |
18 |
| -we will use the `cf stop` command. |
19 |
| - |
20 |
| -. We now need to launch our application as a task to do this we will use |
21 |
| -the `cf run-task` command. |
22 |
| - |
23 |
| -NOTE: When using the run-task command you have to specify build pack to be used |
24 |
| -and that is specified in the `command string` enumerated below. |
25 |
| - |
26 |
| -[source,bash] |
27 |
| -``` |
28 |
| -$ cf push --health-check-type none -p <location of your jar> <name of your app> --no-route |
29 |
| -$ cf stop <name of your app> |
30 |
| -$ cf run-task <name of your app> <command string> |
31 |
| -``` |
32 |
| - |
33 |
| -For further examples and how to's on using the Cloud Foundry CLI click |
34 |
| -https://docs.cloudfoundry.org/cf-cli/getting-started.html[here]. |
0 commit comments