Skip to Content

As you may be aware that cloud foundry capabilities on SAP Cloud Platform went GA at the Sapphire last week. I tried signing up for it in my trial account and it was a breeze. Following the modern etiquette of displaying happiness by tweeting, I said

But a platform is known by the applications that run on it. I wanted to give this CF trial account a spin by doing something non-trivial. My quest for finding a non-trivial app landed me on an excellent open source solution for Event Ticketing called Alf.io. Think of it as your personal EventBrite with all the capabilities a modern ticketing app would require including payments, PCI complaint etc. They even have a offline solution that you can host on Raspberry Pi and take it to events. This seemed to be a perfect choice.

Before we go on to achieving the ticketing nirvana, if there is such a thing, few prerequisites

  • You should have a Trial CF subaccount on SAP Cloud Platform. If you already have a SAP CP account it should be easy to just activate it like I did. If not first signup for the trial account then activate the CF subaccount from there.
  • Once you have the CF subaccount active. You should follow the getting started from the excellent help developed with by our User Assistance team. I expect you have at least done the first 3 steps i.e. you are able to authenticate with CF API endpoint.

 

 

Let us start by setting up the CF API end-point and authenticating against it from command line (If this line doesn’t make sense to you please do steps 1-3 shown in the screenshot above). I am using terminal app on MacOS, for windows you can use CMD or something similar.

cf api https://api.cf.us10.hana.ondemand.com

Once you see the OK. Do

cf login

Supply your email id and password for the trial account. You should see something like the following

Once authenticated create a folder for your application, let’s call it alfio. Change directory to this folder and download alf.io 1.10 release from this link on github. It’s 34MB file named alfio-1.10.2-boot.war . Before we push this binary packaged file to CF let’s take a look at the CF Cockpit UI on SAP Cloud platform. When at the top level Home link of cockpit you should see the following

What a beautiful screen, seems like we are ready to take on the world 🙂 Jokes apart note CF is available across 3 regions and you have to be clear about where your CF subaccount is provisioned. For example I know mine is provisioned in US East(VA). So I would click on that and from here I can see, it is plain vanilla account with no apps on it, let us bring colors to this empty universe. (Notice the breadcrumb at the top for getting to Apps screen Home -> REGION -> Acct -> trial -> dev

Time to jump back to our trusty command line and deploy the war 🙂 file we downloaded from github. Make sure you are in the folder you downloaded the war file. I am assuming you are authenticated to the CF API endpoint. Do the following push, make sure to replace XXXX with something unique as this would be used in the URL of your app or as CF calls it will be part of the route

cf push alfio-XXXXX -p alfio-1.10.2-boot.war --no-start

You should see it uploading the app to CF. Something like the following should show

We are choosing to not start the app as we need to attach this with a database. We would use PostgreSQL for that. But first let’s go back to your App Screen in CF Cockpit and check that your newly deployed app is listed there. We will create the db instance from the cockpit and attach (bind) the this db instance with the app during the instance creation. All of this can be done from the command line in fact DevOps folks love that. For pedagogical reason I am going to show from the UI. Click on the Services in CF cockpit to get to the following screen and click on PostgreSQL

This should start the creation of this service instance, follow along the screenshots given below ( A service can offer multiple plans in simple terms T-shirt sizes. For trial we just have one)

Skip the parameters screen by clicking Next. Attach the application you deployed earlier with this service instance. Notice I called my app alfio-pkn. Finally confirm.

Finally you should see something like this

Now we are ready. The code is deployed. DB instance was created and attached with the app. So we should start the application. We can do it from UI or command line. Take your pick. Since I grew up with command line I would hop back to where I am authenticated against CF API and command

cf start APP_NAME

APP_NAME is what you chose. For me above it was alfio-pkn. Once I get the app is started signal. DONOT click on the URL for the app. There is an interesting thing that alf.io does. When it starts for the very first time it generates the admin password in logs. So how do we access these logs. You can either use command line

cf logs APP_NAME --recent

Try to look for something like this

Or if you prefer UI, go to where the details of the app are displayed and click on logs. You might have to scroll down to get it.

Now we are ready to get into our app. Remember though you have read more than 900 words so far with lots of images, what we have done is pretty simple

  1. Deployed the app code
  2. Used a service for db and attached it with the app.

To launch the app, you can see the URL at the top of the application details screen in UI. It should be something like

https://APP_NAME.cfapps.us10.hana.ondemand.com/admin

where APP_NAME is the name for your app. I added admin at the end of the URL to get to admin, You can use the admin password noted earlier to login to the form that comes with admin id. Once logged in you would be asked some config settings to be supplied for the ticketing app like google map settings, mail server settings. I just used random strings as I am not going to use it in real life. Finally getting past the config setting you would see

They even have a Android app may be you want to play with that too (No iOS app, may be someone from community would like to develop that using the new iOS SDK).

Please do share your feedback on how you like the new cloud foundry capabilities. Anything you want to know about this tutorial. Or just give us a shoutout on twitter @mirchiseth or @sapcp .

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply