5.28.2012

deploy to cloudno.de your node.js app


Version en espaƱol

This time we will see how to deploy tour app in node.js to cloudno.de, there are other services also that do a great job like heroku or nodester but for this time we will use this one that i recommend, they helped me when i need it and you can create couchdb and redis databases if you needed, the service its in beta and free so its nice, very nice

Like all the other systems we have to install their cli or "command line interface", which its only an script to help us with the deployment, updates and everything else of our app in their systems

npm install cloudnode-cli -g

Or without the g if you want a local installation and not global

Ok, we have the cli installed, lets go to the page and create a new app, this will give us the subdomain url of the app and the github repository to upload it, also a user name and a key

With the cli installed, lets setup the user, this have to be done only once


$ cloudnode user setup <username> <password>
cloudnode info verifying credentials...

the user is the same you use to login in the page and the password is the api key that the system gave you and its located in the section about your account in the page

Now, to see more options, right in the terminal "cloudnode" and you will see all the commands

Now lets clone the app that you created in the page locally to start coding, to do this lets do an "app init" in mac or linux, if you are in windows you have to do the steps manually :(

in mac or linux

$ cloudnode app init <app name>
cloudnode info initializing git repo for <app name> into folder <app name>
cloudnode info cloning the repo git clone cloudnode@git.cloudno.de:/git/hs/62-6fc0d44abf9974b91625cc10ff118871.git <app name>
cloudnode info clone complete

in windows



  1. Create a local sub directory for the application
  2. Initialize a local repository (git init)
  3. Clone the remote repo and the the remote origin URL (git clone ...)
  4. Create a sample server.js file with a simple "Hello World" application
  5. Add the new file to the local repository (git add .)
  6. Commit the changes (git commit -am "Initial commit")
  7. Push the changes live (git push origin master)



What it does its clone the repository to your machine and create an entry code just to test the app, you can clone your app in cloud9ide.com and commit there

Every time you make a commit, the system in cloudnode will restart the app so you can see the new changes immediately, also it doesnt matter the port you put on your application since cloudnode will overwrite it

And thats it, you can see your app running in cloudnode with the url provided that will be something like <app name>.cloudno.de

In your admin page you can see the log, stop it or reboot it

Greetings

No comments:

Post a Comment