This is a continuation of a previous post - Writing a PaaS (using Node.js) in 1 week – Monday.
Thursday is over, the output of which is at https://github.com/perfectapi/node-paas-machine-host. The purpose of the machine-host is to wait around until it sees that something needs hosting, and then host it. It also takes care of the main command-line interface, providing the ability to publish an app from the command line.
The biggest challenge yesterday was that I had originally designed the upload of a packages files as a “push”, i.e. zip up you package and publish it. Unfortunately that causes a number of issues, the main one being that Node.js doesn’t yet have a nice unzip component. I looked at a lot of possible packages that could handle it, but their APIs were very low level and I don’t have time to deal with that complexity. Also, the zip files turn out to be quite big, which slows things down. Finally, its not that friendly to make people zip it up.
So…I switched to a “pull” model, where the host will pull the files out of Git. That limits us currently to publishing publicly accessible packages stored on github or similar host, but hat can change later.
Another challenge was something that I ave struggled with every time I try to use it – Nodes support for spawning processes. There are 3-4 different ways to spawn a process, but the problem is that for any given scenario, only one of them works properly. So I try `spawn`, then I debug it because it is not working, then finally I try `exec` and it works right away. Aargh. Not good.
Anyway, enough writing this blog; I still have a lot to do if I want to get something working by the end of the day…