Hosting node.js applications in IIS on Windows

what is iisnode

iisnode is a native IIS module that allows hosting of node.js applications in IIS on Windows.

benefits

  • Process management. The iisnode module takes care of lifetime management of node.exe processes making it simple to improve overall reliability. You don’t have to implement infrastructure to start, stop, and monitor the processes.
  • Scalability on multi-core servers. Since node.exe is a single threaded process, it only scales to one CPU core. The iisnode module allows creation of multiple node.exe processes per application and load balances the HTTP traffic between them, therefore enabling full utilization of a server’s CPU capacity without requiring additional infrastructure code from an application developer.
  • Auto-update. The iisnode module ensures that whenever the node.js application is updated (i.e. the script file has changed), the node.exe processes are recycled. Ongoing requests are allowed to gracefully finish execution using the old version of the application, while all new requests are dispatched to the new version of the app.
  • Access to logs over HTTP. The iisnode module provides access the output of the node.exe process (e.g. generated by console.log calls) via HTTP. This facility is key in helping you debug node.js applications deployed to remote servers.
  • Side by side with other content types. The iisnode module integrates with IIS in a way that allows a single web site to contain a variety of content types. For example, a single site can contain a node.js application, static HTML and JavaScript files, PHP applications, and ASP.NET applications. This enables choosing the best tools for the job at hand as well progressive migration of existing applications.
  • Minimal changes to node.js application code. The iisnode module enables hosting of existing HTTP node.js applications with very minimal changes. Typically all that is required is to change the listed address of the HTTP server to one provided by the iisnode module via the process.env.PORT environment variable.
  • Integrated management experience. The issnode module is fully integrated with IIS configuration system and uses the same tools and mechanism as other IIS components for configuration and maintenance.
  • Other IIS benefits. Port sharing, security, URL rewriting, compression, caching, logging

prerequisities

building

For 32 bit Windows: msbuild /p:Platform=Win32 src\iisnode\iisnode.sln

For 64 bit Windows: msbuild /p:Platform=x64 src\iisnode\iisnode.sln

installing after build

build\debug\%PROCESSOR_ARCHITECTURE%\install.bat

installing from a download

samples

http://localhost/node (available after installation)

Which binary version do I need to download?

Please choose x86 flavors for installation on 32-bit Windows systems, and amd64 flavors for installation on 64-bit Windows systems.

Does iisnode block threads per request or connection

iisnode is completely async and does not block threads per request or connection. It does allocate small amounts of memory for active requests.

How do I report issues?

Please verify if your issue is already known by searching https://github.com/tjanczuk/iisnode/issues. If you don’t find it there, create a new issue report. Please include the following information with your bug report:

  • Windows OS version and bitness (32/64)
  • IIS version
  • which version of iisnode you are using (changelist number if compiled, binary package name if downloaded)
  • all interesting information from the IIS error page that displays (if any)
  • all interesting information IIS logs into the Event Viewer (http://msdn.microsoft.com/en-us/library/ms524984(v=vs.90).aspx)

I am getting a 503 response when running samples

If you run into a 503 status code with IIS reporting error code 0x5 (ERROR_ACCESS_DENIED), make sure the identity of the application pool running the site that hosts your node.js application has read & execute rights to node.exe on disk. If you are using the default IIS configuration (DefaultAppPool running under ApplicationPoolIdentity), you can set appropriate ACLs on the node.exe by running:

icacls %systemdrive%\node\node.exe /grant IIS_IUSRS:rx

resources & documentation

How a faster internet work?

DNS is like the phone book for the Internet. It converts human readable domains (www.opendns.com) to an IP address (208.69.38.160) that your computer can connect to. But what happens when you look up a business in the phone book and there are 50 locations? You probably want the location closest to you.

When trying to reach a website that exists in 50 locations around the world, you would want the same thing to happen. You want to be sent to the closest, fastest or least congested location automatically.  Until now, figuring out which location is closest to you was not possible with DNS alone.

Today, if you’re using OpenDNS or Google Public DNS and visiting a website or using a service provided by one of the participating networks or CDNs in the Global Internet Speedup then a truncated version of your IP address will be added into the DNS request. The Internet service or CDN will use this truncated IP address to make a more informed decision in how it responds so that you can be connected to the most optimal server. With this more intelligent routing, customers will have a better Internet experience with lower latency and faster speeds. Best of all, this integration is being done using an open standard that is available for any company to integrate into their own platform.

 

Continue reading

Installing CouchApp

Installing

The newest install instructions are always in the README

Requirements

  • Python 2.x >= 2.5 (Python 3.x will be supported soon)

Installing on all UNIXs

To install couchapp using easy_install you must make sure you have a recent version of distribute installed:

$ curl -O http://python-distribute.org/distribute_setup.py 
$ sudo python distribute_setup.py $ easy_install pip 

To install or upgrade to the latest released version of couchapp:

$ sudo pip install couchapp 

To install/upgrade development version :

$ sudo pip install git+http://github.com/couchapp/couchapp.git#egg=Couchapp 

Installing in a sandboxed environnement.

If you want to work in a sandboxed environnement which is recommended if you don’t want to not “pollute” your system, you can usevirtualenv :

$ curl -O http://python-distribute.org/distribute_setup.py 
$ sudo python distribute_setup.py 
$ easy_install pip $ pip install virtualenv 

Then to install couchapp :

$ pip -E couchapp_env install couchapp 

This command create a sandboxed environment in couchapp_env folder. To activate and work in this environment:

$ cd couchapp_env && . ./bin/activate 

Then you can work on your couchapps. I usually have a couchapps folder in couchapp_env where I put my couchapps.

Installing from source :

Follow instructions here

Installing on macosx

Using Couchapp Standalone executable :

Download Couchapp-0.8.1-macosx.zip on Github then double-click on the installer.

Using th python metapackage for macosx 10.5 or macosx 10.6

Using Homebrew

To install easily couchapp on MacOSX, it may be easier to use homebrew to install pip.

Once you installed homebrew, do :

$ brew install pip && pip install couchapp 

That’s it.

Installing on ubuntu

If you use [Ubuntu](http://www.ubuntu.com/-, you can update your system with packages from our PPA by addingppa:couchapp/couchapp to your system’s Software Sources.

Follow instructions here.

Installing on Windows

There are currently 3 methods to install on windows:

What is CouchApp?

What the HTTP is CouchApp?

This blog post is in response to a lot of well-deserved confusion in the community around CouchApps. We haven’t been clear enough in the past (either in technical description or in the notion of the project). I hope to change all that (with your help). This is just the beginning.

The Basics

A CouchApp is just a JavaScript and HTML5 app that can be served directly to the browser from CouchDB, without any other software in the stack. There are many benefits (and some constraints) to doing it this way. The first section of this article will address these tradeoffs.

In the bad old days (2008 and earlier), if you wanted to write a dynamic database-backed web application, you had to have an architecture that looked like a layer cake:

Browser (UI and links between pages)
-------------- HTTP ---------------
Application server (business logic, templates, etc)
--------- custom binary -----------
Persistence: MySQL, PostgreSQL, Oracle

 

Continue reading

Couchbase Mobile

Write mobile apps once, access anywhere.

Couchbase Mobile 

Couchbase Mobile allows developers to write web applications one time, synchronize multiple copies and share data and applications across any computing platform or mobile device. Easy to download and get started, Couchbase Mobile is fast, reliable and keeps the data on all your devices synchronized with the Couchbase database in the cloud.

We make sync easy.

Synchronization is a deeply hard problem. Couchbase was created from the ground up to solve this problem, so you don’t have to. Spend your time creating value for your users, and let us handle the hard part.

Ideal for user preferences, contacts, game scores, and enterprise data, Couchbase keeps all of your user’s mobile devices in sync with each other and backed up to the cloud.

Couchbase integrates with most popular mobile platforms. This includes Google’s Android, HP’s Palm WebOS, and Apple’s iOS, which includes the iPad and iPhone. Developers love it both for native development and HTML5 apps.

Anytime, anywhere access.

Mission critical applications don’t have the luxury to blame failures and slowness on spotty wireless access. The only true path to reliability is keeping your data on your device.

Couchbase Mobile works, online or off. It doesn’t depend on a constant Internet connection so it works all the time. Yes, offline happens.

Pure performance.

Users are turned off by slow applications, even when the slowness is due to network issues, not your code. With Couchbase Mobile, your application is always snappy, and never has to wait on wireless carriers or remote servers. Your users will thank you.

Couchbase is lightweight and saves battery life compared to traditional applications. By synchronizing data to the device, we optimize bandwidth usage and avoid expensive radio transmissions during everyday usage.

Reference : http://www.couchbase.com/products-and-services/mobile-couchbase

Check a valid URL of image

public static string CheckImageUrlExist(string ImageUrl)
{

  try
  {
    HttpWebRequest imageUrlRequest =
                   (HttpWebRequest)HttpWebRequest.Create(ImageUrl);

    if (imageUrlRequest == null) return NoImagePath;

    imageUrlRequest.Method = "HEAD";

    imageUrlRequest.GetResponse();
    return ImageUrl;
  }
  catch (UriFormatException)
  {
    return NoImagePath;
  }
  catch (WebException)
  {
    return NoImagePath;
  }
}

public static string NoImagePath{get{return "/Content/Images/noimage.png";}}

Setting up a Virtual Machine for Node.js development on Windows 7

If you run Windows 7 and you want to develop for the latest version of Node.js, you’re in for a bumpy ride. You can compile it under Cygwin, but the process is complex and doesn’t work for all versions. So what if:

  • You fear a later version of Node.js breaking on Windows again? (It was broken for two full minor versions, really quite a while.)
  • You don’t want to install Cygwin? (You madman, you really should.)
  • You are paranoid and want to be running your programs on the same environment you will be deploying them on?
  • You just can’t get the dang instructions to work?

Well, the solution isn’t to reformat and install Linux (though that could very easily help your productivity – fewer games being played, I’m sure). The solution is to install Node.js on a Virtual Machine with a shared drive. And honestly? It’s pretty easy. Three steps!

Step One: Install VirtualBox

Download VirtualBox here, then follow the instructions.

Step Two: Install Ubuntu Server

Download Ubuntu Server here, then create a new Virtual Machine. Name it what you will.

Under the “Network” tab in settings, change the adapter to a “Bridged Adapter”. This will force the machine to get a locally-addressable IP address.

Under the “Shared Folders” tab in settings, click the “Add” button, set the folder path to some new folder on your Windows 7 system. Set the folder name to something simple like “nodejs”.

Under the “Storage” tab, click on the “IDE Controller”, then click the little CD button. Navigate to where you downloaded the Ubuntu Server ISO and select it.

Now boot your new Virtual Machine and follow the Ubuntu Server setup options. Install whatever your little heart desires, but I recommend an SSH server so you don’t have to install it later.

Once it’s installed, run the following commands to install VirtualBox Guest Additions:

sudo apt-get update sudo apt-get install build-essential linux-headers-$(uname -r) 
sudo apt-get install virtualbox-ose-guest-x11 

Next, create a “nodejs” folder in your home directory, and add the following to your rc.local file (use the command “sudo nano /etc/init.d/rc.local”):

mount -t vboxsf nodejs /home/[YOUR_USER_NAME_GOES_HERE]/nodejs

Restart and your Windows folder should be hooked up to the nodejs folder on your Ubuntu VM.

Step Three: Install Node.js

This part’s super-simple. Run the following commands:

sudo apt-get update sudo apt-get install git-core curl build-essential openssl libssl-dev 
git clone https://github.com/joyent/node.git && cd node ./configure make sudo make 
install node -v cd curl http://npmjs.org/install.sh | sudo sh

That’s it! You’re set up with Node.js and Node’s package manager, NPM. If you want to test it, go to your nodejs folder (in either Windows or Ubuntu, both should be working now) and make a file called “hello.js”, and put the following in it:

var sys = require('sys'); sys.puts('Hello!');

Then go to your Ubuntu system and run:

node hello.js 

Reference : http://blog.danhulton.com/2011/03/18/setting-up-a-virtual-machine-for-node-js-development-on-windows-7/

Installing CouchDB on Windows (Quick Guide) Apache CouchDB

Apache CouchDB

Seeing as everyone else out there except me (and a few others) uses a Mac, I thought I’d write this short post regarding installing CouchDB on Windows and how to access the Futon Administration console.

Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution.

As promised, the quick and dirty way to install CouchDB on windows is as follows:

  1. Click here to visit the Wiki and download the installer.  At the time of writing the latest installer was v1.0.1
  2. When downloaded, run the installer as an “Administrator” and follow the on-screen instructions.
  3. To install couchDB as a Windows Service, leave the default selections as it’s automatically configured to do so.
  4. Once the installation is complete, for the default installation options, the service “Apache couchDB” should be running under the local system account.
    1. If, after installation you are experiencing permissions issues, see here.
  5. Open a modern web browser, in otherwords Firefox (this is also the recommended browser to use).
  6. Navigate to: http://127.0.0.1:5984
    1. You should see the following text:{“couchdb”:”Welcome”,”version”:”1.0.1″}
  7. To access Futon (Administration console) Navigate to: http://127.0.0.1:5984/_utils
  8. That’s It !!

Told you it was a quick guide 😉

I will be exploring couchDB further in the near future and will post my experiences here for anyone else who is interested.

In particular, I’ll be looking at:

5 open source billing systems to watch

Collecting money from customers should be the easy part of your business, but an billing system that underperforms can make life unnecessarily difficult for CIOs.

In this edition of 5 Open Source Products to Watch, we take a look at billing systems. That’s right, there are open source applications available for invoicing and billing customers. They’re open source, Web-based and can be extended and integrated to suit specific needs.

Best of all, they don’t cost a red cent.

1. AgileBill

AgileBill was released as a commercial product in 2004 and then open sourced by its creator Tony Landis in 2008. AgileBill is a billing and invoicing application suitable for the membership/subscription type of business model, including Web hosting companies, ISPs and VoIP providers.

AgileBill features plug-ins for payment processing, provisioning, and interfacing with third-party applications and services. It has also given rise to the AgileVoice and AgileISP VoIP and ISP billing applications, respectively.

URL: http://www.agileco.com/agilebill-open-source-billing-software.htm
Licence: Open AgileBill Licence

2. Amberdms Billing System

The Amberdms Billing System (ABS) is a billing system that also provides a number of useful accounting and business management functions. ABS has apps for invoicing, service management, HR and time-keeping, and is designed for small and medium businesses as well as small ISPs and IT companies.

Third-party integration can be done via the API and commercial support is available from New Zealand company Amberdms.

ABS claims to have an “easy UI” and integration between timekeeping and invoicing features means customers can be automatically billed for hours worked.

URL: http://www.amberdms.com
Licence: AGPL

3. Freeside

Freeside is a billing, trouble ticketing and provisioning automation software tailored to online businesses, including ISPs, ITSPs, hosting and content providers.

The billing functionality includes real-time credit card and e-cheque processing using the popular payment gateways; e-mail, fax, printed and online invoicing; and flexible pricing and rating plans, like anniversary billing and usage based billing. Freeside also integrates Request Tracker, another open source project for support ticketing.

Other features include a customer self-care portal (with an API for extensibility) and reseller functionality which allows “virtualized” reseller access.

URL: http://www.freeside.biz/freeside/
Licence: AGPL

4. CitrusDB

CitrusDB is a billing system developed with PHP and MySQL that can also be used to keep track of customer information (CRM), services, products, invoices and credit cards, and support information. The goal of the project is to provide an open source customer care and billing solution that can be used in many different service industries like ISPs, consulting, and telecommunications.

Standard billing features include any billing cycle — one-time, monthly, bi-monthly, quarterly, 6-months or yearly — and billing is able to provide batch credit card exports, printed invoices, or emailed invoices.

CitrusDB also has an online account manager which allows customers to view their account services and recent balance and payments. It also allows them to submit support notes to their account via the online form.

URL: http://www.citrusdb.org/
Licence: GPL

5. JBilling

JBilling is a Web-based billing system developed in Java. It is cross-platform and supports multiple database systems. The project claims it can scale to “invoice millions” and can be run on a single server or a cluster of specialised nodes.

Its features include automated invoice generation and payment processing; the ability to send invoices as e-mails, PDF attachments or paper; the ability to accept partial and advance payments; bundles, packages, plans and promotions; and a business rules management system.

Professional support is also available for JBilling, which also has multiple language, currency and localisation support.

URL: http://www.jbilling.com/
Licence: AGPL

For more articles in this series, be sure to check out:
5 open source security projects to watch
5 open source network management projects to watch
5 open source virtualisation technologies to watch
5 open source CRM systems to watch
5 open source VoIP softphones to watch
5 open source office suites to watch
5 open source IP telephony projects to watch
5 open source help desk apps to watch
5 enterprise open source wiki apps to watch
5 open source project management apps to watch
5 free project management applications you must try

 

Reference :

http://www.cio.com.au/article/324595/5_open_source_billing_systems_watch/

Microsoft’s JavaScript Focus is a Winner

Analysis: JavaScript scripting is the best way forward for Microsoft Office and the Windows platform.

Developers must be masochists. How else to explain all the negative reactions to Microsoft’s newfound enthusiasm for HTML5 andJavaScript? First Microsoft said it would integrate the Web standards intothe next version of Windows, now it says it will do the same with Office — and in both cases, developers have done nothing but complain. Why?

Here’s how it stands with Office right now: Users can script the Office components using Visual Basic for Applications (VBA), a proprietary Microsoft scripting language that’s a subset of Visual Basic 6. VB6 itself was a lousy language with an ugly, cumbersome syntax; Microsoft ended all support for it in 2008, and I have yet to hear a single developer mourn its passing. Unfortunately, however, VBA lingers on.

 

Continue reading

How to write a Ruby and Rails 3 REST API

Background

I’ve always wondered how I’d go about publishing a real REST API on the web to do something. In this example, we’ll create an employee manager app-thing. It’s not particularly interesting but it shows what “API” means. In another bit, we’ll create an “API” meaning a library to interact with this web service.

The rails app

First, create a new rails app.
rails new rest_api

Edit config/database.yml:

  # MySQL
  #   gem install mysql2
  development:
    adapter: mysql2
    host: localhost
    database: rest_api
    username: rest_api
    password: rest_api
    pool: 5
    timeout: 5000

Install the mysql gem if you haven’t already. Optionally, create an RVM gemset for this project if you want to keep your gems clean.
gem install mysql2

 

Continue reading

Create a REST API with PHP

One of the latest (sort of) crazes sweeping the net is APIs, more specifically those that leverage REST. It’s really no surprise either, as consuming REST APIs is so incredibly easy… in any language. It’s also incredibly easy to create them as you essentially use nothing more than an HTTP spec that has existed for ages. One of the few things that I give Rails credit for is its well thought-out REST support, both for providing and consuming these APIs (as its been explained by all the Rails fanboys I work with).

Seriously, if you’ve never used REST, but you’ve ever had to work with (or worse, create) a SOAP API, or simply opened a WSDL and had your head explode, boy do I have good news for you!

 

Continue reading

Build a RESTful API architecture within an ASP.NET MVC 3 application.

ASP.NET MVC 3, with its glorious URL structures and ease of working with and controlling HTTP request/response data is primed to build REST type API services. But how does one accomplish that and what does the whole RESTful thing really mean?

Building a full blown API (of any type) involves a lot of architecture components, from data validation to security and beyond. This post does not attempt to address all of that. It focuses on the initial structure of a RESTful service within an ASP.NET MVC 3 application that works with JSON data in and out. We will look at how we can use the route engine, the HTTP verb attributes and a lean controller design to provide a starting point for a REST API.

 

Continue reading

Introducing the Architecture REST – Creating APIs – Part 02

In this post, we continue talking about the REST architecture and our progress to create our first API.  This is the second part of the series, if you want to see the Introduction, please check this link.
The SOA Principles 

The REST is also considered a Service-Oriented Architecture (SOA) , so it the SOA principles must be considered. The REST architecture follows the interoperability by providing support for several types of response. It is a good practice to make your resource accept HTML, JSON or XML in the same method, turning it more portable.  Depending of the target of your application, the number of clients of your services can be bigger in this way. However, providing all those types of response consumes time, and you have to analyze if you are available for working on this interoperability.
It is also important that your RESTful services don’t take overloaded operations. This includes heavy processing tasks such as data transformations (XML to JSON, XML to Text/Plain, etc.) as also the validation of the data before each transformation.  This results in the other principle of SOA the weak coupling, that is, make your system less dependent of other modules in order to reduce the modification effects and failure tailoring.  Generally the simple RESTful services systems are divided in the following packages:
  • resources –  The resources of your system which implement the HTTP methods POST, GET, PUT, DELETE. For each request received, it uses the modules of the utils package and the communication provided with dao, if necessary. The resources also have the task of interpret the result , possible failures and response to the client.
  • utils – The utility classes as also related to data transformation.
  • dao –  The classes with the pattern DAO (Data Access Object), responsible for the database transactions

Introducing the Architecture REST – Creating APIs – Part 01

In this new series of posts I will talk about a architecture style widely used in web services for distributing simultaneously hypermedia content such as texts, images, videos, etc. The style is called REST (REpresentational State Transfer) where the term RESTful refers to the systems which follow the REST principles.Introduction

Currently, companies like Yahoo, Amazon among others, are deeply using this technology, which became quite popular. One of the reasons to this success is the fact that you can easily create a client that uses the Amazon services or even access your Twitter Account by a simple application.
Imagine if you have a web service or a social network and you want developers all around the planet to develop applications that communicate with your web service and use your data to develop new awesome ideas. By using REST architecture you can easily develop and deploy APIs for giving access to your data to outside applications, delivering new functionalities to the web community via an open API.
In this article and the next ones I will show a simple API that I developed and how I used the principles REST (HTTP response codes, methods, cache, cookies, security, tests) to implement it. The examples of codes presented here are using the library Python and the framework for Web Django.