All articles tagged nodejs

  • The circle is complete - packaging web as a .exe

    At work got a request to package a website for offline use. This time the time was very pressing and needed to be done in a few hours. I decided to test out node-webkit and see how it worked. And it works just fine! We tweaked the website to save it’s info to a WebSQL-db and then packaged a Mac-app and a Windows-app which just works!

    It worked so good I decided to test how far I could take this. So I decided to build a VCR for the swedish public service. It’s a very simple proof of concept that runs in the packaged browser and uses ffmpeg to save a HLS-stream to the desktop. Since node-webkit uses nodejs you have all the npm-packages at hand, and there is very nifty little wrapper called fluent-ffmpeg that handles all the communication with ffmpeg. You can take a look at the code over on Github

    And will we’re at it, you can also checkout AppJS, TideSDK or Awesomium=)

  • Running two services at once on Dotcloud

    If you’re a regular of my old personal blog you know that I have tested most of the more well known Django hosting services.

    The reason I chose Dotcloud for this project was that it involved both Django and NodeJS, and to make it more of a mess it it as web that both is an online and an offline web (yep, HTML5 appcache). For the offline part we are actually using some CommonJS modules straight in the browser. And to protect these files and not get the application server to serve those files we needed to be able to customize the Nginx configuration. So to make all these pieces fit nicely on just one host the choice was pretty easy, Dotcloud.

    So how do we deploy a two (or more) service thingie in Dotcloud? It’s actually very easy. You just add one more service in your dotcloud.yml, like:

      type: python
      approot: cleverfoldername
      type: nodejs
      approot: cleverfoldername/node
        node_version: v0.6.x

    This will fire up two instances, one for the django service and one for the nodejs service. As you can see the root for the nodejs service is actually inside of the django service, this is because we are serving the commonjs modules for the offline web through the django servive, and since offline cache only works on the same domain this is a nice way to solve that.

    If you’re having any trouble please check your logs for that app, or ssh into the very service to dig deeper, if you’re having trouble with paths etc.

    So how is this Dotcloud working for this application? Just great, right now it’s in the sandbox flavor, which means it’s on a slower cluster, no custom domain and if not used for a while it will go into hibernate, which suits us just fine since it’s right now for testing and verification. One thing you should keep in mind, a service can’t be upgraded to a paid flavor, so that means you have to deploy it once more and move the database etc.

Page 1 / 1