免責聲明

Disclaimer (免責聲明)
繼續閱覽代表您接受以上的免責聲明.
To continue reading means you accept the above disclaimer.

2014年11月26日 星期三

nodejs + heroku

0. launch git bash from the working folder of nodejs project, say mynjs1
  $ heroku login

1.  initialize git repository
   $ git init
   $ git add .
   $ git commit -m "initialize mynjs1"

2.  create the corresponding app on heroku
   $ heroku create --http-git
   [   $ heroku apps:create --http-git  ]
   https://infinite-lake-5143.herokuapp.com/
   https://git.heroku.com/infinite-lake-5143.git
...
   $ git push heroku master


3. Ensure that at least one instance of the app is running by :
   $ heroku ps:scale web=1

4.  visit the app at the URL generated by its app name.
   $ heroku open  [ or open it by browser]

5. view log
   $ heroku logs --tail
   Press Control+C to stop streaming the logs


6.  create package.json by
   $ npm init

7.  Procfile
   web: node httpsvr1.njs

8. rename app
   $ heroku apps:rename mynjs2

9.  run bash on heroku
   $ heroku run bash

10.
$  heroku config:set TIMES=4

11. revise files, git add, git commit, git push
httpsvr.listen(8080)  --> httpsvr.listen(process.env.PORT)



[ref]
https://devcenter.heroku.com/articles/getting-started-with-nodejs


[err]
ssh: connect to host  port 22: Bad file number
fatal: Could not read from remote repository.
-->

//=== http://stackoverflow.com/questions/16436284/failing-to-push-git-to-heroku-port-22-bad-file-number-could-not-read-from-remot


""" ...
if unable to access Heroku on port 22, then HTTP Git should solve it (it works on port 443). ...

To create a new app and have it be configured with a HTTP Git remote...
$ heroku apps:create --http-git

To change an existing app from SSH to HTTP Git ...
$ heroku git:remote --http-git

... """

沒有留言:

張貼留言