nchan-buildpack
June 29, 2020 ยท View on GitHub
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
- nchan
- Heroku's static/nginx buildpack
- Heroku buildpack documentation
- nginx buildpack