- npm install
- Setup mongo at localhost:27017
- In mongoShell, create new db and user. (update file config/keys.js)
- npm run server
- ngrok http 8080
- Place ngrok url on dialogflow webhook url
-
clone repo to /var/www/ and
npm install
inside -
Install mongodb
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
-
Launch mongodb as a service In
sudo nano /etc/systemd/system/mongodb.service
, paste the follow[Unit] Description=High-performance, schema-free document-oriented database After=network.target [Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
-
Start mongo service
sudo systemctl start mongodb
(check if it's active by runningsudo systemctl status mongodb
-
Open mongoshell and create db
mongo
use kookapp
-
Create db user
db.createUser({user:"kookapp", pwd:”kookapp", roles:[{role:"readWrite", db:"kookapp"}]})
-
Let mongo service start on startup
sudo systemctl enable mongodb
-
Install node
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash
sudo apt-get install nodejs
-
Install PM2
sudo npm install pm2@latest -g
-
create webhook.config.js at /var/www/ with:
module.exports = { apps : [{ name : "KookAppWebHook", script : "index.js", watch : true, merge_logs : true, cwd : "/var/www/KookAppWebHook", }] }
-
start app with PM2
pm2 start webhook.config.js
-
forward port 8080 to 80
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to 8080