-
Notifications
You must be signed in to change notification settings - Fork 120
Deploying Tower Apps
The following hosting solutions can be used for Node.js apps:
- https://no.de/ (paid)
- http://www.webbynode.com/ (paid)
- http://nodejitsu.com (private)
- http://nodester.com (free)
- http://heroku.com (free)
- http://docs.dotcloud.com/services/nodejs/ (free)
- staging
- production
- demo
In the simple case, just deploy straight to production. For "real" or live apps, a staging environment is important. It mimics your production environment. Push there first to make sure the latest code doesn't break anything. Modify code if things do break, try again. Then push to production. Also, have a live "development" environment, where you can push your daily hacks even before staging to see how things are going. For demoing the app, have a dedicated "demo" deployment that's as close to possible to staging but isn't volatile.
First, create apps on the Cedar stack:
heroku create <%= app.name %> --stack cedar # production
heroku create <%= app.name %>-development --stack cedar
heroku create <%= app.name %>-staging --stack cedar
heroku create <%= app.name %>-demo --stack cedar
Then link to them:
git remote add production [email protected]:<%= app.name %>.git
git remote add development [email protected]:<%= app.name %>-development.git
git remote add staging [email protected]:<%= app.name %>-staging.git
git remote add demo [email protected]:<%= app.name %>-demo.git
Develop using the same branching structure. First, create the branches:
git branch development
git branch staging
git branch demo
Then checkout a branch and develop:
git checkout development
Change some code and commit the changes:
git add . ; git commit -a -m 'added code to dev branch'
Push to Heroku using the robustness of git push
:
git push <remote> <local-branch>:master
Where remote
is the name given to app (development
for <%= app.name %>-development
), and local-branch
is the branch you're working on (development
).
git push development development:master
To merge committed development changes to the other three branches and push all of the code to the respective remotes (I know it sounds like a lot, but it's definitely worth it), do this:
git checkout staging
git merge development
git push staging staging:master
# if no errors, nice! push to production
git checkout master
git merge staging
git push production master
# for the demo site
git checkout demo
git merge master
git push demo demo:master
heroku logs --app <%= app.name %>-development -n 500 --tail
Heroku defaults to Node 0.4.0. To use your own version of node, check this out:
- http://blog.superpat.com/2011/11/15/running-your-own-node-js-version-on-heroku/
- http://heroku-buildpack-nodejs.s3.amazonaws.com/manifest.nodejs
Delete design.io in devDependencies as it will cause an issue. This issue has been flagged by nodejitsu.
Put this at the top of config/application.coffee:
if process.env.NODE_ENV == 'production'
Tower.Application::watch = ->
Tower.env = 'production'
- web sockets
- mongodb
- redis
You can deploy to Windows Azure from Windows, Mac, or Linux:
- http://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/command-line-tools/
- http://www.windowsazure.com/en-us/develop/nodejs/tutorials/create-a-website-(mac)/
- http://tomasz.janczuk.org/2011/11/debug-nodejs-applications-on-windows.html
- http://tomasz.janczuk.org/2011/09/using-event-tracing-for-windows-to.html
- https://www.windowsazure.com/en-us/develop/nodejs/how-to-guides/powershell-cmdlets/
- https://www.windowsazure.com/en-us/develop/nodejs/common-tasks/enable-remote-desktop/
- https://www.windowsazure.com/en-us/develop/nodejs/best-practices/troubleshooting/
- https://www.windowsazure.com/en-us/develop/nodejs/tutorials/app-using-socketio/
- http://tomasz.janczuk.org/2012/09/selecting-nodejs-version-in-windows.html
- http://codebetter.com/glennblock/2012/06/29/getting-your-azure-web-site-to-use-node-v0-8-1-now/
- https://github.com/tjanczuk/iisnode
- https://github.com/WindowsAzure/iisnode/blob/master/src/samples/configuration/web.config
- http://blog.syntaxc4.net/post/2012/07/26/accessing-app-settings-configured-in-windows-azure-web-sites-using-php-and-node-js.aspx
- http://stackoverflow.com/questions/12483782/cannot-get-azure-node-js-logging-enabled
azure site --help
azure site portal
azure site log download <app-name>
On your azure dashboard, set app settings
variable NODE_ENV
to production
.
There's also some way to create a custom web.config
file at the root, for iisnode, if you figure it out please post!
$ dotcloud create towertest
Created application "towertest" using the flavor "sandbox" (Use for development, free and unlimited apps. DO NOT use for production.).
This flavor cannot be changed.
** YOU HAVE CREATED A SANDBOX APPLICATION **
SANDBOX applications may not be scaled, may not use custom domains,
and do not have the same performance guarantees as "live" applications.
SANDBOX applications cannot be upgraded.
Information about the different flavors offered can be found here:
http://docs.dotcloud.com/guides/flavors/
- https://openshift.redhat.com/app/
- https://openshift.redhat.com/app/console/application_types/nodejs-0.6
- http://towertest-viatropos.rhcloud.com/
-
logging
-
exception handling
-
system performance
-
http://blog.scoutapp.com/articles/2008/09/09/rails-monitoring-pillars