Search This Blog

Friday 18 November 2016

Uploading Tiles into Pivotal Cloud Foundry Operations Manager from the Ops Manager VM directly

When deploying PCF, you start by deploying Ops Manager. This is basically a VM that you deploy into your IaaS system of choice and it orchestrates the PCF installation. The installation of PCF is done by you through a web interface that runs on the Ops Manager VM. Into that web interface, you can load various "tiles". Each tile provides a specific set of functionality.

For example, Ops Manager comes with a tile for Bosh Director. This is the only out-of-the-box tile, as all the other tiles depend on it. Most users will first install the PCF tile. This provides the Cloud Foundry installation. After that, tiles generally provide functionality for services. Popular tiles include MySQL, RabbitMQ and Redis. There are quite a few tiles in total now, you can see them all listed on https://network.pivotal.io.



Some tiles are quite large , for example the "Elastic Runtime" tile in PCF 1.8 is 5G so from Australia I don't want to a 5G file to my laptop then upload it into the Ops Manager Web UI so here is how you can import tiles directly from the Ops Manager VM itself

1. Log into the Ops Manager VM using SSH with your keyfile.

Note: 0.0.0.0 is a bogus ip address for obvious reasons

pasapicella@pas-macbook:~/pivotal/GCP/install/ops-manager-key$ ssh -i ubuntu-key ubuntu@0.0.0.0
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-47-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Nov 16 23:36:27 UTC 2016

  System load:  0.0                Processes:           119
  Usage of /:   36.4% of 49.18GB   Users logged in:     0
  Memory usage: 37%                IP address for eth0: 10.0.0.0
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

Your Hardware Enablement Stack (HWE) is supported until April 2019.

Last login: Wed Nov 16 23:36:30 2016 from 0.0.0.0
ubuntu@myvm-gcp:~$

2. Log into https://network.pivotal.io/ and click on "Edit Profile" as shown below


3. Locate your "API token" and record it we will need it shortly

4. In this example I am uploading the "Pivotal Cloud Foundry Elastic Runtime" tile so navigate to the correct file and select the "i" icon to reveal the API endpoint for the tile.


5. Issue a wget command as follows which has a format as follows. This will download the 5G file into the HOME directory. Wait for this to complete before moving to the next step.

wget {file-name} --post-data="" --header="Authorization: Token {TOKEN-FROM-STEP-3" {API-LOCATION-URL}

$ wget -O cf-1.8.14-build.7.pivotal  --post-data="" --header="Authorization: Token {TOKEN-FROM-STEP-3" https://network.pivotal.io/api/v2/products/elastic-runtime/releases/2857/product_files/9161/download

6. Retrieve an access token which will need us to use the username/password for the Ops Manager admin account.

curl -s -k -H 'Accept: application/json;charset=utf-8' -d 'grant_type=password' -d 'username=admin' -d 'password=OPSMANAGER-ADMIN-PASSWD' -u 'opsman:' https://localhost/uaa/oauth/token

$ curl -s -k -H 'Accept: application/json;charset=utf-8' -d 'grant_type=password' -d 'username=admin' -d 'password=welcome1' -u 'opsman:' https://localhost/uaa/oauth/token
{"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6ImxlZ2Fj ...... "

7. Finally upload the tile to be imported from the Ops Manager UI using a format as follows. You need to make sure you use the correct file name as per the download from STEP 5

curl -v -H "Authorization: Bearer STEP6-ACCESS-TOKEN" 'https://localhost/api/products' -F 'product[file]=@/home/ubuntu/cf-1.8.14-build.7.pivotal'  -X POST -k

Once complete you should see the Tile in Ops Manager as shown below. This is much faster way to upload tiles especially from Australia



More Information

https://docs.pivotal.io/pivotalcf/1-8/customizing/pcf-interface.html

No comments: