Writing Grasruts From Scratch?
For a year, Grasruts embraced Catarse, an open sourced Brazilian crowdfunding platform. It had such a nice UI and many neat features but it was a big piece of software. It could not run all of its feature in our ec2 t2.nano instance and for obvious reason we had to disable its background processing component. And even with that disabled, it was still consuming 700 MB of our memory. With my limited knowledge in Rails and Mithrilljs solving bugs or adding new custom feature was a nightmare. A big sign of technical debt for the future. However, it was perfect enough for us to test our MVP.
Since, we disabled its background processing component, we had to do a lot of manual work like sending emails, updating postgresql materialized view, checking constantly if new contributions was made or new campaign was started. While we should have been focusing on marketing and business and management, we were stuck doing those manual works every fucking day. It was just not productive.
It was time for us to build a new platform. We gathered a year worth of data and started brain storming for features. The main objective was automation but we also wanted the platform to consume less memory.
In 3 months, we were able to put up a monolith app while working couple of hours a day. It is fascinating, how productive working on Rails can be.
Grasruts, is built on top of open source tools and it will only be fair if we open source the platform too. With open sourcing this, we want every crowdfunding enthusiast who is planning to start a crowdfunding platform to get up and running quick. We want these crowdfunding enthusiast to test their idea rather than spend months on creating a platform.
And before finishing this blog, here are couple of things that I found to be cool shit.
Keeping memory usage to low
This time, since I was well aware of the consequences of using sidekiq, I compiled my ruby with Jemalloc.
Limiting the number of sidekiq threads and unicorn threads because we receive limited traffic.
Migrating old data to new server
We not only wrote code from scratch but designed our database from zero too. This proved to be costly while migrating our old data. We wrote rake tasks that read from an excel sheet and persisted the data to new server.
Automate Automate Automate
Dont just automate your deployment. Automate your process for creating server config files, sidekiq config files, etc.
Use tools like sentry to get notified of errors in production environment.