Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Commit 8e06d02

Browse files
added a simple buildpack update demo. partially done.
1 parent 85bb733 commit 8e06d02

File tree

206 files changed

+14316
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

206 files changed

+14316
-0
lines changed

.bintray.desc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"package": {
3+
"name": "pcf-ers-demo1",
4+
"repo": "generic",
5+
"subject": "mborges-pivotal"
6+
},
7+
8+
"version": {
9+
"name": "head"
10+
},
11+
12+
"files":
13+
[
14+
{"includePattern": "target/(.*\.jar)", "excludePattern": "target/.*\.original", "uploadPattern": "$1"}
15+
],
16+
"publish": true
17+
}

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**/**/.DS_Store
2+
/target/
3+
.factorypath
4+
.classpath
5+
.settings
6+
build/
7+
.project
8+
.springBeans
9+
/pcf-ers-demo1.iml
10+
/.idea/
11+
ci/variables.yml

.mvn/wrapper/maven-wrapper.jar

46.5 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
script: env && ./mvnw package -B
5+
before_deploy: ./ci/travis_beforeDeploy.sh
6+
deploy:
7+
provider: bintray
8+
file: .bintray.desc
9+
user: mborges-pivotal
10+
key:
11+
secure: YA46mZniYwD05sWtrFdlkhidBxE89nhS3fpO8dfeMwrpH3kuQ8n+ctuPKHWCyrNIEiLPAqdXVRocDeDoTTm//+rQiCeTj/PUPBd7xqDc9lXuKZ2CY+eQ1DjW9P+7nj1Ob+xhoF9wIp2Pvlo1xocdmJOP8h6eRHCQ5Xmmr9UDBz/sAvxwM+haICEYfKR/IR3NvZzX0KiUdgjXEAN8I2C4rhYwLuZWrlZ3wdU0T7U81Pfoy4eAlZe4p/AqOlspvusNT6MBzRBUYP0HRQ4goph0N60kGqLkWuMRAGIc4c+CEpHvyE7UXgAZ4eGg3motAvAUmfQNpsm/sKB0NSubn1vXz+vUtGmpmPtl6KSyT7ha0xA7GUof+j6dQBG0q51H2Zg40cKofHXYTPcVxNMVh/cV9zWm+xzhe+6YqbdMETBtJH71dIIFHIeuwV1fferA7Jg70IquozNoJDmPzSeEx68eq3BtmJjKLSyUQFxJK/Dq+g7qqa8TRLMjnKQW1u28X/gUSyPf73cy2kKjYtLWGy3NnWvAlzMSFOPmy7Esk8s0Rge2VPiQPM5qt+/G+vM//Dv9yv8cCedvtHh2e0vH9RjKlhkW61MJMGakOv9dHy2IbOYyt4bpA2qLkZD/hZy7dqPxWOIOSL4HS6QGKyI77lokAXsVGkk+O79MYY9BEL/GRo4=
12+
dry-run: false
13+
on:
14+
tags: true
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
= Push the demo application
2+
:toc: right
3+
:imagesdir: ../images
4+
5+
[abstract]
6+
--
7+
The prime directive of Pivotal Cloud Foundry is to host applications. We are going to exercise that directive by pushing a very simple Spring application.
8+
9+
By the end of this lab you should have your attendees application up and running in your account.
10+
--
11+
12+
Estimated Time: 30 minutes
13+
14+
== Set your target environment
15+
16+
. If you haven't already, download the latest release of the Cloud Foundry CLI from https://github.com/cloudfoundry/cli/releases for your operating system and install it.
17+
18+
. Set the API target for the CLI:
19+
+
20+
----
21+
$ cf api --skip-ssl-validation https://api.<DOMAIN_PROVIDED_BY_INSTRUCTOR>
22+
----
23+
24+
. Login to Pivotal Cloud Foundry:
25+
+
26+
----
27+
$ cf login
28+
----
29+
+
30+
Follow the prompts, entering in the student credentials provided by the instructor and choosing the development space.
31+
32+
== Build (or Download) and Push!
33+
34+
Change to the _attendees_ sample application directory:
35+
----
36+
$ cd $COURSE_HOME
37+
----
38+
39+
=== Download
40+
41+
If you cannot run the maven script to build:
42+
43+
. Download the attendees1-0.0.1-SNAPSHOT.jar file https://bintray.com/mborges-pivotal/generic/attendees1/head#files[here]
44+
. Create the directory `/build/libs/`.
45+
. Place the .jar file in the `/build/libs/` directory.
46+
. Skip down to the 'Push' section.
47+
48+
=== Build
49+
50+
Use the Maven Wrapper to build and package the application:
51+
52+
----
53+
$ ./mvnw package -DskipTests
54+
----
55+
56+
The Maven Wrapper will automatically download the appropriate version of Maven for this project along with all of _attendees_'s dependencies. This may take a few moments.
57+
58+
=== Push
59+
60+
Now use the `cf push` command to push the application to PCF!
61+
62+
----
63+
$ cf push
64+
----
65+
66+
You should see output similar to the following listing. Take a look at the listing callouts for a play-by-play of what's happening:
67+
68+
====
69+
----
70+
Using manifest file /Users/mborges/Tools/PCF/demo2.0/attendees/manifest.yml // <1>
71+
72+
Creating app attendees in org pivot-mborges / space development as mborges@pivotal.io... // <2>
73+
OK
74+
75+
Creating route attendees-naturopathic-souple.cfapps.pez.pivotal.io... // <3>
76+
OK
77+
78+
Binding attendees-naturopathic-souple.cfapps.pez.pivotal.io to attendees... // <4>
79+
OK
80+
81+
Uploading attendees...
82+
Uploading app files from: /var/folders/k6/bg1q4mc50sl957cvyfw0s26r0000gp/T/unzipped-app942168724
83+
Uploading 678.4K, 143 files // <5>
84+
Done uploading
85+
OK
86+
87+
Starting app attendees in org pivot-mborges / space development as mborges@pivotal.io...
88+
Downloading python_buildpack...
89+
Downloading staticfile_buildpack...
90+
Downloading php_buildpack...
91+
Downloading java_buildpack_offline_v4...
92+
Downloading hwc_buildpack...
93+
Downloaded java_buildpack_offline_v4
94+
Downloading java_buildpack_offline...
95+
Downloaded hwc_buildpack
96+
Downloading ruby_buildpack...
97+
Downloaded php_buildpack
98+
Downloading nodejs_buildpack...
99+
Downloaded python_buildpack
100+
Downloaded staticfile_buildpack
101+
Downloading go_buildpack...
102+
Downloading null_buildpack...
103+
Downloaded go_buildpack
104+
Downloading binary_buildpack...
105+
Downloaded java_buildpack_offline
106+
Downloading dotnet_core_buildpack...
107+
Downloaded ruby_buildpack
108+
Downloading tc_server_buildpack_offline...
109+
Downloaded null_buildpack
110+
Downloading azq_nodejs...
111+
Downloaded nodejs_buildpack
112+
Downloaded binary_buildpack
113+
Downloaded dotnet_core_buildpack
114+
Downloaded tc_server_buildpack_offline
115+
Downloaded azq_nodejs
116+
Creating container
117+
Successfully created container
118+
Downloading app package...
119+
Downloaded app package (34.4M)
120+
Staging... // <6>
121+
-----> Java Buildpack Version: v3.18 (offline) | https://github.com/cloudfoundry/java-buildpack.git#841ecb2
122+
-----> Downloading Open Jdk JRE 1.8.0_131 from https://java-buildpack.cloudfoundry. org/openjdk/trusty/x86_64/openjdk-1.8.0_131.tar.gz (found in cache) // <7>
123+
Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.3s)
124+
-----> Downloading Open JDK Like Memory Calculator 2.0.2_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-2.0.2_RELEASE.tar.gz (found in cache)
125+
Memory Settings: -Xss349K -Xmx681574K -XX:MaxMetaspaceSize=104857K -Xms681574K -XX:MetaspaceSize=104857K
126+
-----> Downloading Container Security Provider 1.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.5.0_RELEASE.jar (found in cache)
127+
-----> Downloading Spring Auto Reconfiguration 1.11.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-1.11.0_RELEASE.jar (found in cache)
128+
Exit status 0
129+
Staging complete
130+
Uploading droplet, build artifacts cache... // <8>
131+
Uploading build artifacts cache...
132+
Uploading droplet...
133+
Uploaded build artifacts cache (107B)
134+
Uploaded droplet (79.9M)
135+
Uploading complete
136+
Destroying container
137+
Successfully destroyed container
138+
139+
0 of 1 instances running, 1 starting
140+
0 of 1 instances running, 1 starting
141+
0 of 1 instances running, 1 starting
142+
1 of 1 instances running
143+
144+
App started
145+
146+
147+
OK
148+
149+
App attendees was started using this command `CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-2.0.2_RELEASE -memorySizes=metaspace:64m..,stack:228k.. -memoryWeights=heap:65,metaspace:10,native:15,stack:10 -memoryInitials=heap:100%,metaspace:100% -stackThreads=300 -totMemory=$MEMORY_LIMIT) && JAVA_OPTS="-Djava.io.tmpdir=$TMPDIR -XX:OnOutOfMemoryError=$PWD/.java-buildpack/open_jdk_jre/bin/killjava.sh $CALCULATED_MEMORY -Djava.ext.dirs=$PWD/.java-buildpack/container_security_provider:$PWD/.java-buildpack/open_jdk_jre/lib/ext -Djava.security.properties=$PWD/.java-buildpack/security_providers/java.security" && SERVER_PORT=$PORT eval exec $PWD/.java-buildpack/open_jdk_jre/bin/java $JAVA_OPTS -cp $PWD/. org.springframework.boot.loader.JarLauncher` // <9>
150+
151+
Showing health and status for app attendees in org pivot-mborges / space development as mborges@pivotal.io...
152+
OK
153+
154+
requested state: started
155+
instances: 1/1
156+
usage: 1G x 1 instances
157+
urls: attendees-naturopathic-souple.cfapps.pez.pivotal.io
158+
last uploaded: Mon Aug 7 21:47:10 UTC 2017
159+
stack: cflinuxfs2
160+
buildpack: container-security-provider=1.5.0_RELEASE java-buildpack=v3.18-offline-https://github.com/cloudfoundry/java-buildpack.git#841ecb2 java-main open-jdk-like-jre=1.8.0_131 open-jdk-like-memory-calculator=2.0.2_RELEASE open-jdk-like-security-providers secur...
161+
162+
state since cpu memory disk details
163+
#0 running 2017-08-07 04:48:08 PM 231.0% 498.1M of 1G 161.9M of 1G // <10>
164+
----
165+
166+
<1> The CLI is using a manifest to provide necessary configuration details such as application name, memory to be allocated, and path to the application artifact.
167+
Take a look at `manifest.yml` to see how.
168+
<2> In most cases, the CLI indicates each Cloud Foundry API call as it happens.
169+
In this case, the CLI has created an application record for _attendees_ in your assigned space.
170+
<3> All HTTP/HTTPS requests to applications will flow through Cloud Foundry's front-end router called http://docs.cloudfoundry.org/concepts/architecture/router.html[(Go)Router].
171+
Here the CLI is creating a route with random word tokens inserted (again, see `manifest.yml` for a hint!) to prevent route collisions across the default PCF domain.
172+
<4> Now the CLI is _binding_ the created route to the application.
173+
Routes can actually be bound to multiple applications to support techniques such as http://www.mattstine.com/2013/07/10/blue-green-deployments-on-cloudfoundry[blue-green deployments].
174+
<5> The CLI finally uploads the application bits to PCF. Notice that it's uploading _90 files_! This is because Cloud Foundry actually explodes a ZIP artifact before uploading it for caching purposes.
175+
<6> Now we begin the staging process. The https://github.com/cloudfoundry/java-buildpack[Java Buildpack] is responsible for assembling the runtime components necessary to run the application.
176+
<7> Here we see the version of the JRE that has been chosen and installed.
177+
<8> The complete package of your application and all of its necessary runtime components is called a _droplet_.
178+
Here the droplet is being uploaded to PCF's internal blobstore so that it can be easily copied to one or more _http://docs.cloudfoundry.org/concepts/diego/diego-components.html#cell-components[Diego Cells]_ for execution.
179+
<9> The CLI tells you exactly what command and argument set was used to start your application.
180+
<10> Finally the CLI reports the current status of your application's health.
181+
You can get the same output at any time by typing `cf app attendees`.
182+
====
183+
184+
Visit the application in your browser by hitting the route that was generated by the CLI. You can find the route by typing `cf apps`, and it will look something like `https://attendees-naturopathic-souple.<DOMAIN-PROVIDED-BY-INSTRUCTOR>`
185+
186+
image::screenshot_main.png[]
187+
188+
Take a look at the `Application Environment Information` section on the top right-hand corner of the UI.
189+
This gives you important information about the state of the currently running _attendees_ instance, including what application instance index and what Cloud Foundry services are bound.
190+
It will become important in the next lab!
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
= Pivotal Cloud Foundry Basics
2+
Pivotal Platform Architecture Team
3+
:backend: deckjs
4+
:deckjs_transition: fade
5+
:navigation:
6+
7+
== Application Push
8+
9+
This is the first slide after the title slide.
10+
11+
[canvas-image=images/example.jpg]
12+
== Slide Two's Title will not be displayed
13+
14+
[.canvas-caption, position=center-up]
15+
This text is displayed on top of the example.jpg image.

0 commit comments

Comments
 (0)