Recently i tried to explain to a fellow developer how to update our server hosted by AppFog PaaS, everything in our process is development so its not all that great (yet) and hopefully i will eventually have time to improve & automate this, but for now here it is.
- Built the Client side app in flash builder
- Checkout the latest stable Node.JS server app code
- Copy the bin-output dir of client code inside the server’s dir structure
- Use the AppFog CLI to update the ‘dev’ version
- conform this is working ok for a couple of weeks
- clone to ‘production’
As i said, possibly not the neatest solution, but its what we are currently doing.
Since i develop the server using the wonderful Cloud9 the awkward part of the process is uploading the bin-output to c9’s workspace so i can update using the af util. This new dev will be deploying from an OSX machine which we shall say is ‘fresh’ no OSX homebrew etc, and for now thats the way i want to keep it. Seeing as a fresh OSX Lion machine does not have a version of ruby high enough for AppFog CLI to run, the port to Node.js was born (yes i know they will need to install this too but whatever)
So AppFog CLI and AppFog API were both born and so far have about 24 hrs work between them. I’ve separated this mini project into two parts as hopefully the appfog-api (npm link) will allow others to build automated deployment/monitoring etc into their own apps.
So please npm install af and let me know how you get on with it. Currently this lib is at a very early stage with just the ‘get’ functions but hopefully by V1.0 i should have implemented the bare minimum of af update, af push, and af stat
continued on from Developing Units of Sound Online
Before being opensourced Adobe was push Flex as a flexable framework which would compile down to AS3 and run inside the flash run time environment. So without too much thought and investigation this is what i started to develop in and so far all my experiences have been great. Nine times out of Ten when i start to tackle a problem which is complex and not breaking into smaller sections very well i find that with a bit of reading the functionality is already implemented or partially implemented but under a different ‘name’.
To begin with, some background Units of Sound is a online port of an existing windows native program, and currently has an install base of around 5000 users all in the UK. To allow expansion to other countries and other platforms as well as to out run limitations with the old program (written in a non longer supported language) I am helping move this program to a Flex application which will be capable of running entirely in browser.
Architecture in my mind is what drives the majority of high level decisions including ‘do we even need our own server?’ this sounds like an obvious question but after some thought about the operation of the program i found that 95% of it was statically served and run entirely in the client.
The KISS principle is something I think about a lot when undertaking tasks of this nature. The UOS team is made up of two developers and in all likelihood will never be made up of any more, once written the program will change very little, there will be the bare minimum of documentation and the scale will most likely never top 30-40K users. Bearing this in mind its more important that bugs can be found easily, code can be stopped and stepped through and that what each function and section is trying to achieve is obvious.
My latest conundrum comes the previously mentioned question ‘Do we even need our own server?’ Flex is a very powerful language, it allows us to make http calls and use other third party SaaS type API’s E.G Amazon Web Services S3 or Rackspace Cloudfiles, why not just use these to do the small amount of storing required? we could even find a company to host our database, server our static content from storage providers and we are 100% ‘serverless’ (serverless as in we dont have to write any server side code). But this architectural decision does have downsides, first and most obviously is we loose control of that area of our program and therefore User Experience. With a realitively small number of users its important to provide an excellent user experience. We would loose a few other things:
- custom request hooks
- analytics becomes harder
- unforseen functionality might be limited
- caching not under out control
- easy of access to our ‘own’ data
My decision was not a light one, the simple approach of no server to deal with is very aluring, but in the end the unknows and out-of-our-control’s are too many so we will stick with a traditional approach and run our own server. Next post, Technology
Ive long been a fan of Cloud9 IDE and with my recent purchase of a RaspberryPi what better way to start some native code development than with the IDe i already know and love.
Cloud9 started off with a heavy Node.JS bias, in fact the majority is written in node, but with ACE editor at the heart and its increasing ability to access the command line, configure ‘deplyment’ commands i figure it will make a fantastic IDE for C / C++ / Python or obviously Node.js development on the PI.
So flashed my SD card with a fresh Adafruit image to get some of the kernel module bells and whistles for later use and went about getting C9 up and running.
Step 1 : Node
This was simple enough
sudo apt-get install nodejs and I’ve installed node, but seeing as this is only version 0.6.* from the repo ill need npm as well
sudo apt-get install npm a hop back to the command line and bobs your fathers brother
Step 2 : Cloud9
Cloud9 have some great instructions on there github readme so off to work i go. unfortuneatly this is where the wheel start to come off…
/usr/local/bin/sm -> /usr/local/lib/node_modules/sm/bin/sm
> firstname.lastname@example.org postinstall /usr/local/lib/node_modules/sm
> node ./scripts/postinstall.js
npm ERR! TypeError: options.uid should be a number
npm ERR! at ChildProcess.spawn (child_process.js:429:26)
npm ERR! at Object.spawn (child_process.js:342:9)
npm ERR! at spawn (/usr/share/npm/lib/utils/exec.js:103:22)
npm ERR! at exec (/usr/share/npm/lib/utils/exec.js:40:12)
npm ERR! at Array.0 (/usr/share/npm/lib/utils/lifecycle.js:141:5)
npm ERR! at EventEmitter._tickCallback (node.js:190:39)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug –attach /usr/share/cloud9/npm-debug.log npm
npm ERR! System Linux 3.2.27+
npm ERR! command “node” “/usr/bin/npm” “install” “-g” “sm”
npm ERR! cwd /usr/share/cloud9
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message options.uid should be a number
npm ERR! Additional logging details can be found in:
npm ERR! /usr/share/cloud9/npm-debug.log
npm not ok
Som more google shows no real answers so i figure im going to plow on and just do a standard npm install.
More updates to come. . . .
I’ve found over my few years of ‘learning by doing’ that one of the hardest things to get is feedback. If an application works, some would say that that’s enough, but for whatever reason i would love to get some feedback from other developers, so I’m putting this post out there and willing to listen and discuss anything that may come up.
My quote book project has gone though a recent change on the ‘Dev’ Branch of this Git hub repo. if anyone would like to take the time to have a read (its not that complex) and give me some feedback either in comments or emails, that would be awesome. My current development can also be seen in cloud9 IDE
Firstly, i dont have a framework in place. I know that everyone will tell me that a decent FLEX framework would have stopped this problem before it begins but for Units Of Sound we decided against it for a couple of reasons, but mostly, simplicity.
So that being said here is my problem. My application makes use of viewstacks and viewstack controllers (i quite like this paradime that i was introduced to when taking on my first iOS app) to control views in the form of
public class page extends NavigatorContent of a a
public class lesson extends ViewStack with a
PageNavigationController which is a group of buttons with a reference to the lesson viewstack.
I want my pages, and the subcomponents of these, to be able to respond to events from the controller but my controller sits ‘higher’ in the display stack and therefore the events are only catchable by components above it.
Not sure how im going to fix this one but hopefully ill be able to come back and update on this issue soon enough
I found out about a small Node.js server / client framework call Meteor at the weekend. After watching the video and reading a bit of the front page i was hooked and spent the rest of the day trailing round the shops with Emma reading the API docs.
First of, this looks awesome if it works half as well as displayed in the video then im sold. I can integrate bootstrap and backbone into my client side and write small webapp projects in no time. exactly what you need for minimum viable product type projects.
I have some reservations as the whole project runs on top of fibers which has been getting some stick. But maybe the sacrifice of Node.js’s great non-blocking architecture for ultimate simplicity in building is something i could get behind.
Anyway keep an eye out here as im sure ill be trying to get a small web-app up and running with the framework very soon.