Heroku uses buildpacks to compile your application into a slug that is used across dynos for scaling horizontally quickly. A slug is a tar.gz archive of your app’s repository with certain pre-deploy features baked into the filesystem. Since everything to run your application is included in the archive, scaling becomes a simple matter of transferring it to a dyno, unpacking, and running the appropriate process. This is how Heroku achieves scaling-by-moving-a-slider.
For example, the Ruby buildpack will:
- install ruby locally
- install the jvm/jruby (if you’re using it)
- install/run bundler and install your gems to Rails.root/vendor
- create your database.yml (which ends up reading from your app’s environment variables)