Wiki

Clone wiki

heroku-buildpack-d / Home

D buildpack for Heroku

This buildpack provides basic support for launching a Heroku application written in D.

It uses the DMD compiler, the dub package manager from the Vibe.d project to manage project dependencies, plus a few extra hooks.

Configuring a D project to run on Heroku

# New apps
$ heroku apps:create -s cedar --buildpack https://bitbucket.org/mikehouston/heroku-buildpack-d.git

# Existing apps
$ heroku config:set BUILDPACK_URL=https://bitbucket.org/mikehouston/heroku-buildpack-d.git

# Push a D project to Heroku
$ git push heroku master
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 316 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> D (dub package manager) app detected

-----> Setting PATH: /tmp/build_2vmfluepultgk/toolchain/dmd2/linux/bin64:/tmp/build_2vmfluepultgk/toolchain/dub-0.9.13-linux-x86_64/bin:/tmp/buildpack_2vmfluepultgk/bin::/app/vendor/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

-----> Initializing toolchain

...

-----> Building app

       Running dub-prebuild…

...

       Running dub build…
Checking dependencies in '/tmp/build_2vmfluepultgk'
Building configuration "application", build type release
Running dmd (compile)...
Compiling diet template 'index.dt' (compat)...
Linking...

       Build was successful
-----> Discovering process types
       Procfile declares types -> web

-----> Compiled slug size: 4.4MB
-----> Launching... done, v10
       http://abc-xyz.herokuapp.com deployed to Heroku

heTo git@heroku.com:abc-xyz.git
   1ab1dc3..ab72237  master -> master

dub-prebuild hook

The buildpack will optionally call a script in the root of the build directory called dub-prebuild. This script is called with two arguments, $BUILD_DIR and $CACHE_DIR, which are used by the buildpack.

You can use this hook to set up any private dependencies, compile additional libraries, etc. There's an example of what you might use the hook for on the page about Running a Vibe.d application.

Updated