Skip to content

Commit cbe87ed

Browse files
committed
Add Heroku support + deployment documentation
1 parent 2360f3d commit cbe87ed

File tree

2 files changed

+68
-8
lines changed

2 files changed

+68
-8
lines changed

docs/deploying.md

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,66 @@
22

33
Here you find how to deploy your application to a Server.
44

5+
6+
## Heroku
7+
8+
1. Set up botpress locally with all the dependent modules installed and configured
9+
* (if using messenger module) make sure you disable Ngork before uploading to heroku
10+
11+
2. You need a [free Heroku account](https://signup.heroku.com/dc) and [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) installed
12+
13+
3. Check package.json to be sure all dependencies are included
14+
1. you can add custom dependencies using `npm install <pkg> --save`
15+
2. Add node version to `packages.json`
16+
```javascript
17+
"engines": {
18+
"node": "7.1.0"
19+
},
20+
```
21+
22+
4. Specifying a start script [Procfile](https://devcenter.heroku.com/articles/procfile) or make sure you have the start script in your packages.json
23+
24+
25+
So your final package.json should look something like this:
26+
```javascript
27+
{
28+
"name": "AwsomeBot",
29+
"version": "0.0.1",
30+
"description": "botishness",
31+
"main": "index.js",
32+
"dependencies": {
33+
"botpress": "0.x",
34+
"botpress-analytics": "^1.0.7",
35+
"botpress-hitl": "0.0.1",
36+
"botpress-messenger": "^1.0.16",
37+
"botpress-scheduler": "^1.0.1",
38+
"botpress-subscription": "^1.0.2"
39+
},
40+
"scripts": {
41+
"start": "botpress start",
42+
"test": "echo \"Error: no test specified\" && exit 1"
43+
},
44+
"author": "sbeta",
45+
"license": "AGPL-3.0",
46+
"engines": {
47+
"node": ">6.0.0"
48+
}
49+
}
50+
51+
```
52+
53+
54+
5. Try it locally and see if it works: `heroku local web`
55+
56+
6. 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`
57+
58+
7. Go to Heroku dashboard -> Settings and in the Config Variables section add a password for your dashboard:
59+
```
60+
BOTPRESS_PASSWORD : <YOUR_ST0nG_PasSwoRd>
61+
```
62+
63+
----------------------------------------------------------------------------------------------
64+
565
## Amazon AWS (EC2)
666

767
#### 1 - First you need to have a custom domain name bought (can be bought in AWS)
@@ -75,18 +135,18 @@ Obs2: If you use windows [Git Bash (Distributed with Git for Windows)](https://g
75135

76136
7.2 - Next you need to compile some source files
77137

78-
```sudo apt-get install build-essential```
138+
```sudo apt-get install build-essential```
79139

80140
7.3 - You can run ```npm --version``` and ```node --version``` to check if instalation is ok.
81141

82142
#### 8 - [Install pm2 to manage process](https://github.com/Unitech/pm2)
83143

84-
```npm install -g pm2``
144+
```npm install -g pm2``
85145

86146
#### 9 - [Setup Nginx and pm2](https://doesnotscale.com/deploying-node-js-with-pm2-and-nginx/)
87147

88148
#### 10 - Clone your project inside some server folder (i like to put into /var/app/myapp)
89149

90150
9.1 - Go to your app folder and run ```npm install```
91151

92-
9.2 - Put your app into production! ```pm2 start npm -- start``` that's all folks!
152+
9.2 - Put your app into production! ```pm2 start npm -- start``` that's all folks!

src/cli/templates/init/botfile.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ module.exports = {
55
* where the content is stored
66
* you can access this property from `bp.dataLocation`
77
*/
8-
dataDir: process.env.BOTPRESS_DATA_DIR || "./data",
8+
dataDir: process.env.BOTPRESS_DATA_DIR || './data',
99

10-
modulesConfigDir: process.env.BOTPRESS_CONFIG_DIR || "./modules_config",
10+
modulesConfigDir: process.env.BOTPRESS_CONFIG_DIR || './modules_config',
1111
disableFileLogs: false,
12-
port: process.env.BOTPRESS_PORT || 3000,
12+
port: process.env.BOTPRESS_PORT || process.env.PORT || 3000,
1313
optOutStats: false,
1414
notification: {
1515
file: 'notifications.json',
@@ -25,8 +25,8 @@ module.exports = {
2525
*/
2626
login: {
2727
enabled: process.env.NODE_ENV === 'production',
28-
tokenExpiry: "6 hours",
29-
password: process.env.BOTPRESS_PASSWORD || "password",
28+
tokenExpiry: '6 hours',
29+
password: process.env.BOTPRESS_PASSWORD || 'password',
3030
maxAttempts: 3,
3131
resetAfter: 5 * 60 * 10000 // 5 minutes
3232
}

0 commit comments

Comments
 (0)