(Tower) on Rails Tutorial: first application
However, instead of using Ruby on Rails, I am following along but using Coffeescript, Node, and particularly, the Tower.js framework, which was modeled quite closely on rails. It is my plan to not only learn Tower by doing so, but also to document the differences for those following in my footsteps. So far:
npm install -g tower tower new firstApp
(follow js/node convention of using camelCase filenames)
cd firstApp npm install .
(instead of running Bundle Install)
tower server -e development
To Get App on Heroku
removed the following lines from the .gitignore file:
**If there is already a copy of chai.js there, this may have already been fixed.
install Heroku Toolbelt
On Ubuntu Linux that command is:
wget -qO- https://toolbelt.heroku.com/install.sh | sh
Verify app will run with:
git add . git commit -m "init" heroku create --stack cedar git push heroku master heroku ps:scale web=1 heroku addons:add mongohq:free
To use heroku addons like mongohq:free, you are required to "verify" your account by providing a credit *
card number. I used an old Visa Gift Card I had, which may or may not have had a dollar or two left on it *
(literally, there would have been less than three dollars.) They claim they do not charge the card at all- *
unless you add paid services. I believe this is likely true, because I doubt this card would have *
worked otherwise. *
To finish setting up on heroku:
Login to heroku website, go to myApps, pick app, click on "Add ons", click on MongoHQ. On MongoHQ
website, click Database Users tab. Click "Add a user". Add username and password. Go to "Database
Info" tab. Now, in /config/databases.coffee set it as follows: Under production, name is set to
Database from the MongoHQ site. If your Mongo URI is:
Then "name" would be "app1231231", port would be 12123, host: vinegar.mongohq.com, and the username
and password strings would be for the database user you just set up on the mongohq website,
NOT your heroku username and password.
module.exports = mongodb: development: name: "first-app-development" port: 27017 host: "127.0.0.1" test: name: "first-app-test" port: 27017 host: "127.0.0.1" staging: name: "first-app-staging" port: 27017 host: "127.0.0.1" production: name: "app1231231" port: 12123 host: "vinegar.mongohq.com" username: "user" password: "mymongohqpass"
git add . git commit -am "message" git push heroku master heroku ps:scale web=1 heroku ps
If it's running, go check out your site!
Mine is at http://empty-fog-4813.herokuapp.com though it doesn't do anything.
If at any point the push to heroku hangs or fails because of the forever
module, just ctrl-c after waiting a reasonable amount of time and try again. It may take a few tries.