Deployment Steps For Heroku & mLab
- Signup for Heroku
- Signup for mLab
- Create DB notable in mLab
- Add user in mLab
- Update DB url in node server
mongodb://<dbuser>:<dbpassword>@ds149122.mlab.com:49122/notable
6. Test notable app
7. Install Heroku - refer doc https://docs.google.com/document/d/1McXVRadb18VPX7LMQa2OZkZYphbtiF4P2Jxz6PuLqkI/edit?usp=sharing
8. Add (specify version of node) to package.json
"engines": {
"node": "6.10.1"
}
9. Add Procfile to root
web: node server.js
10. Edit /client from notes_routes.js to app.get('/',function(req, res) {
11. Make Common Base URL on script1.js and script2.js
var getUrl = window.location;
var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1];
console.log(baseUrl);
11. Add .gitignore file to root
/node_modules
npm-debug.log
.DS_Store
/*.env
npm-debug.log
.DS_Store
/*.env
12. Change Port on server.js
const port = process.env.PORT || 8000;
10. Build and run locally
npm install
heroku local web
12. Deploy your application to Heroku
git add .
git commit -m "first commit"
heroku login
Enter your Heroku credentials.
...
...
heroku create ukifunwork2byname
git push heroku master
Optional (if above fails)- Add heroku git remote
heroku git:remote -a yourapp
And retry git push heroku master
heroku open
For Logging
heroku logs --tail
No comments:
Post a Comment