Preconditions: Windows 7.
Yesterday I received an invitation for a two-month free trial of the rising Pivotal Web Services. It’s kinda OpenShift, kinda Azure, etc. but with a bit of hipster style blended in. Just a bit.
Since the very first moment that I knew something about this service, I have been very intrigued by the promise that you can simply type something like
in you terminal window and have your application up and running in the Internet. Something that I have been searching for since a looong time ago. I do not know why they sent me the invitation and I do not even remeber when I asked for it (It was probably a late drunk friday night) but here it is. Today I found some time to try the wordeful and valuable capabilities that Pivotal provides you with.
Sadly, the beginning has not been one of the most memorable. Or probably it has been, but in a not-so-positive sense. Just like OpenShift, Pivotal Web Services (PWS), require that you install some client side command line utilities to remotely manage your applications. Unlike OpenShift though, you do not have to go through an infinite sequence of installations. In this case you just have to install their little tiny lighweight client: cf.exe (cf stands for Cloud Foundry, I guess). Don’t get me wrong, it is a great improvement with respect to the paramount load of things that you have to install in order to manage your OpenShift instance. The only problem is that, once you’ve run the cf installer, no known command works anymore. “mvn package something“? No way: “mvn is not recognized as an internal or external command, operable program or batch file“. What?! Even if you type “cmd” you get the same laconic answer. You could already figure out the problem: the cf installer completely erases the ‘path’ environment variable. If you have been working with your machine for almost two years, as I did, installing tons and tons of programs, tools and utilities, this puts you in a very uncomfortable situation.
Luckily I found a solution to this problem online. Thank you to the guy who answered and thank you Internet. This saved me a lot of troubles.
At this point I was a bit upset, as you might imagine. But!… When the cf command is set up and working properly, the steps to deploy a Java webapp are the following:
first, tell cf which API endpoint to use with the command
cf api api.run.pivotal.io
then, you have to log in with:
cf login API endpoint: https://api.run.pivotal.io Username> email@example.com Password> Authenticating... OK API endpoint: https://api.run.pivotal.io (API version: 2.2.0) User: firstname.lastname@example.org Org: xxx Space: stubgen
and, finally, the real magic:
cf push stubgen -p <path-to-your-war-file>