Deploying to Heroku
Set up botpress locally with all the dependent modules installed and configured
- (if using messenger module) make sure you disable Ngork before uploading to heroku
You need a free Heroku account and Heroku CLI installed
Check package.json to be sure all dependencies are included
- you can add custom dependencies using
npm install <pkg> --save
- Add node version to
packages.json
"engines": { "node": "7.1.0" },
- you can add custom dependencies using
Specifying a start script Procfile or make sure you have the start script in your packages.json
So your final package.json should look something like this:
{ "name": "AwsomeBot", "version": "0.0.1", "description": "botishness", "main": "index.js", "dependencies": { "botpress": "0.x", "botpress-analytics": "^1.0.7", "botpress-hitl": "0.0.1", "botpress-messenger": "^1.0.16", "botpress-scheduler": "^1.0.1", "botpress-subscription": "^1.0.2" }, "scripts": { "start": "botpress start", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "sbeta", "license": "AGPL-3.0", "engines": { "node": ">6.0.0" } }
Change botfile.js to use the port exposed in the environment variable
PORT
:port: process.env.PORT || 3000,
Make sure sure your bot is configured to connect to a Postgres database, as instructed in the How to use the built-in Database article.
Try it locally and see if it works:
heroku local web
Go to Heroku dashboard and make a new app and from there you can follow the instruction to get botpress on heruko
Deploy using Heroku Git
Still in the Heroku dashboard, add the Postgres Add-on to your app, following the
Heroku Postgres
instructions.Go to Heroku dashboard -> Settings and in the Config Variables section add a password for your dashboard:
BOTPRESS_PASSWORD : <YOUR_ST0nG_PasSwoRd>
Still in the Config Variables section, add the following variables to enable the database connection (you can find the values in the Postgres Add-on dashboard -> Administration -> Database Credentials):
DATABASE : 'postgres' PG_HOST : <Your database host> PG_PORT : <Your database port> PG_USER : <Your database user> PG_PASSWORD : <Your database password> PG_DB : <Your database identifier>