< …">

My Octopress Blog

A blogging framework for hackers.

Run NodeJS in Ubuntu 11.04 EC2 With User Permission and Run as Service

In this post, i show you how to install & run NodeJS in Production Mode without ROOT permission. I make this runing and tested on Amazon EC2 on Ubuntu Natty 11.04. I user user permission NodeJS installation on [my NodeJS how to installation] (http://yoodey.com/how-install-nodejs-ubuntu-natty-1104-and-start-learning)

Set environment

Our node is installed on ~/local/node. We will make this also can be accessed in GLOBAL environment. My home path is /home/ubuntu.

Editing /etc/environment :

Liquid error: undefined method `join’ for #<String:0x00000001dba3e8>

And restart your server to load NODE in ENV.

Install Runit

We will using Runit for running NodeJS application.

Liquid error: undefined method `join’ for #<String:0x00000001db9e20>

We will make service running by users, not by root access.

Edit run files :

Liquid error: undefined method `join’ for #<String:0x00000001db97e0>

Registering User service

Now we creating service in user home. All application that in this service folder, will running by Runit with user permission.

Liquid error: undefined method `join’ for #<String:0x00000001db91a0>

Edit run files :

Liquid error: undefined method `join’ for #<String:0x00000001dadc10>

In this example, my nodejs application located in /var/yodi/obrool.com/chat-server.js.

Start service

Register userservice into /etc/services by symbolic links : sudo ln -s /etc/sv/userservice /etc/service/

Now you can start nodejs by sv start userservice.

Do ps aux | grep node and you will get this results :

Liquid error: undefined method `join’ for #<String:0x00000001dad530>

Mission complete!

>

Comments