deployment to heroku · 2. create an application using the heroku command line 3. provision a...
TRANSCRIPT
![Page 1: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/1.jpg)
Deployment to Heroku
![Page 2: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/2.jpg)
• Platform as a Service (PaaS).
• Offers simplified node.js application deployment & management
![Page 3: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/3.jpg)
Requirements
• Sign up for a free account on heroku
• Install Git
• Install Heroku Command Line
![Page 4: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/4.jpg)
Requirements
• Sign up for free mLab account
![Page 5: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/5.jpg)
Deployment: 7 Steps
1. Commit project to git
2. Create an application using the heroku command line
3. Provision a MongoDB database
4. Prepare package.json for deployment
5. Push the application to heroku remote
6. Enable ‘Production’ mode, db connection, & restart
7. Monitor the Heroku Logs
![Page 6: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/6.jpg)
1: Commit project to git
• Create gitignore file
• add all files
• commit all files
![Page 7: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/7.jpg)
2: Create an application using the heroku command line
![Page 8: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/8.jpg)
3: Provision a MongoDB database
Require Credit Card Registration
![Page 9: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/9.jpg)
3: Create Mongo Database on MongoLab• Create Database + Create Special User for database
• Extract ‘Connection String’
![Page 10: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/10.jpg)
4: Prepare package.json for deployment
• define ‘start’ script
• then commit this change:
{ "name": "donation-web", "version": "1.0.0", "description": "an application to host donations for candidates", "main": "index.js", "scripts": { "start": "node index", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "handlebars": "^4.0.5", "hapi": "^14.1.0", "hapi-auth-cookie": "^6.1.1", "inert": "^4.0.1", "joi": "^9.0.4", "mongoose": "^4.5.8", "vision": "^4.1.0" } }
![Page 11: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/11.jpg)
5: Push the application to heroku remote
• Use git to transmit app sources to heroku
• Browse to the deployed url
![Page 12: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/12.jpg)
6: Enable ‘Production’ mode
• Although the app will launch, we will not be able to get beyond the sign up screen. Trying to register a new user will generate an internal error on the app.
• Need to reset the app to production mode, and restart
![Page 13: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/13.jpg)
6: Set db connection string & restart
• On Command Line, set MONGOLAB_URI to connection string harvested from mLab
• Restart the app
![Page 14: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/14.jpg)
7: Monitor the Heroku Logs
![Page 15: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/15.jpg)
Connect Robomongo to mLab
• The database we are now using is in the cloud - and it might be useful to be able to browse directly to it.
• For this url
• This encodes the following connection settings:
![Page 16: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/16.jpg)
Robomongo Connection
![Page 17: Deployment to Heroku · 2. Create an application using the heroku command line 3. Provision a MongoDB database 4. Prepare package.json for deployment 5. Push the application to heroku](https://reader030.vdocument.in/reader030/viewer/2022011915/5fc4e81f676aad42830ab0f4/html5/thumbnails/17.jpg)