Skip to content

andjosh/nchan-buildpack

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
 
 
 
 
 
 
 
 

nchan-buildpack

This Heroku buildpack will automatically build, configure, and run nchan for you.

Usage

This buildpack will only be triggered if your app (deployed to Heroku) contains a nchan.conf.erb file at its root. See below for configuration options. If you don't know what to configure, you can simply copy the nchan.conf.erb template.

To use the buildpack, run:

$ heroku buildpacks:add https://github.com/andjosh/nchan-buildpack.git

Configuration/Options

This buildpack currently installs Nchan v1.2.7 and Nginx v1.18.0 by default. To use a different version of Nchan, specify a tag in the heroku buildpack URL (to request a new version of Nchan be tagged, please open an issue).

# env variables available (with default) in the default nchan.conf
# set upon web server/process start
NCHAN_WORKERS=auto
NCHAN_WORKER_CONNECTIONS=1024
NCHAN_SUB_TIMEOUT=25
PORT=<set by heroku>

See configuration directives for nchan to populate your own nchan.conf.erb.

If you decide to use your own Procfile (e.g. you want to run a local auth server for nchan), be sure to also launch nchan by executing bin/boot along with your sister app. Here's an example running a node server:

web: (PORT=3000 npm start) & bin/boot

If you want nchan/nginx to wait until another app has started before booting itself, you can set the environment variable NCHAN_INITIALIZE_APP to any value. If present, nchan will wait until a file at /tmp/app-initialized exists before booting itself.

NCHAN_INITIALIZE_APP=true
# then, to finish booting nchan:
touch /tmp/app-initialized

Testing

git clone https://github.com/andjosh/nchan-buildpack.git
git clone https://github.com/heroku/heroku-buildpack-testrunner.git

Once you have both installed (and shunit2), follow the directions in the Heroku Buildpack testrunner README.

cd heroku-buildpack-testrunner
./bin/run ../nchan-buildpack

Acknowledgements