The good old days
When OpenShift was in its version 1 it was great from customer’s point of view with low budget. OpenShift v1 had free offers to deploy app and add a custom domain to it. There was no SSL support but it could be handled via CloudFlare solution, making overall solution a great one.
Then there comes OpenShift v2
RedHat then launched OpenShift v2 and added a restriction that gears will be shutdown after certain period of inactivity and also removed the support for custom domain.
That was the time that we had to move to some other cloud platform that could support our apps with low resources and without investing anything.
Since all good things in life are free.
Google Cloud to the rescue
So we came across Google Cloud platform offering and we had $300 credit in free trial for next 6 months. That was more than enough for us to start with. And in fact they have micro virtual machine instances that are free for life with 30gb storage. That is more than enough for small apps to run for free that are under experiments or don’t have any monetization plans.
So, we migrated several of our apps from OpenShift to Google Cloud and started leveraging free credits provided by Google.
Just this week we consumed all our credit and our trial expired. Our virtual machine instances were shutdown, but it didn’t take long that we enabled billing on our project and downgraded our instances to micro ones which is free. That gave us such a relief that our apps are still running although with low resources but it is fine as that are not our revenue generating apps and are just experiments.
If you have a domain name and want to use OpenShift for hosting then using wildcard domain name is bit tricky with some domain registrars like GoDaddy. The reason is IP address of app on OpenShift doesn’t remain same and to use wildcard domain a DNS A record is setup with the IP address of hosting server. So, how do we make sure following to be true:
- user enters mysitename.com > user sees www.mysitename.com
- user enters mysitename.com/about.html > user sees www.mysitename.com/about.html
That is, the www prefix is always displayed anywhere on the site.
But due to the non-static IP of OpenShift app it is not possible to adjust the A record. But you can set up a cname with the following:
www > appname-username.rhcloud.com
where the format for the OpenShift app is
This means the site is accessible at www.mysitename.com but not at mysitename.com. To make it work you need to do the following.
On domain registrar like GoDaddy
– Create new Record with
Record Type CNAME
POINT TO: appname-username.rhcloud.com
- Setup Forwarding
Forward to: www.mysitename.com
Redirect: 301 (Permanent)
Type: Forward only
1. Select Application tab > select application appname-username.rhcloud.com > click change
2. Enter Domain name www.mysitename.com
That’s it! Wait for 10-15 min and see the magic.
I have curated a list of free tools, services, and apps that startups could and in fact should use to grow at the initial stage. Free doesn’t mean they lack quality, instead these free tools are from top-notch companies like RedHat, Google, Asana, GitHub and in all areas from infrastructure to version controlling to marketing and sales to project management.
Have a look at this list here and don’t forget to give your feedback.
I compiled this list a long time ago and recently updated it but it still might have some outdated links that I didn’t get chance to update yet. Feel free to let me know and I’ll update it.
If you’ve been developing ASP.Net MVC apps lately you might be thinking some online or cloud based app hosting platform available as PaaS for Microsoft technologies specially for hosting ASP.Net MVC apps just like OpenShift, Heroku and other platforms are available for technologies like Ruby, Python, PHP, Node.js and even supporting CMS like WordPress. The good news for ASP.Net developers is that there is a PaaS platform available which you might already know. The platform is AppHarbor. AppHarbor runs over Amazon AWS and has some nice features that I won’t go into the details of. If you are interested in knowing how AppHarbor works you can see their page here.
Regardless of AppHarbor provides a decent service, new developers might still face some difficulty in deploying their applications to AppHarbor. Specially, if you are developing apps based on new Visual Studio 2015 templates like MVC. Their are different ways to deploy but I would follow below approach which in my opinion is good and provide auto deployment or in other words Continuous Integration (CI).
What you need?
We will be using following tools and accounts.
- Visual Studio 2015 (any edition, I used Professional version)
- ASP.Net MVC app created from VS2015 MVC template
- GitHub repo for the app/project
- Local git repo for app with remote repo set as your GitHub app repo
- AppHarbor app
What’s not covered?
Our focus today is deployment of our ASP.Net MVC app to AppHarbor. Therefore, we won’t be going into the details of how application is created or its architecture, what’s new in Visual Studio 2015, what is MVC, what is Git and GitHub, and how to connect your GitHub repo to AppHarbor etc. We will assume that you already have all the pre-requisites and we will just focus what problems can we come across during deployment and how to fix them.
- Initialize a Git repo and connect it with your GitHub repo.
- Create AppHarbor app from your GitHub repo. Whenever we commit/push our changes to our GitHub repo AppHarbor will automatically fetches the latest push and build it. Upon successful build it will deploy the app on its server otherwise it will keep last successful build. This makes things very easy.
- Create an ASP.Net MVC application using Visual Studio 2015 MVC template.
- Add the packages folder to .gitignore
- Enable NuGet Package Restore. In VS2015 click Tools>Options and then select NuGet Package Manager and make sure both checkboxes are checked in this section.
- In VS2015 right click on project and click properties, then goto Build Events tab. In the Post-build event command line text area paste the following command.
- if not exist “$(WebProjectOutputDir)\bin\Roslyn” md “$(WebProjectOutputDir)\bin\Roslyn”
start /MIN xcopy /s /y /R “$(OutDir)roslyn\*.*” “$(WebProjectOutputDir)\bin\Roslyn”
- Now commit and push your changes to GitHub.
- That’s it! AppHarbor will automatically fetch the latest version changes and build it and you can check your AppHarbor application on its URL.
There are few things that you need to take care of specially related to security. This MVC app uses SQL Server Compact which isn’t a good option for production level apps. Secondly, your connection string or password to database must not be committed to public GitHub repo.
This post will just give you smooth start without any difficulties which I faced among other people that you can see in the resources section below.
If you think this was helpful or if I have missed anything please do let me know in the comments below.
After installing Ruby installer you might need to install some gems. For example if you are developing with RedHat OpenShift you want to install ‘rhc’ gem to access remote files on OpenShift. To install ‘rhc’ you would run following command.
>gem install rhc
But you might get following error specially on Windows machine.
>gem install rhc
ERROR: Could not find a valid gem 'rhc' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
ERROR: Possible alternatives: rhc
The problem is due to running over a secure (https) connection to rubygems.org. Look at the help for “gem sources –h”, remove the https version and add http://rubygems.org
Run the following commands to do this.
>gem sources --remove https://rubygems.org/
>gem sources --add http://rubygems.org/
And now you can easily install any gem.