Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

ABANDONED - Please use the official heroku build pack that is now up-to-date

Notifications You must be signed in to change notification settings

attilagyorffy/heroku-buildpack-nodejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Heroku buildpack: Node.js

This is a custom Heroku buildpack for Node.js applications that run on the Cedar runtime stack on Heroku. It uses NPM and SCons.

Quick start

Example usage:

$ ls
Procfile  package.json  web.js

$ heroku create --stack cedar --buildpack http://github.com/liquid/heroku-buildpack-nodejs.git

$ git push heroku master
...
-----> Heroku receiving push
-----> Fetching custom buildpack
-----> Node.js app detected
-----> Vendoring node 0.6.13
-----> Installing dependencies with npm 1.1.0-2
       [email protected] ./node_modules/express
       ├── [email protected]
       ├── [email protected]
       └── [email protected]
       Dependencies installed

The buildpack will detect your app as Node.js if it has the file package.json in the root. It will use NPM to install your dependencies, and vendors a version of the Node.js runtime into your slug. The node_modules directory will be cached between builds to allow for faster NPM install time.

Customization

You can create your own buildpack in order to use different versions of Node.js and/or NPM. To change the vendored binaries for Node.js, NPM, and SCons, use the helper scripts in the support/ subdirectory.

You are going to need the following:

Workflow:

  • Fork this buildpack on Github and clone it to somewhere in order to make changes to it

  • Set the nexessary environment variables in your shell:

      $ export AWS_ID="YOUR-AWS-ID" AWS_SECRET="YOUR-AWS-SECRET" S3_BUCKET="YOUR-S3BUCKET-NAME"
    
  • Create your S3 bucket (in case it doesn't exist yet):

      $ s3 create $S3_BUCKET
    
  • Customise your version of Node that you want to use by running ./support/package_node with the desired version of Node. The script will compile Node and push the binaries ready onto your S3 bucket:

      $ ./support/package_node 0.6.13
    
  • Open bin/compile in your editor, and change the following lines:

      NODE_VERSION="0.6.13"
      S3_BUCKET=zzz
    
  • Commit and push the changes to your buildpack to your Github fork

  • Create a test application that makes use of your custom buildpack and push to it:

      $ heroku create --buildpack <your-github-url>
    
  • You should see:

      -----> Vendoring node 0.6.13
      -----> Installing dependencies with npm 1.1.0-2
    

About

ABANDONED - Please use the official heroku build pack that is now up-to-date

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%