-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.html.md.erb
94 lines (69 loc) · 2.56 KB
/
deploy.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
---
title: Deploy the App
owner: Daniel Freitag
---
<strong><%= modified_date %></strong>
In this step you will deploy the app to <%= vars.product_full %>.
Before you can push it, you need to compile and build the app using Gradle. To do so, run
<pre class="terminal">
$ gradle build
...
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test UP-TO-DATE
:check UP-TO-DATE
:build
BUILD SUCCESSFUL
Total time: 6.78 secs
</pre>
Gradle will build a Java archive (JAR) file of your app. It is located under `build/libs/cf-sample-app-java-1.0.0.jar`. The Java archive contains all dependencies needed by your app.
Replace "my-random-hostname" with your own hostname and "scapp.io" with an available shared domain (`cf domains` or "Domains" in the portal under your organization) or your own domain. This is the URL your app will be reached at and therefore has to be unique in this Application Cloud.
Now push your app to the cloud by executing the following command:
<pre class="terminal">
$ cf push my-java-app -p build/libs/cf-sample-app-java-1.0.0.jar -n my-random-hostname -d mydomain.com
Creating app my-java-app in org MyOrg / space MySpace as user@mydomain.com...
OK
Creating route my-random-hostname.mydomain.com...
OK
Binding my-random-hostname.mydomain.com to my-java-app...
OK
Uploading my-java-app...
Uploading app files from: ...
Uploading 7M, 1733 files
Done uploading
OK
...
requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: my-random-hostname.mydomain.com
last uploaded: Sun May 29 15:22:58 UTC 2016
stack: unknown
buildpack: java_buildpack
</pre>
The `-p build/libs/cf-sample-app-java-1.0.0.jar` tells Cloud Foundry where to find the compiled application to push to the cloud.
The application is now deployed. Ensure that the app is running:
<pre class="terminal">
$ cf app my-java-app
Showing health and status for app my-java-app in org MyOrg / space MySpace as user@mydomain.com...
OK
requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: my-random-hostname.mydomain.com
last uploaded: Sun May 29 15:22:58 UTC 2016
stack: cflinuxfs2
buildpack: java_buildpack
state since cpu memory disk details
#0 running 2016-05-29 03:26:08 PM 0.1% 326M of 1G 132.2M of 1G
</pre>
Now visit the app at the URL. You can find the URL in the `urls` property of the statement above.
<div style="text-align:center;margin:3em;">
<a href="./logs.html" class="btn btn-primary">I have deployed my App</a>
</div>