Is this what programming is all about?
I simply wanted to deploy a Hello World endpoint on SAP Cloud Platform.
Yes, every programming journey is filled with setbacks, wrought with obstacles, and designed to tax the soul. I still thought it would be easier than this.
Let’s start at the beginning.
Excited to learn something new
I wanted to learn to build chat bots with SAP Conversational AI, in order to build a set of tutorials*. Learning this product has been fun, and the product managers are clearly focused on making it simple and clear. No complaints here.
The next tutorial that I wanted to create was on how to build a Python endpoint deployed to SAP Cloud Platform for the bot to call during a conversation. I used Yohei Fukuhara‘s blog post Create simple Flask REST API using Cloud Foundry — a great post, short, simple, easy to follow. Again, no complaints.
Early signs of trouble
With a little existing knowledge about Cloud Foundry, I installed Cloud Foundry CLI, but when I ran a CF command, it failed because it thought my home drive was my U drive, but I did not have a U drive.
I tried to set my home drive, but it was always temporary. Then I tried to set it via environment variables, but this did not work. Then, I opened up an IT ticket — since this is something they seem to set automatically — but they just didn’t understand the issues.
Finally, I found that I could set an environment variable called CF_PLUGIN_HOME or CF_HOME to tell CF directly what directory to use. First problem solved.
The pressure intensifies
I followed Yohei’s tutorial, which was really simple and easy to do. But immediately, I had a problem with SAP Cloud Platform (just to be clear, this was not an issue with Yohei’s tutorial).
At SAP, I have been working with some of the people in SAP Cloud Platform development, so I had heard somewhat about needing to set quota and entitlements for subaccount, and some of the recent changes to the trial landscape. But I didn’t know exactly how to add routes.
There were 2 things that confused me.
I assumed I had to take some of my global quota and give it to a subaccount, and I assumed you would do this at a global level. But I had to enter the subaccount and create a quota plan, and then assign that to each space that needed quota.
But when creating the plan, I got this screen, which suggests I have to raise the org limit, but I could not find where to raise the org limit. And then I started to go around in circles trying to find a way to raise the org limits, until I realized — I can ignore these messages and just set the quota.
In the end, I was able to specify routes and other quota, despite the error message, and save and assign the quota to my space.
I set a quota plan for letting me create routes, but I still got the same message. So I figured I had to assign entitlements somehow, but I had no idea what entitlements I needed and which ones would give me some routes.
So I gave myself all the entitlements that seemed like they might help. It seems that giving my space Application Runtime entitlements did the trick.
Python also stings
After getting the right quota and entitlements, I tried to push my application, and it created routes and everything, but then I got the following:
I must admit I am only now learning Python, and find all the different frameworks and tools and versions and buildpacks confusing. But I was trying. And so, after reading a bunch of Python blogs, after learning on Lynda.com, after studying SAP Cloud Platform quota, after writing a bunch of colleagues — I was stuck again!
After a little more research, though, I somehow figured out that I had to change the specified Python runtime (3.8.1 worked for me). And then it got deployed and it worked!! (I forget how I figured this out.)
There is a really nice tutorial on understanding entitlements in SAP Cloud Platform, Manage Entitlements on SAP Cloud Platform Trial.
There is a great sense of accomplishment when you persevere through difficult issues and get your app running, more than if it had been simple. But maybe it wouldn’t be so bad if programming were a little bit simpler?
Check out my first 3 SAP Conversational AI tutorials (many more to come, including on creating a Python webhook):