Upgrading TryCF for Power Users

The primary purpose of TryCF is to have a dedicated Cloud Foundry running inside an AWS m3.xlarge VM.

But there is so much more you can do with it:

  • target and explore the underlying bosh-lite
  • upload new bosh-lite/warden stemcells
  • upgrade CF versions, from bundled v170 to latest v176
  • add CF services, such as MariaDB/Galera
  • try community BOSH releases

To kick start you along your exploration, this post will introduce some getting started tips for advanced TryCF usage!

  • basic usage
  • target and explore the underlying bosh-lite
  • finding and uploading newer stemcells
  • downloading and editing the running Cloud Foundry deployment manifest
  • directly SSH into TryCF VM
  • persistent SSH via MOSH
  • SSH into BOSH jobs

Basic usage

First, kick off the TryCF provisioning with your AWS credentials, wait 15 minutes or so and look for the "getting started" email.

To recap, the basic usage for the included Cloud Foundry (as documented in the email you receive).

$ cf api https://api.PUBLICIP.xip.io --skip-ssl-validation
$ cf login
Email> admin
Password> admin

You will now be able to push/deploy Ruby/Java/Go/Node/Python/PHP apps (Python/PHP available with v175 onwards).

Target bosh-lite

The same VM running Cloud Foundry via api.PUBLICIP.xip.io above is also directly accessible as bosh-lite:

$ bosh target PUBLICIP trycf
Target set to `Bosh Lite Director'
Your username: admin
Enter password: admin

You may now be working with multiple BOSH targets, so your TryCF is aliased trycf. Retarget it anytime:

$ bosh target trycf

Newer stemcells

Since the TryCF AMI was last created a couple months ago, there is a new stemcell available.

Currently you have the following stemcell installed:

+-----------------------------+---------+----------------------+
| Name                        | Version | CID                  |
+-----------------------------+---------+----------------------+
| bosh-warden-boshlite-ubuntu | 53      | stemcell-07b2be32... |
+-----------------------------+---------+----------------------+

To install newer Cloud Foundry or services you will need a new warden/bosh-lite stemcell.

To get the latest stemcell URL (which isn’t as easy as it could be), you need to search through the BOSH stemcell artifacts website:

stemcells

Pass the Download url to bosh upload stemcell command:

bosh upload stemcell https://s3.amazonaws.com/bosh-jenkins-artifacts/bosh-stemcell/warden/bosh-stemcell-60-warden-boshlite-ubuntu-lucid-go_agent.tgz

Edit Cloud Foundry deployment

You can also access the deployment manifest used to deploy Cloud Foundry, edit it and deploy the changes!

$ bosh deployments
+-----------+------------+-------------+
| Name      | Release(s) | Stemcell(s) |
+-----------+------------+-------------+
| cf-warden | cf/170     | ...         |
+-----------+------------+-------------+

To download, edit and deploy:

$ bosh download manifest cf-warden cf.yml
$ bosh deployment cf.yml
$ bosh edit deployment
$ bosh deploy

Setup SSH

You can jump inside the TryCF VM and have a look around. This is also required for running bosh ssh commands to investigate deployments’ jobs (see BOSH SSH section below)

  • Download trycf.pem from email into ~/.ssh/trycf.pem
  • Make user-readable only chmod 600 ~/.ssh/trycf.pem

You can now SSH:

$ ssh [email protected] -i ~/.ssh/trycf.pem

This is long and unwieldy. Instead, let’s setup an alias:

$ ssh trycf

To do this, open/create ~/.ssh/config and add:

Host trycf
  Hostname PUBLICIP
  User ubuntu
  IdentityFile ~/.ssh/trycf.pem

Persistent SSH with MOSH

MOSH is better than the standard SSH client.

Remote terminal application that allows roaming, supports intermittent connectivity, and provides intelligent local echo and line editing of user keystrokes

In otherwords – a persistent SSH session.

To set it up:

  • install mosh inside the TryCF VM
  • install the most client on local machine
  • open UDP port range 60000-60050
$ ssh trycf
ubuntu$ sudo apt-get install python-software-properties
ubuntu$ sudo add-apt-repository ppa:keithw/mosh -y
ubuntu$ sudo apt-get update
ubuntu$ sudo apt-get install mosh -y
ubuntu$ exit

Next, download/install MOSH on your local machine – see list of options.

Finally, login into the AWS console and edit the trycf security group [direct link]

add-most-port-range

You can now use mosh instead of ssh:

$ mosh trycf

Test that the SSH connection self-heals by disabling internet access…

disconnected

And then restoring it.

connected

BOSH SSH

Now that you are inside the TryCF VM you also have access to the BOSH CLI and can now SSH into job VMs:

ubuntu$ rm -f ~/.ssh/known_hosts
ubuntu$ bosh login
ubuntu$ bosh download manifest cf-warden cf.yml
ubuntu$ bosh deployment cf.yml
ubuntu$ bosh ssh
1. ha_proxy_z1/0
2. nats_z1/0
3. postgres_z1/0
4. uaa_z1/0
5. login_z1/0
...

Spread the word

twitter icon facebook icon linkedin icon