Editor’s Note: Reposted with permission from the OpenShift developer blog, and author Grant Shipley.
Are you a Titanium developer that needs to develop backend services for your mobile applications? If so, you are in luck as Titanium Studio now has built in support for cloud deployments using OpenShift.
I have been a mobile application developer for both the iOS and Android platforms since the original iPhone was released on the market. During this time, I have seen the mobile application landscape dramatically change from being single user based applications to the vast majority of new applications having some type of social aspect. Your users expect to be able to see application data on their mobile device, on the web, and to even share it via social networks. This has complicated mobile development because not only do developers have to focus on the core UI of the mobile application, they also have to develop and maintain a backend system for their application.
This presents a challenge for developers because you don't know if your application will have 5 users or 5 billion users. Trying to figure out the hardware requirements for your backend hardware without a good estimation of the number of users is an extremely complex and costly process. Deploying your application to a cloud based platform-as-a-service is the ideal solution for this problem. You can quickly deploy your backend code, including a web front end, to a PaaS on a free tier and then scale up if your application is a success. This will allow you to focus on your code instead of managing the infrastructure for your application.
Note: This blog post assumes that you have already installed the OpenShift Integration from the Appcelerator marketplace.
Step 1: Create SSH Key Pair
In order to communicate via git to your repository, we need to configure our ssh keys. To create a key pair, open up Titanium Studio preferences and expand the 'Network Connections' tab and select SSH2.
Note: If this is the first time using OpenShift, and you are creating an account, you can skip this part as Titanium Studio will generate a key for you. If you want to create an account via the web interface, head on over to openshift and signup.
If you don’t already have a ssh key created on your machine, select the Key Management tab -> Generate RSA Key. Provide a passphrase if you desire and then click Save Private Key. You will also want to copy your public key that is displayed so that we can add it to OpenShift.
Now that you have a key pair generated, we need to tell OpenShift what our public key is. Login to OpenShift website, click Manage your Apps, click on My Account, and select to Add a new key.
Give your new key a name of Titan and paste the key into the textfield provided.
Step 2: Create an OpenShift Project
Once you have the OpenShift plugin installed, you will need to create a new OpenShift project. At the time of this writing, the plugin support creating projects based on the PHP, Ruby, and Python languages.
In order to create a new project, select file -> new -> other -> expand cloud folder -> OpenShift project.
Once you select to create a new OpenShift project, you will be prompted to sign in. If you don't already have an account, you can create one at this point.
Step 3: Name your OpenShift project
At this point, you will be presented with a dialog box that will allow you to name your project and set the location of your project source files.
Once you have specified a name for your project, click finish and wait for the cloud servers to be configured.
After your OpenShift application has been created, you will see a new project appear in the project explorer. Titanium Studio will also open up a web browser tab to display your currently running application.
Step 4: Code
This is what you know and love to do.
Step 5: Deploy changes
Once you have modified your source files, pushing your change to your live OpenShift deployment is easy. The first think you need to do is commit the source file changes that you have made. Right click on your project, select team, and then commit.
Once you have added and committed any changes, you can then push your changes live by right clicking on your project, select team, and then push. This will perform a git push on your project files and deploy your changes to your OpenShift server.
That is all there to it to create and mange OpenShift servers from inside of Titanium Studio. If you have any questions about OpenShift, please visit our forums or find us on #openshift on the freenode irc network.
Step 6: What's next?
If you are interested in learning more about mobile development with a cloud based backend, check out a blog post series that I wrote that details how to get up and running with Titanium Studio, MongoDB, PHP, and OpenShift.
Developing a killer mobile app? Get entered in the Appcelerator Mobile Developer Challenge with $15k in prizes. More details on how to participate here.
Red Hat's OpenShift is also a platinum sponsor at this year's mobile event of the year, CODESTRONG. Register now to get an early bird discount to the show and make sure to check out the OpenShift talks or visit us on the exhibitor floor