Last active
March 8, 2023 23:39
-
-
Save michellescripts/db9b2caae547cc807352165a9a098a67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In project: | |
1. Double check that package.json has a start script | |
In command line, in PROJECT folder - add Heroku: | |
2. which heroku | |
3. heroku create herokuSiteName | |
4. git remote -v (shows you the heroku remote) | |
In command line, in PROJECT folder - add DB to Heroku: | |
5. heroku addons:create heroku-postgresql | |
6. heroku config (shows database) | |
7. git push heroku master | |
In atom/text editor, in PROJECT folder - modify connection: | |
8. open atom - open knexfile.js | |
9. add production: Connection = heroku link + ?ssl=true | |
In command line, in PROJECT folder - migrate and seed the deployed DB: | |
10. knex migrate:latest --env production | |
11. knex seed:run - -env production | |
DONT DEPLOY YET, SET UP ENVIRONMENTS. | |
*DONT GIVE AWAY YOUR DATABASE!!!* | |
In command line, in PROJECT folder - add dotenv | |
12. npm install --save dotenv | |
In atom/text editor- set environment variables | |
13. create .env file | |
14. set DATABASE_URL=link | |
In atom/text editor- update app.js | |
15. require('dotenv').config() | |
var port = process.env.PORT || 3000 | |
In atom/text editor, in knexfile.js modify connection: | |
16. add production: Connection = process.env.'var' | |
In atom/text editor- update query.js with config/environment: | |
17. const environment = process.env.NODE_ENV || 'development’ | |
18. const config = require('../knexfile.js')[environment] | |
19. create .gitignore File: | |
node_modules | |
.env | |
Leave instructions for hooking up a DB to the project: | |
20. cp .env .env.example (for reaadme example) | |
21. Remove yoru data from .env.example | |
22. Add a comment to link the db in that file | |
23. git add, commit, push | |
24. git push heroku master | |
25. heroku open | |
26. if error: heroku logs | |
git push heroku dev:master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment