Search This Blog

Thursday, 23 October 2014

Using the tc Server build pack for Pivotal Cloud Foundry 1.3

On Pivotal network you will find various build packs you can download and apply to PCF and use for your applications outside of the shipped build packs, using the link below.

https://network.pivotal.io/products/pivotal-cf

I am going to show how you would take one of these build packs , install it and then consume it from an application. In this demo I am going to use "tc server buildpack (offline) v2.4"

1. Log in as admin user and upload the build pack as shown below. I am adding this build pack in the last position which is position 6.

[Tue Oct 21 20:36:01 papicella@:~/cf/buildpacks ] $ cf create-buildpack tc_server_buildpack_offline tc-server-buildpack-offline-v2.4.zip 6
Creating buildpack tc_server_buildpack_offline...
OK

Uploading buildpack tc_server_buildpack_offline...
OK

2. View buildpacks, which should show the one we just uploaded above.

[Thu Oct 23 11:15:18 papicella@:~/cf/APJ1 ] $ cf buildpacks
Getting buildpacks...

buildpack                     position   enabled   locked   filename
java_buildpack_offline        1          true      false    java-buildpack-offline-v2.4.zip
ruby_buildpack                2          true      false    ruby_buildpack-offline-v1.1.0.zip
nodejs_buildpack              3          true      false    nodejs_buildpack-offline-v1.0.1.zip
python_buildpack              4          true      false    python_buildpack-offline-v1.0.1.zip
go_buildpack                  4          true      false    go_buildpack-offline-v1.0.1.zip
php_buildpack                 5          true      false    php_buildpack-offline-v1.0.1.zip
tc_server_buildpack_offline   6          true      false    tc-server-buildpack-offline-v2.4.zip

3. Push application using your buildpack uploaded above, below is a simple manifest which refers to the build pack I uploaded.

manifest.yml

applications:
- name: pcfhawq
  memory: 512M
  instances: 1
  host: pcfhawq
  domain: yyyy.fe.dddd.com
  path: ./pcfhawq.war
  buildpack: tc_server_buildpack_offline
  services:
   - phd-dev

[Thu Oct 23 11:36:26 papicella@:~/cf/buildpacks ] $ cf push -f manifest-apj1.yml
Using manifest file manifest-apj1.yml

Creating app pcfhawq-web in org pas-org / space apple as pas...
OK

Creating route yyyy.apj1.dddd.gopivotal.com...
OK

Binding pcfhawq-web.yyyy.fe.dddd.com to pcfhawq-web...
OK

Uploading pcfhawq-web...
Uploading app files from: pcfhawq.war
Uploading 644.1K, 181 files
OK
Binding service phd-dev to app pcfhawq-web in org pas-org / space apple as pas...
OK

Starting app pcfhawq-web in org pas-org / space apple as pas...
OK
-----> Downloaded app package (5.6M)
-----> Java Buildpack Version: v2.4 (offline) | https://github.com/pivotal-cf/tc-server-buildpack.git#396ad0a
-----> Downloading Open Jdk JRE 1.7.0_60 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_60.tar.gz (found in cache)
       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.3s)
-----> Downloading Spring Auto Reconfiguration 1.4.0_RELEASE from http://download.run.pivotal.io/auto-reconfiguration/auto-reconfiguration-1.4.0_RELEASE.jar (found in cache)
       Modifying /WEB-INF/web.xml for Auto Reconfiguration
-----> Downloading Tc Server Instance 2.9.6_RELEASE from http://download.run.pivotal.io/tc-server/tc-server-2.9.6_RELEASE.tar.gz (found in cache)
       Instantiating tc Server in .java-buildpack/tc_server (3.4s)
-----> Downloading Tc Server Lifecycle Support 2.2.0_RELEASE from http://download.run.pivotal.io/tomcat-lifecycle-support/tomcat-lifecycle-support-2.2.0_RELEASE.jar (found in cache)
-----> Downloading Tc Server Logging Support 2.2.0_RELEASE from http://download.run.pivotal.io/tomcat-logging-support/tomcat-logging-support-2.2.0_RELEASE.jar (found in cache)
-----> Downloading Tc Server Access Logging Support 2.2.0_RELEASE from http://download.run.pivotal.io/tomcat-access-logging-support/tomcat-access-logging-support-2.2.0_RELEASE.jar (found in cache)
-----> Uploading droplet (45M)

1 of 1 instances running

App started

Showing health and status for app pcfhawq-web in org pas-org / space apple as pas...
OK

requested state: started
instances: 1/1
usage: 1G x 1 instances
urls: pcfhawq-web.yyyy.fe.dddd.com

     state     since                    cpu    memory         disk
#0   running   2014-10-23 11:37:56 AM   0.0%   398.6M of 1G   109.2M of 1G

4. Verify within the DEV console the application is using the build pack you targeted.


More Information

Buildpacks
http://docs.pivotal.io/pivotalcf/buildpacks/index.html

No comments: