Good Practices for Using Heroku

Dec 1, 2015

The nice thing about using Heroku is that it is very simple to deploy. Just git push Heroku master. There are, however, just a few simple bad practices to eliminate. For instance, it’s important not to store configurations in your code. Also don’t assume anything in memory will persist between requests, such as in session memory; or that any any local storage exists on the server.

While writing your own deployment script may only take a few minutes, it would take more time in the future to upgrade the host system. With Heroku, you get automatic upgraded systems, and databases to prevent system rot. For example, when you deploy to amazon AWS, you are responsible for upgrading the system. I think my personal web app on AWS is still using ubuntu 12.10, from 2012. Now obviously upgrading one app is easy, but if I had 100 apps on different systems, it would take far longer to upgrade and test.

The 12 factor app, Heroku’s manifesto of how apps should be deployed onto its system, is actually a good practice to follow anywhere. Its third rule, of storing configs in environmental variables, is the simplest method to deploy, but hardest to setup in your local development environment. I actually used to store configurations inside the code itself, which is easy to develop but harder to deploy. In python, I’ve learned to use sandboxed environmental variables in my virtual-environment bin/postactive script.

Each app has all its dependencies declared using the language’s package manager. However when using multiple languages such as python and node, you can use multiple build packs, https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app.

There are many good features about Heroku. The command line tool, heroku toolbelt, is very intuitive. It reminds me of the best features of most essential tools like git and ionic. To run custom scripts, just run heroku run –app APPNAME command. The time it takes to deploy a new version production is in minutes.

Obviously the worst part is the price, but if you follow best practices, it shouldn’t be hard to switch to another provider. Docker is similar to heroku, so you can actually use docker on heroku, https://devcenter.heroku.com/articles/docker.

RECENT POSTS

The Agile Manifesto in Practice: Part 1

The Agile Manifesto in Practice: Part 1

  How Sourcetoad Values People Over Process The software development process can involve a lot of uncertainty for both development teams and clients alike, especially in the early phases of a project. How can the long-term vision of an application be balanced...

What to Consider When Building HIPAA-Compliant Software

What to Consider When Building HIPAA-Compliant Software

In 1999, the Department of Health and Human Services (HHS) passed the Health Insurance Portability and Accountability Act (HIPAA) as a measure to protect personal health information (PHI) and allow people control of their healthcare records. The HITECH Act was enacted...

The Evolution of Buy Now, Pay Later in eCommerce: Part 2

The Evolution of Buy Now, Pay Later in eCommerce: Part 2

In Part 1, we talked about the rapid growth of Buy Now, Pay Later (BNPL) and discussed its expansion across industries. In Part 2, we will consider how impending regulation may shake up the short-term lending space.   Impending Regulation of BNPL While consumers...