To run locally you must have the following installed:
- NodeJS
- MongoDB (installation instructions on Mac)
- NPM (Node Package Manager) (installed with NodeJS)
- Robo3T (optional)
- Heroku CLI
- On first install add a file named:
.env
to the project root and it should have one line containing:MONGODB_URI='mongodb://localhost/decision-task'
- Add Heroku remotes
heroku login
heroku git:remote -a empirical-project-v1
git remote rename heroku heroku-v1
heroku git:remote -a empirical-project-v2
git remote rename heroku heroku-v2
Start MongoDB (in own terminal window)
mongod
Open new terminal window
Go to project in terminal on file system:
cd ~/Desktop/decision-task-node
Pull down latest files
git pull
Make sure NodeJS dependencies are installed with NPM. (only run this if dependencies (package.json) have changed)
npm install
Checkout branch you would like to work on:
Version 1
git checkout master
Version 2:
git checkout version-2
Local Run with Heroku
heroku local web
App will be running at http://localhost:5000/
Open other terminal to commit any changes
cd ~/Desktop/decision-task-node
Commit all of your code and be sure they are in the appropriate branch.
Adds all files to be committed into version control:
git add .
will add all files that are different or git add INSERT_FILE_NAME_HERE
Commits the files with a message:
git commit -m 'message about the changes you made go here'
Deploy:
V1:
git push heroku-v1 master
V2:
git push heroku-v2 version-2:master
Check instance is running(optional):
heroku ps:scale web=1
Open page in web browser (or just navigate to decisionmakingtask.com):
heroku open
View Logs (should something on the server side goes wrong):
heroku logs --tail
Restarting Heroku:
heroku restart --remote heroku-v1
heroku restart --remote heroku-v2
Some common commands
git status
git diff
Use shift
+ zz
to exit diff
- Checkout a new branch from master
git checkout -b BRANCH_NAME_HERE
- Make changes to your files locally.
- You stage the files you file you want to commit (or add/update in the git version control repository)
git add FILE_NAME_HERE
- Commit files to git using:
git commit -m 'MESSAGE_GOES_HERE'
- Push branch to github using
git push origin BRANCH_NAME_HERE
- Open Pull request and merge branch into master. (delete branch optional)
- Checkout master locally
git checkout master
- Pull down changes from remote
git fetch
- Merge remote branch with local branch
git merge origin/master
- Go to project in terminal on file system:
cd ~/Desktop/decision-task-node
- Pull down changes from remote
git fetch
- Merge remote branch with local branch
git merge origin/master