After giving it some thought we knew that we were wasting time going down that road, so we quickly turn away. We knew that everything that we were doing was probably already built-in into Django, which we had used many times before and we knew was battle tested by other companies we look up to, like Disqus and Instagram. With this move we had the option of keeping MongoDB as our main database, but decided to go with PostgreSQL and take full advantage of the Django ORM.
Our system is constantly evolving into something we are all very proud of and this is a glimpse of it.
The core application is built on Django and runs on Heroku. We chose Heroku for various reasons but mainly because how incredibly easy it is to scale resources to handle and accommodate more requests and load. Heroku also let’s us easily use Gunicorn as our WSGI server. We use Fabric to run all of our deployments and other sysadmin tasks. I recently released a Django project template with a collection of settings and Fabric tasks specially useful for projects on hosted on Heroku.
Since we are already on Heroku, we used their Postgres database as a service which is used and managed as any other Heroku add-on, making it easy to scale when its time. Our core application’s main database is all on Postgres.
We recently provisioned an Amazon EC2 instance with Memcached and Redis. Memcached is our main cache backend and Redis is used as the message broker for Celery and to cache application wide stats. We managed to automate the provisioning and setup of new cache and worker servers on Amazon EC2 which allows us to spawn new instances ready for production in a matter of minutes.
Static files and user uploads are hosted on Amazon S3. We also use Amazon (Route 53) for our DNS servers.
For most user actions we generate async events using Celery. Some events trigger emails, some trigger internal notifications, and others trigger event logging. Everytime an event is created we push the task into a queue which Celery consumes. All expensive jobs are executed asynchronously on the background.
Monitoring and Error Logging
One of the cool things about hosting on Heroku is the long list of awesome addons that can easily integrate with your app, one of them being New Relic. The add-on provides seamless integration with the Heroku platform giving us the capability of monitoring and fine tuning our application’s performance. New Relic gives us 24/7 snapshots of the app’s health and availabilty, back and front-end performance, web transactions, database calls, and more.
For application wide stats like how many users we have, how many projects per company on average and many more, we use Hasselblad, an app we made in-house to monitor KPIs. We might open source this in the future. Right now is very rough but it works great.
Handling transactional emails has always been a pain. We use Postmark, another great product from Wildbit, on all of our projects, because it just simply removes that pain. We can monitor our volume, bounces, spam complaints, send activity, insights to know if our messasges are being receiced and have peace of mind. Wildbit has great products, an awesome team, and fantastic support!
Billing and Payments
We are using Stripe, we’ve been talking with the guys over at Stripe since they were in beta and they have given us a lot of help. Online payment solutions are a pain to get started with, you need a business bank account, merchant account, payment gateways, fees, etc. Stripe removes almost all of the pain, we are very happy.
That’s basically it. We plan to write more posts like this one. We are working on one about the client side tech stack, that should be published pretty soon. Feel free to ask further questions about our tech stack on the comments below.