Cloud Foundry – Push Application into Space

As we have already created sample greet application in previous post Cloud Foundry – Create First Application, we will see how we can push the same application into Cloud Foundry development space. As we have already seen, there is a PUSH command in Cloud Foundry Commands. We need to use the same command to push our application into Cloud Foundry. Prior to that, we need to login into the Cloud Foundry CLI by using LOGIN command. If you have any issues with login into the Cloud Foundry by using CF-CLI, look into previous post which I have already explained. The below are the steps which require to follow to push our application into Cloud Foundry,

Open CF-CLI and navigate into the application target directory, target directory will be created automatically as on when we issue mvn clean install command on project.

Now, we can issue the below command to deploy application jar file into Cloud Foundry.

cf push cfgreet -p CFGreet-0.0.1-SNAPSHOT.jar

cf push is the command used for pushing the application
cfgreet is my application name
-p is the path specifying
CFGreet-0.0.1-SNAPSHOT.jar is the actual CFGreet application which we are trying to deploy into cloud foundry.

Pushing Log:

C:\Users\subbaiah\Downloads\CF\CFGreet\CFGreet\target>cf push cfgreet -p CFGreet-0.0.1-SNAPSHOT.jar
Pushing app cfgreet to org javaisocean / space development as royal@gmail.com…
Getting app info…
Creating app with these attributes…
+ name:       cfgreet
  path:       C:\Users\subbaiah\Downloads\CF\CFGreet\CFGreet\target\CFGreet-0.0.1-SNAPSHOT.jar
  routes:
+   cfgreet.cfapps.io

Creating app cfgreet…
Mapping routes…
Comparing local files to remote cache…
Packaging files to upload…
Uploading files…
 311.17 KiB / 311.17 KiB [=================================================================================] 100.00% 7s

Waiting for API to complete processing files…

Staging app and tracing logs…
   Downloading binary_buildpack…
   Downloading nodejs_buildpack…
   Downloading java_buildpack…
   Downloading staticfile_buildpack…
   Downloading go_buildpack…
   Downloaded java_buildpack
   Downloading dotnet_core_buildpack_beta…
   Downloaded binary_buildpack
   Downloading hwc_buildpack…
   Downloaded nodejs_buildpack
   Downloading python_buildpack…
   Downloaded staticfile_buildpack
   Downloading ruby_buildpack…
   Downloaded hwc_buildpack
   Downloading dotnet_core_buildpack…
   Downloaded dotnet_core_buildpack_beta
   Downloading php_buildpack…
   Downloaded python_buildpack
   Downloaded ruby_buildpack
   Downloaded php_buildpack
   Downloaded dotnet_core_buildpack
   Downloaded go_buildpack
   Cell 4ae961ca-0fe4-4c10-acc6-cffcd81c918a creating container for instance 5679e3c5-7131-46ec-98ea-9b326b578b66
   Cell 4ae961ca-0fe4-4c10-acc6-cffcd81c918a successfully created container for instance 5679e3c5-7131-46ec-98ea-9b326b578b66
   Downloading app package…
   Downloaded app package (15.5M)
   —–> Java Buildpack v4.16 (offline) | https://github.com/cloudfoundry/java-buildpack.git#41b8ff8
   —–> Downloading Jvmkill Agent 1.16.0_RELEASE from https://java-buildpack.cloudfoundry.org/jvmkill/trusty/x86_64/jvmkill-1.16.0_RELEASE.so (found in cache)
   —–> Downloading Open Jdk JRE 1.8.0_181 from https://java-buildpack.cloudfoundry.org/openjdk/trusty/x86_64/openjdk-1.8.0_181.tar.gz (found in cache)
          Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.2s)
          JVM DNS caching disabled in lieu of BOSH DNS caching
   —–> Downloading Open JDK Like Memory Calculator 3.13.0_RELEASE from https://java-buildpack.cloudfoundry.org/memory-calculator/trusty/x86_64/memory-calculator-3.13.0_RELEASE.tar.gz (found in cache)
          Loaded Classes: 13753, Threads: 250
   —–> Downloading Client Certificate Mapper 1.8.0_RELEASE from https://java-buildpack.cloudfoundry.org/client-certificate-mapper/client-certificate-mapper-1.8.0_RELEASE.jar (found in cache)
   —–> Downloading Container Security Provider 1.16.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.16.0_RELEASE.jar (found in cache)
   —–> Downloading Spring Auto Reconfiguration 2.5.0_RELEASE from https://java-buildpack.cloudfoundry.org/auto-reconfiguration/auto-reconfiguration-2.5.0_RELEASE.jar (found in cache)
   Exit status 0
   Uploading droplet, build artifacts cache…
   Uploading droplet…
   Uploading build artifacts cache…
   Uploaded build artifacts cache (131B)
   Uploaded droplet (62.2M)
   Uploading complete
   Cell 4ae961ca-0fe4-4c10-acc6-cffcd81c918a stopping instance 5679e3c5-7131-46ec-98ea-9b326b578b66
   Cell 4ae961ca-0fe4-4c10-acc6-cffcd81c918a destroying container for instance 5679e3c5-7131-46ec-98ea-9b326b578b66

Waiting for app to start…

name:              cfgreet
requested state:   started
routes:            cfgreet.cfapps.io
last uploaded:     Wed 03 Oct 18:17:54 IST 2018
stack:             cflinuxfs2
buildpacks:        client-certificate-mapper=1.8.0_RELEASE container-security-provider=1.16.0_RELEASE
                   java-buildpack=v4.16-offline-https://github.com/cloudfoundry/java-buildpack.git#41b8ff8
                   java-main java-opts java-security jvmkill-agent=1.16.0_RELEASE open-jdk-…

type:            web
instances:       1/1
memory usage:    1024M
start command:   JAVA_OPTS=”-agentpath:$PWD/.java-buildpack/open_jdk_jre/bin/jvmkill-1.16.0_RELEASE=printHeapHistogram=1
                 -Djava.io.tmpdir=$TMPDIR
                 -Djava.ext.dirs=$PWD/.java-buildpack/container_security_provider:$PWD/.java-buildpack/open_jdk_jre/lib/ext
                 -Djava.security.properties=$PWD/.java-buildpack/java_security/java.security $JAVA_OPTS” &&
                 CALCULATED_MEMORY=$($PWD/.java-buildpack/open_jdk_jre/bin/java-buildpack-memory-calculator-3.13.0_RELEASE
                 -totMemory=$MEMORY_LIMIT -loadedClasses=14531 -poolType=metaspace -stackThreads=250
                 -vmOptions=”$JAVA_OPTS”) && echo JVM Memory Configuration: $CALCULATED_MEMORY && JAVA_OPTS=”$JAVA_OPTS
                 $CALCULATED_MEMORY” && MALLOC_ARENA_MAX=2 SERVER_PORT=$PORT eval exec
                 $PWD/.java-buildpack/open_jdk_jre/bin/java $JAVA_OPTS -cp $PWD/.
                 org.springframework.boot.loader.JarLauncher

       state              since                              cpu         memory              disk
#0   running   2018-10-03T12:48:27Z   129.1%   307.4M of 1G   142.9M of 1G
====================End of LOG==========================================

Now, we check from Pivotal account from UI and check CFGreet application is present or not in development space.

My CFGreet app is present in development space with the Route of https://cfgreet.cfapps.io. Let’s access our API along with this route, https://cfgreet.cfapps.io/greet/javaisocean the output will be look like Hello javaisocean… Welcome to Cloud Foundry 🙂

Now, your application Successfully pushed into Cloud Foundry and running. 

Previous: Cloud Foundry – Create First Application

Next: PCF Application Services

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s