awsbox, a PaaS layer for Node.js: An Update on Latest Developments

This is the 2nd time we’ve talked about awsbox on the Mozilla Hacks blog. In the first article we gave you a quick introduction to awsbox as part of the Node.js Holiday Season set of articles. Here we’d like to tell you about some recently added features to awsbox.

To briefly recap, awsbox is a minimalist PaaS layer for Node.js applications which is built on top of Amazon EC2. It is a DIY solution which allows you to create instances, setup DNS, run application servers, push new code to and eventually destroy your instances in a matter of minutes.

Since we first released awsbox it’s usage has been steadily increasing and is now downloaded from npm over 3,000 times every month. This has blown away our initial expectations so perhaps we’ve plugged a gap between the ‘Infrastructure’ and the ‘Platform’ services currently available.

Aim of awsbox

The aim of awsbox is to be an easy to use but configurable abstraction on top of the Amazon APIs to create your own PaaS solution. However, it should also allow you to do more than a PaaS service does – but only if you want to.

With that in mind, we have added a number of new features recently which allows you to take more control of your deployments. In general we’re aiming for speedy setup of development environments which can help quicken the process of development rather than for production deployments (but that doesn’t mean awsbox couldn’t be battle hardened more for this either).

New Features

Nginx is now being used as the reverse proxy to your application. Since your webserver is run by an unprivileged user on the box (ie. the ‘app’ user) we need a way to listen on port 80 or 443 and proxy through to your app. Whilst this job was admirably done in the past with http-proxy (on npm) we decided Nginx would compliment awsbox more now and in the future. Having the ability to drop config files into Nginx means we can start to add more features such as multiple webservers, multiple apps or serving from multiple subdomains.

Another new feature is the ability to automatically point a subdomain to your instance using Route53. By congregating around another AWS service rather than a separate service means we only have to worry about having one set of credentials in your environment. Subdomain creation and deletion is automatically performed whenever you create or destroy an instance using awsbox and this helps keep things clean.

Some of our team work in Europe as well as North America and a few of us are on the other side of the world. Instead of taking our requests half way around the world to our instances, we decided to bring our instances to us. Our base AMI which used to live only in the ‘us-east-1′ region is now available in all AWS regions and that includes both ‘eu-west-1′ for our European contingent and ‘ap-southeast-2′ too. Being able to create an instance in Sydney makes me very happy. 🙂

With so many people constantly creating, re-using and destroying instances we also thought it would be fair to be able to search for any instance with whatever criteria. As well as being able to list all VMs you can now find them by IP Address, AMI, Instance Id, Name, Tags or in fact any of 12 different criteria. This makes it super easy to find the instance you’re looking for.

And finally … no-one likes to spend any more money than they need to, so we now have the ability help figure out who launched which instance (so we can ask them if we can terminate it!). The AWS_EMAIL env var is added as a tag to the instance upon creation so that we know who to chat to if we need to reduce our bill.

New Commands

With these recent architectural changes we’ve also added a number of extra commands to help you with managing both your instances and your DNS. Now that we’re multi-region, there are a few new commands related to that:

# lists all AWS regions for EC2
$ awsbox.js regions
# lists all regions and their availability zones
$ awsbox.js zones

We can also now list all of our domains and their subdomains in Route53 as well as being able to search which records
point to an IP Address:

# lists all domains in Route53
$ awsbox.js listdomains
# lists all resource records in this zone
$ awsbox.js listhosts
# find which subdomains/domains point to an ip address
$ awsbox.js findbyip
# delete this subdomain
$ awsbox.js deleterecord

To help with AMI management, there is now a command which helps you create an AMI from an existing instance, tidies it up, creates an AMI and then copies it to all of the other available regions:

# create an ami and copy to all regions
$ awsbox.js createami ami-adac0de1

And finally a few commands which can help with determining who owns which instance:

# search instance metadata for some text
$ awsbox.js search
$ awsbox.js search ami-adac0de1
$ awsbox.js search persona
# show meta info related to an instance
$ awsbox.js describe i-1cec001
# claim an instance as your own
$ awsbox.js claim i-b10cfa11
# list all unclaimed instances
$ awsbox.js unclaimed

These are all in addition to the existing commands which now total 21, all to help manage your own deployments.

The Future

There has been a small renaissance in awsbox development recently with many people chipping in with new features. It is a valuable tool for the Persona team since it enables us to stand-up instances rather quickly, have a poke around either informally or formally and throw them away as quick as we created them (if not quicker)! And we don’t have to feel guilty about this either since acquiring a server on demand is par for the course in these days of IaaS.

We’ve also congregated around using more services within AWS itself. By moving the backend AWS API library to AwsSum we’re now able to talk to more AWS services than before and hopefully can leverage these to help make development deploys quicker and easier too.

However, we also feel that awsbox can get better still. We have some ideas for the future but we always welcome ideas or code from you guys too. Feel free to take a look around the docs and issues and leave a comment or two. If you’ve got great code to go with those ideas then we’ll be happy to review a pull request too – after all awsbox is open source.

View full post on Mozilla Hacks – the Web developer blog

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Using WebAPIs to make the web layer more capable

Part of making both Firefox OS and the web as a platform a stronger layer and alternative for developers, we are working on a number of WebAPIs. I’d like to introduce you them here!

Many things covered in this blog post are also available in a talk I’ve given on this topic.


When you talk about new technology, ideas and solutions, people have a tendency to be wary. They might see it as the Not Invented Here syndrome, but that is not our intent (as we’ve written here before, and as mentioned by our CTO, Brendan Eich).

Our intention is that everything we do is, or will be, standardized. Developed in the open.

This blog post focuses on various WebAPIs, their security level and how to use them. In a later post, we will follow up specifically on standardization and progress in that area.

Types of APIs

There are basically three types of WebAPIs:

Regular APIs
APIs available from any app, hosted or packaged.
Privileged APIs
Only available in privileged apps. Privileged apps are apps that are:

Certified APIs
Certified APIs are only available to system itself (Mozilla in the case of Firefox OS), meaning they are so sensitive and need to be strictly controlled.

Regular APIs

The complete list of regular APIs is:

  • Vibration API
  • Screen Orientation
  • Geolocation API
  • Mouse Lock API
  • Open WebApps
  • Network Information API
  • Battery Status API
  • Alarm API
  • Web Activities
  • Push Notifications API
  • WebFM API
  • WebPayment
  • IndexedDB
  • Ambient light sensor
  • Proximity sensor
  • Notification
  • FMRadio

Here’s how to use a number of them:

Battery Status API

This API is about detecting the current battery level of the computer/device, how long battery life there’s left and whether it’s being charged or not. Works in all three of desktop, Android and Firefox OS.

var battery = navigator.battery;?
if (battery) {?
    var batteryLevel = Math.round(battery.level * 100) + "%",?
        charging = (battery.charging)? "" : "not ",?
        chargingTime = parseInt(battery.chargingTime / 60, 10,?
        dischargingTime = parseInt(battery.dischargingTime / 60, 10);
        // Set events?
        battery.addEventListener("levelchange", showStatus);
        battery.addEventListener("chargingchange", showStatus);
        battery.addEventListener("chargingtimechange", showStatus);
        battery.addEventListener("dischargingtimechange", showStatus);

Vibration API

Making the device vibrate, either once or with a certain pattern.

// Vibrate for one second?
// Vibration pattern [vibrationTime, pause,…]?
navigator.vibrate([200, 100, 200, 100]);
// Vibrate for 5 seconds?
// Turn off vibration?

Screen Orientation

Gives you as a developer the chance to lock the orientation, or to specify what you want the primary orientation experience to be.

    Possible values:
var portraitLock = screen.mozLockOrientation("portrait");
if (portraitLock) {
    console.log("Orientation locked to portrait");

Geolocation API

Finding out where the user is at the moment – approved by the user to share this.

navigator.geolocation.getCurrentPosition(function (position) {
        Getting latitude and longitude:

Mouse Lock API

Locking down the mouse movements and controlling the experience yourself. Especially good when you don’t want the mouse pointer/interaction to end when it hits the end of the web browser window, but rather to continue to scroll – like doing complete 360 degrees spin of an environment or similar.

var docElm = document.documentElement;?
// Requesting Pointer Lock?
docElm.requestPointerLock = elem.requestPointerLock || 
                            elem.mozRequestPointerLock || 
document.addEventListener("mousemove", function(e) {
    var movementX = e.movementX       ||
                    e.mozMovementX    ||
                    e.webkitMovementX ||
        movementY = e.movementY       ||
                    e.mozMovementY    ||
                    e.webkitMovementY ||
    // Get the mouse movement delta values
    console.log("movementX=" + movementX, "movementY=" + movementY);  ?}

Open WebApps

In general, an APIs needed to install and handle Open Web Apps.

var installApp = navigator.mozApps.install(manifestURL);
// Successful install
installApp.onsuccess = function(data) {
    console.log("Success, app installed!");
// Install failed
installApp.onerror = function() {
    console.log("Install failed\n:" +;

Network Information API

Used to get information about network connectivity.

var connection = window.navigator.mozConnection,
    online = connection.bandwidth,
    metered = connection.metered;
// online can return:
    0 when offline
    Infinity when the bandwidth isn't known
    Estimation of MB/s
// metered implies if the connection is being metered,
   meaning limited in some way from the ISP

Alarm API

Making it possible to set alarms.

request = navigator.mozAlarms.add(
    new Date("May 15, 2012 16:20:00"), 
        mydata: "my event"

Web Activities

Through Web Activities you can specify intents on what kind of action you want to do, or that your app can handle.

var pick = new MozActivity({
     name: "pick",
     data: {
         type: ["image/png", "image/jpg", "image/jpeg"]
pick.onsuccess = function () {?
    var img = document.createElement("img");
    img.src = window.URL.createObjectURL(this.result.blob);

I’ve covered Web Activities in more detail in another blog post here.

Push Notifications API

A way for web sites to send messages to suers when aren’t on their web site. API is in a draft, not implemented yet. More can be read in the PushAPI documentation.

function getPushURL() {
    var push = navigator.push ||
                navigator.mozPush ||
    // Ask the user to allow notifications
    var request = push.requestURL(watoken, PbK);
    request.onsuccess = function () {
        var url = request.result.url;
        console.log('Push URL: ' + url);


Implementing a FM Radio in the web layer.

var fmRadio = || navigator.mozFMRadio || navigator.mozFM;
fmRadio.frequency = 106.7;


Used to enable in-app payments, through JSON Web Token (JWT).

var request = navigator.mozPay(JWTs);
request.onsuccess = function () {
    // Money!


Structured client-side storage with high performance search support. Covered in detail in Using IndexedDB and Storing images and files in IndexedDB.

// Create/open database
var request ="elephantFiles", 1),
     createObjectStore = function (dataBase) {
        console.log("Creating objectStore")
request.onsuccess = function (event) {
    console.log("Success creating/accessing IndexedDB database");
    db = request.result;
    db.onerror = function (event) {
        console.log("Error creating/accessing IndexedDB database");
// Needed for creating database/upgrading to a new version
request.onupgradeneeded = function (event) {

Ambient light sensor

Detecting the level of ambient light, to be able to serve different versions depending on the environment the user currently is in.

window.addEventListener("devicelight", function (event) {?
    /* The level of the ambient light in lux?
       A lux value for "dim" typically begin below 50,
       and a value for "bright" begin above 10000
window.addEventListener("lightlevel", function (event) {
    // Possible values: "normal", "bright", "dim"

Proximity sensor

Getting an indication of how close the device is to another object.

window.addEventListener("deviceproximity", function (event) {?
    // Current device proximity, in centimeters?
    // The maximum sensing distance the sensor is ?
    // able to report, in centimeters?
    // The minimum sensing distance the sensor is ?
    // able to report, in centimeters?


Being able to show notifications to the user.

var notification = navigator.mozNotification;
    "See this", 
    "This is a notification"
// You could send an optional third parameter,
// which would be the URL to an icon

Privileged APIs

These APIs can only be used in a packaged/privileged app.

The complete list of privileged APIs is:

  • Device Storage API
  • Browser API
  • TCP Socket API
  • Contacts API
  • systemXHR

Device Storage API

Accessing files stored on the device.

var storage = navigator.getDeviceStorage("videos"),?
    cursor = storage.enumerate();?
cursor.onerror = function() {
    console.error("Error in DeviceStorage.enumerate()",;?
??cursor.onsuccess = function() {?
    if (!cursor.result)? 
?    var file = cursor.result;
    // If this isn't a video, skip it?
    if (file.type.substring(0, 6) !== "video/") {?
    // If it isn't playable, skip it?
    var testplayer = document.createElement("video");?
    if (!testplayer.canPlayType(file.type)) {?
    // Show file

Browser API

Implementing your own web browser, completely with web technologies. Described more in BrowserAPI.

iframe.addEventListener("mozbrowserlocationchange", function(e) {
iframe.addEventListener("mozbrowsersecuritychange", function(e) {
    // "secure", "insecure", or "broken".  "broken" indicates mixed content.
iframe.addEventListener("mozbrowsercontextmenu", function(e) {
    // Show context menu

TCP Socket API

A low-level TCP socket API, that will also include SSL support.

var TCPSocket =
        useSSL: crypto,
        binaryType: "arraybuffer"

Contacts API

Accessing contacts on the device – adding, reading or modifying.

var contact = new mozContact();
?contact.init({name: "Tom"});
var request =;
?request.onsuccess = function() {
request.onerror = function() {


Making it possible to allow cross-domain XMLHTTPRequests. Specify in the manifest file in the permissions part that you will want to access it – "systemXHR":{} – and then just do the request.

var xhr = new XMLHttpRequest();"GET", anyURL, true);

Certified APIs

The certified APIs are only available to the system itself/pre-installed apps. In the fcase of Firefox OS, this means only Mozilla.

The complete list of certified APIs is:

  • WebTelephony
  • WebSMS
  • Idle API
  • Settings API
  • Power Management API
  • Mobile Connection API
  • WiFi Information API
  • WebBluetooth
  • Permissions API
  • Network Stats API
  • Camera API
  • Time/Clock API
  • Attention screen
  • Voicemail

I’ll list a few of them here, in case you are interested in testing or contributing to Gaia, the UI of Firefox OS.


For placing, receiving and dealing with calls.

// Telephony object
var tel = navigator.mozTelephony;
// Check if the phone is muted (read/write property)
// Check if the speaker is enabled (read/write property)
// Place a call
var call = tel.dial("123456789");
// Events for that call
call.onstatechange = function (event) {
        Possible values for state:
        "dialing", "ringing", "busy", "connecting", "connected", 
        "disconnecting", "disconnected", "incoming"
// Above options as direct events
call.onconnected = function () {
    // Call was connected
call.ondisconnected = function () {
    // Call was disconnected
// Receiving a call
tel.onincoming = function (event) {
    var incomingCall =;
    // Get the number of the incoming call
    // Answer the call
// Disconnect a call


For sending and receiving SMS messages.

// SMS object
var sms = navigator.mozSMS;
// Send a message
sms.send("123456789", "Hello world!");
// Receive a message
sms.onreceived = function (event) {
    // Read message


To be able to access certain APIs, in an Open Web App context, you need to specify permissions for the APIs you want to access in the manifest file.

"permissions": {
    "contacts": {
        "description": "Required for autocompletion in the share screen",
        "access": "readcreate"
    "alarms": {
        "description": "Required to schedule notifications"

For all APIs that are considered privileged or certified, this applies.

For regular APIs, only geolocation and notification are affected (and for geolocation, in a regular web browser context, the user will be presented with a dialog to approve/decline).

Additionally, the Camera API is restricted as a certified API at this time, but the long-term goal is to make it available to all apps. At the moment, if you want to access the camera, do it through Web Activities.

Platform support

As I’m sure you understand, a number of the WebAPIs are going through a process filled with progress, iterations and improvements. Some of the APIs above will work as described and intended, while others might not at this time.

To be able to follow the current implementation state, please look at the list of APIs planned for the initial release of Firefox OS.

The three columns imply:

  • D = Desktop support in Firefox
  • D = Android support in Firefox
  • B = Firefox OS support
  • Green = Implemented and enabled
  • Orange = Implemented, but needs to explicitly be turned on
  • Red = Not implemented
  • Blue = Only available as a Certified API
  • Grey = Not planned for this platform

APIs planned for the future

While not being worked on at the moment, I’d like to list APIs that are planned for the future. To show you our intent, and things we want to implement and support, and also to show in which direction we are moving.

  • Resource lock API
  • UDP Datagram Socket API
  • Peer to Peer API
  • WebNFC
  • WebUSB
  • HTTP-cache API
  • Calendar API
  • Spellcheck API
  • LogAPI
  • Keyboard/IME API
  • WebRTC
  • FileHandle API
  • Sync API

Testing out these new APIs

Feel free to just copy and paste code from this blog post to test the API(s) that you are interested in. I’ve also implemented support for some of them in the Firefox OS Boilerplate App, available in the webapp.js file (and I plan to add more in the future).

View full post on Mozilla Hacks – the Web developer blog

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Direct Developer for UI Layer

Matrix Resources Irving, TX
Job description: …of custom WPF controls and templates• Working knowledge of Web Services (WCF, REST) is required• Enterprise Application Architecture Design Patterns (e.g. MVVM lite and PRISM)… View full post on – Web Application

View full post on

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Open Mobile Summit: How Wolfram Alpha Adds a Data Layer to the Web

Computational engine Wolfram Alpha’s Managing Director, Barak Berkovitz, talked about the data layer of the mobile Web at a session this afternoon at the Open Mobile Summit in San Francisco. Like geo-data has done for location, Wolfram Alpha adds a new layer to the Web: a factual dimension. This will impact the Web’s evolution, says Berkovitz. Sponsor Disclosure: ReadWriteWeb is a media partner …

View full post on web development – Yahoo! News Search Results

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)