Cleverstack, Node Server and Source Reload with Vagrant

posted in: Cleverstack, Vagrant | 0

We are developing applications with Cleverstack as the framework. To ensure congruence between development environments, I decided to opt for Vagrant. The cleverstack framework has a nice reload function built in where changes made in the source of the application are immediately picked up and the browser is refreshed to display the new changes. Awesome for the developers…this presented a problem when working with the Vagrant box.

The port forwarding set up in the Vagrantfile is as follows: “forwarded_port”, guest: 9000, host: 9000 “forwarded_port”, guest: 9090, host: 9090 “forwarded_port”, guest: 9009, host: 9009 “forwarded_port”, guest: 4444, host: 4444 “forwarded_port”, guest: 8080, host: 8080 “forwarded_port”, guest: 3306, host: 3306
#Add this to ensure that all changes in the javascript are refreshed automatically as well “forwarded_port”, guest: 35729, host: 35729

The first instinct, off course is to access the node server (Run by navigating to the project root and running clever server) on http://localhost:9000. The changes was recognised by the node server, but the browser was not refreshed.

File "app/index.html" changed.
Completed in 0.000s at Wed Aug 06 2014 14:20:17 GMT+0200 (SAST) - Waiting...

After some troubleshooting I made the discovery  that  the server was making a callback to the address used in the URL (which I missed :-0 ) to do the automatic reload. So I resolved to using the ip address as the url eg.

The result:

>> File "app/index.html" changed.
... Reload app/index.html ...
Completed in 0.000s at Wed Aug 06 2014 14:26:20 GMT+0200 (SAST) - Waiting...

Reload Done, Developers happy! At least for now.

Leave a Reply