Node.JS Website Deployment

Embed Size (px)

DESCRIPTION

用 git 做 Node.JS 網站佈署

Text of Node.JS Website Deployment

  • Node.JS Website Deployment pH200 Software Developer @ Cytisan Software
  • node.js websiteserver git deploy
  • me iBook G4 C# JS WindowsApp Heroku (node)quota nodenode
  • Cloud Computing
  • PaaS
  • IaaS, VPS, etc.
  • Deploy node.js app
  • version control (push deploy, rollback) Start, stop and monitor
  • Lets rsync rsync -arzve ssh username@host:path source sshstopstart node shell script
  • Forever https://github.com/nodejitsu/forever Nodejitsu hosting platform npm install -g forever node application env variables
  • Git Deployment HerokuDeploy 1. sshserver2. git init --bare3. vim hooks/post-receive4. chmod +x hooks/post-receive
  • post-receive example#!/bin/bashAPP=~/repos/app/app.jsexport GIT_WORK_TREE=~/repos/appgit checkout -fpushd $GIT_WORK_TREEnpm installforever restart $APPpopd
  • Step by Step Local Repositorynodeweb Remote IP5.5.6.6 Remote Userwebadmin Remote Repository/home/webadmin/nodeweb.git Remoteforever (npm install -g forever)
  • Git1. localgit repository (git init)2. ssh webadmin@5.5.6.63. git init --bare nodeweb.git /home/webadmin/nodeweb.git4. cd nodeweb.git/hooks5. vim post-receive
  • Gitpost-receive6. #!/bin/bash APP=~/nodeweb/app.js export GIT_WORK_TREE=~/nodeweb git checkout -f pushd $GIT_WORK_TREE npm install --production forever restart $APP popd
  • Git7. chmod +x post-receive8. mkdir ~/nodeweb9.
  • Gitgit repository1. git remote add cloud-deploy webadmin@5.5.6.6:/home/webadmin/nodeweb.git2.
  • Git Deploy1. git push cloud-deploy master2. ssh webadmin@5.5.6.6 "forever start ~/nodeweb/app.js"3.
  • Git Deploy1. git push cloud-deploy master2. restart update
  • How about Windows?
  • Windows () IIS iisnode () https://github.com/tjanczuk/iisnode Windows Azure AppHarbor Hyper-V + Linux (CentOS, Ubuntu >=12)
  • Uptime https://github.com/fzaninotto/uptime
  • process http://upstart.ubuntu.com/ git deploy http://sebduggan.com/blog/deploy-your-website-changes-using-git/ Nodejistu BlogForever http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever ssh key login http://www.linuxproblem.org/art_9.html git server http://git-scm.com/book/en/Git-on-the-Server-Setting-Up-the-Server
  • Questions?twitter: pH_minamo 200 or pHNode.js Facebook Grouphttp://www.facebook.com/groups/node.js.tw/