Skip to content

Commit 693566c

Browse files
committed
add production description
1 parent 2869aa2 commit 693566c

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

production/README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Running pdf-bot in production
2+
3+
## Run pdf-bot using pm2
4+
5+
It is recommended to use [pm2](https://github.com/Unitech/pm2) to run a pdf-bot process.
6+
7+
First install `pm2`
8+
9+
```
10+
npm install -g pm2
11+
```
12+
13+
[Create a configuration file using the one in this repo as an example](https://github.com/esbenp/pdf-bot/blob/master/production/pm2.config.js)
14+
15+
`pdf-bot-process.config.js`
16+
```javascript
17+
module.exports = {
18+
apps : [{
19+
name : "pdf-bot",
20+
script : "pdf-bot",
21+
args : "api -c ./pdf-bot.config.js",
22+
// Should be from whatever folder your pdf-bot.config.js is in
23+
// cwd : "/home/[user]/",
24+
env: {
25+
"DEBUG" : "pdf:*",
26+
"NODE_ENV": "production",
27+
},
28+
}]
29+
}
30+
```
31+
32+
Run in using `pm2 start pdf-bot-process.config.js`
33+
34+
[Read more about starting the app on server restarts](http://pm2.keymetrics.io/docs/usage/startup/)
35+
36+
## Use nginx to proxy requests
37+
38+
If you run `pdf-bot` on port 3000 or similar it is recommended to run it behind an nginx proxy.
39+
40+
Create a site that listens to port 80 and uses the [config from the `production/` folder](https://github.com/esbenp/pdf-bot/blob/master/production/nginx.conf)

production/nginx.conf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
server {
2+
listen 80 default_server;
3+
listen [::]:80 default_server;
4+
5+
server_name pdf-bot;
6+
7+
location / {
8+
proxy_set_header X-Real-IP $remote_addr;
9+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
10+
proxy_set_header Host $http_host;
11+
proxy_set_header X-NginX-Proxy true;
12+
proxy_pass http://127.0.0.1:3000/;
13+
proxy_redirect off;
14+
proxy_http_version 1.1;
15+
proxy_set_header Upgrade $http_upgrade;
16+
proxy_set_header Connection "upgrade";
17+
18+
proxy_redirect off;
19+
proxy_set_header X-Forwarded-Proto $scheme;
20+
}
21+
}

0 commit comments

Comments
 (0)