How I ended up with .NET Core on Kubernetes for my Startup
It was a July evening in 2016 that I boarded the flight to Goa from Dubai. I was not on a holiday, but was returning, cancelling my visa in the cheapest flight available, bankrupt and disgusted of not being able to make it big after 4+ years of strenuous toil in a startup project.
I was determined to do it again, startup! But this time, I was extra cautious in selecting the right development tools, languages and platforms, for I had made a mess of it the very last time, thanks to my co-founder who tactfully persuaded me to choose .NET windows forms to build the most frequently used client program in a SMB business applications platform that worked over the internet.
This time at EXPRESSbase Systems, I was the solo founder, free to take any decision — technology or business, not an ideal situation for an ambitious SaaS startup that plans to build the next generation “high productivity” application platform as a service (hpaPaaS) for small to medium businesses (SMB). For the un-initiated, hpaPaaS is a rapid application development platform on the cloud in simpler terms.
I had a close look at Django/Python earlier, and quite liked it for its simplicity and superior architecture. A friend of mine suggested NodeJs, another suggested PHP/MySql. Java was definitely in mind as I had worked in it extensively prior to my rather long stint with C#.NET which was also in consideration for sure, as it was my favorite language.
Being a strongly/statically typed language advocate, I had a clear leaning towards Java & C#. The last time I had an adventurous ride with Java was in 2006, and this was 2016! Post 2004 I was mostly working in C#, during my professional assignments with PayPal, CSC, BMC Software and Microsoft.
I had always liked C# over other languages due to its elegance, real generics, native resource-management idioms (the using statement), LINQ, lambdas, better enumeration support with the yield statement etc. But two things that I didn’t like about C# & .NET was their closed-source nature and platform dependency (on Windows of course).
Back in November, 2014, Microsoft Corp. had reinforced its commitment to cross-platform developer experiences by open sourcing the full server-side .NET stack (ASP.NET, the .NET compiler, the .NET Core run-time, Framework and Libraries) and expanding .NET to run on the Linux and Mac OS platforms. Microsoft also released Visual Studio Community 2013, a new free edition of Visual Studio that provides easy access to the Visual Studio core tool-set.
In June, 2016, Microsoft announced the release of .NET Core 1.0, ASP.NET Core 1.0 available on Windows, OS X and Linux! .NET Core is a cross-platform, open source, and modular .NET platform for creating modern web apps, micro services, libraries and console applications.
Come October 2016, and my two dislikes about C# & .NET are no more. .NET Core is open source and platform independent. I always wanted to run C# on Linux. Now I can!
Thus .NET Core was chosen to be the development platform for EXPRESSbase.
I was always a fan of ServiceStack.NET, for its elegance, superior performance and futuristic architecture. ServiceStack had made its .NET Core version available in Oct, 2016 itself. All the more reason to zero in on .NET Core!
Choice of the Database was a no-brainer — PostgreSQL, for I had worked in it a lot more than other databases and I exactly knew what it can offer. On the front-end, after shuffling between VueJs, Angular and React initially, we ‘rolled back’ to JQuery as our team were more comfortable with it, and their comfort was more important to me.
Now that the primary technology stack for development was decided and the team started working on the MVP, I shifted my focus to “delivery/deployment”.
I was always curious about ‘Docker’, but never got a chance to use it in production albeit some childish experiments with it. I had a gut feeling that Docker is the way to go as I was planning to have micro services architecture. I asked my Tech Lead, who later became my Co-Founder to do a deployment Proof of Concept on Docker.
Two weeks later, we had docker images of all the microservices ready, using a home grown continuous integration/build shell script. When run, the shell script would prompt for a version number to tag docker images, then download latest code of all the microservice projects from the master branch of our git repositories, build them via command line (dotnet build), and then generate respective docker images based on the yaml files already defined. Once the docker images are ready, they are pushed to the Google container registry, from where the docker images are pulled to the staging and/or production Kubernetes clusters that we have setup in the Google Cloud using the generous $3000 free credit that Google gives to startups as part of their Google Cloud for Startups — Cloud Credit Program.
For PostGreSQL, we opted for Cloud SQL, a fully managed relational database service from Google cloud again. Redis was our choice for caching, but we avoided Cloud Memorystore — fully managed Redis again from Google Cloud, purely for economic reasons. Who wants to burn the free credits in a jiffy? We run a Redis pod in the Kube cluster that uses a persistent volume. Same is the case for RabbitMq.
We have been running .NET Core in production, for more than 6 months, touchwood!
Not to say that there were no discouragements when we chose .NET Core. The framework was in its very nascent stage, when we decided to adopt it. No sane head would choose an immature tool/language or platform to build their startup, yelled my good friends who had loads of experience working with .NET. But, I went ahead and took the risk, and it is definitely paying off in terms of stability, and blazing performance. With its faster release cycle, .NET Core can iterate faster on new features related to performance. It also has a huge open-source community around along with rock solid support from Microsoft. And we have seen a lot of work going into improving existing code and constructs in the framework.
I strongly recommend people using .NET framework to make their hands dirty with .NET Core and start planning a migration of their production environments and make full use of the power of Kubernetes.
Today I am on my way to Goa, this time indeed for a holiday!