My Home on the Web. Where the Code Snippets Run Free.

Posts Tagged openshift

Android App – COMP3617 – Part 2

Android App - COMP3617 - Part 2

Server Side Solution – OpenShift As the course is just beginning to ramp up, I spent time this week looking for a server-side solution. Unfortunately, BlueHost (which hosts this site) doesn’t provide a JEE container on their shared hosting plans. Thankfully,CodeRanch provides an extensive list of hosts. I settled on OpenShift PaaS by Red Hat. OpenShift provides a Web Console for configuring your project and the rhc command line tool interface. You can download the rhc and find instructions here. OpenShift also support Maven builds and deploys with a git push . A Short Interlude Before I get into this week’s topic, I posted a tutorial for my COMP3617 classmates on setting up Android Studio on Mac. The setup is different then a vanilla installation, due to specific system requirements mandated by the instructor, and therefore I don’t recommend this installation configuration for anyone except COMP3617 classmates. The tutorial is available here. While you are at it, check out this older post on setting up Visual Studio on Mac via Oracle’s VirtualBox. Setting Up OpenShift with JEE Containers OpenShift’s free accounts provides support for three “small” gear cartridges. Cartridges can be web frameworks, databases, monitoring services, or connectors to external backends. For JEE Containers, multiple versions of Tomcat (labeled as jbossews), JBoss, and Wildfly are provided as Cartidges. MySQL, PostGreSQL and MongoDB also provided. You can also provide your own cartridge via the DIY cartridge support. Some cartridges are more supported than others, though. Right now, Wildfly 8, Wildfly 9, and Wildfly 10 are all provided, but OpenShift doesn’t provide security updates for those yet. If you don’t want to deal with updates, check out the JBoss or Tomcat cartridges. For this project, I’ll be using Tomcat 7 and PostGreSQL. To setup using the  rhc command line tool interface: rhc setup to begin the process. During this step, you will be asked to connect to your OpenShift account, setup up SSL Keys and choose a domain name. The domain name you select will be hosted by OpenShift on , while your individual app project will be under the domain you specified. I went with “bubbleapps”, so my domain will be . rhc app-create <name> <cartridge>  to create  the app under your domain. Entering only  rhc app-create will show you the list of available cartridges. Bringing it all together: rhc app-create server jbossews-2.0 -s That is it. The “-s” will install a scaling module to let OpenShift automatically scale connections are required. Once OpenShift finishes, you’ll have an application called “server” using TomCat 7 live. Instructions will be provided explaining how to clone the remote git to your local machine to begin development. You can find mine here: One Final Step If you host your own domain and don’t like the URL provided by the rhcloud, you can add a domain alias to map to your own. For example, the above domain is also mapped to the more visually appealing I found aliasing by the Web Console was easier, but you can also alias by the command line using: rhc alias-add <application> <alias> rhc alias-add server Also don’t forget to add the entry to your domain’s CName records!   Next week I’ll be on vacation. TTYL.   What’s This About? This series documents my learning and development in Android as part of the BCIT : COMP 3617 – Android and Mobile Applications in Java course. This course is also my final course in the Advanced Java Development: Part-time, Associate Certificate offered at BCIT. Previously, we laid out the foundation concept for the final project. This week, I’ll work on the server side and flush out the app design plan.

Read more