Skip to content

Installing the Node.js Client on Heroku

Background

Imaging you have a node.js applciation running on heroku and now you want to add the ability to read Technical Drawings through Werk24. Then you are going to face the challenge, that the Node.js Werk24 Wrapper requires the installation of the Werk24 Python Client. Your single buildpack will thus not be enough, and you need to select multiple buildpacks for your app. This small tutorial guides you thorugh the steps.

Step 1: Add Python buildpack

Heroku allows you to add an additional buildpack to your application with the buildback:add command. The following command adds the python buildpack.

heroku buildpacks: add --index 1 heroku/python

Step 2: Ensure buildpack order

The buildpack for the primary language - in this tutorial Node.js - should always be the last buildpack in the list. Default values are added in-order and later settings override earlier ones.

You can check whether your buildpack list is ordered correctly with the followign command. So

heroku buildpacks
=== XXX Buildpack URL
1. heroku/python
2. heroku/nodejs

For details refer to Heroku: Using Multiple Buildpacks for an App.

Step 3: Create requirements.txt

The requirements.txt tells heroku which werk24 dependencies you need to run your application. Depending on your development guidelines, you can either peg the version (==0.5.0rc5) - the first that supports nodejs, or you can set automatically update to new versions. When you do this, make sure that you include the integration tests to ensure that new versions do not break your system.

werk24>=0.5.0rc5

Step 4: Add runtime.txt

The runtime.txt tells heroku which python version you want to run. The werk24 python client is tested on 3.7.x and 3.8.x. If you have no other requirements, we recommend to use the latest python 3.8.x version.

python-3.8.6

That's it. You can now stage your environment.