Search This Blog

Thursday, 17 November 2016

Installing Pivotal Cloud Foundry (PCF) on Google Cloud Platform (GCP)

I decided to install PCF 1.8 onto Google Cloud Platform today and I thought the experience was fantastic and very straight forward. The GCP Console is fantastic and very powerful indeed. The steps to install it are as follows

http://docs.pivotal.io/pivotalcf/1-8/customizing/gcp.html

Here are some screen shots you would expect to see along the way when using Operations Manager

Screen Shots 










Finally Once Installed here is how to create an ORG, USER and get started using the CLI. You will note you must log in as ADMIN to get started and finally I log in as the user who will be the OrgManager.

** Target my PCF Instance **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf api https://api.system.pas-apples.online --skip-ssl-validation
Setting api endpoint to https://api.system.pas-apples.online...
OK


API endpoint:   https://api.system.pas-apples.online (API version: 2.58.0)
Not logged in. Use 'cf login' to log in.

** Login as ADMIN **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf login -u admin -p YYYY -o system -s system
API endpoint: https://api.system.pas-apples.online
Authenticating...
OK

Targeted org system

Targeted space system

API endpoint:   https://api.system.pas-apples.online (API version: 2.58.0)
User:           admin
Org:            system
Space:          system

** Create Org **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf create-org gcp-pcf-org
Creating org gcp-pcf-org as admin...
OK

Assigning role OrgManager to user admin in org gcp-pcf-org ...
OK

TIP: Use 'cf target -o gcp-pcf-org' to target new org

** Create a USER **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf create-user pas YYYY
Creating user pas...
OK

TIP: Assign roles with 'cf set-org-role' and 'cf set-space-role'

** Set ORG Role **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf set-org-role pas gcp-pcf-org OrgManager
Assigning role OrgManager to user pas in org gcp-pcf-org as admin...
OK

** Target the newly created ORG **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf target -o gcp-pcf-org

API endpoint:   https://api.system.pas-apples.online (API version: 2.58.0)
User:           admin
Org:            gcp-pcf-org
Space:          No space targeted, use 'cf target -s SPACE'

** Create a SPACE **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf create-space development
Creating space development in org gcp-pcf-org as admin...
OK
Assigning role RoleSpaceManager to user admin in org gcp-pcf-org / space development as admin...
OK
Assigning role RoleSpaceDeveloper to user admin in org gcp-pcf-org / space development as admin...
OK

TIP: Use 'cf target -o "gcp-pcf-org" -s "development"' to target new space

** Set Some Space Roles **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf set-space-role pas gcp-pcf-org development SpaceDeveloper
Assigning role RoleSpaceDeveloper to user pas in org gcp-pcf-org / space development as admin...
OK
pasapicella@pas-macbook:~/pivotal/GCP/install$ cf set-space-role pas gcp-pcf-org development SpaceManager
Assigning role RoleSpaceManager to user pas in org gcp-pcf-org / space development as admin...
OK

** Login as PAS user and target the correct ORG/SPACE **

pasapicella@pas-macbook:~/pivotal/GCP/install$ cf login -u pas -p YYYY -o gcp-pcf-org -s development
API endpoint: https://api.system.pas-apples.online
Authenticating...
OK

Targeted org gcp-pcf-org

Targeted space development

API endpoint:   https://api.system.pas-apples.online (API version: 2.58.0)
User:           pas
Org:            gcp-pcf-org
Space:          development

Lets push a simple application

Application manifest.yml

pasapicella@pas-macbook:~/piv-projects/PivotalSpringBootJPA$ cat manifest-inmemory-db.yml
applications:
- name: pas-albums
  memory: 512M
  instances: 1
  random-route: true
  path: ./target/PivotalSpringBootJPA-0.0.1-SNAPSHOT.jar
  env:
    JAVA_OPTS: -Djava.security.egd=file:///dev/urando

Deploy

pasapicella@pas-macbook:~/piv-projects/PivotalSpringBootJPA$ cf push -f manifest-inmemory-db.yml
Using manifest file manifest-inmemory-db.yml

Creating app pas-albums in org gcp-pcf-org / space development as pas...
OK

Creating route pas-albums-gloomful-synapse.apps.pas-apples.online...
OK

Binding pas-albums-gloomful-synapse.apps.pas-apples.online to pas-albums...
OK

Uploading pas-albums...
Uploading app files from: /var/folders/c3/27vscm613fjb6g8f5jmc2x_w0000gp/T/unzipped-app341113312
Uploading 31.6M, 195 files
Done uploading
OK

Starting app pas-albums in org gcp-pcf-org / space development as pas...

0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
1 of 1 instances running

App started

OK

App pas-albums 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.security.egd=file:///dev/urando" && SERVER_PORT=$PORT eval exec $PWD/.java-buildpack/open_jdk_jre/bin/java $JAVA_OPTS -cp $PWD/. org.springframework.boot.loader.JarLauncher`

Showing health and status for app pas-albums in org gcp-pcf-org / space development as pas...
OK

requested state: started
instances: 1/1
usage: 512M x 1 instances
urls: pas-albums-gloomful-synapse.apps.pas-apples.online
last uploaded: Thu Nov 17 03:39:04 UTC 2016
stack: cflinuxfs2
buildpack: java-buildpack=v3.8.1-offline-https://github.com/cloudfoundry/java-buildpack.git#29c79f2 java-main java-opts open-jdk-like-jre=1.8.0_91-unlimited-crypto open-jdk-like-memory-calculator=2.0.2_RELEASE spring-auto-reconfiguration=1.10.0_RELEASE

     state     since                    cpu      memory           disk         details
#0   running   2016-11-17 02:39:57 PM   142.6%   333.1M of 512M   161M of 1G

Get Route to Application

pasapicella@pas-macbook:~/piv-projects/PivotalSpringBootJPA$ cf apps
Getting apps in org gcp-pcf-org / space development as pas...
OK

name         requested state   instances   memory   disk   urls
pas-albums   started           1/1         512M     1G     pas-albums-gloomful-synapse.apps.pas-apples.online






More Information

https://cloud.google.com/solutions/cloud-foundry-on-gcp

No comments: