Just had some fun with node.js
I found Introduction to Node.js with Ryan Dahl a really good starter, and I ended up with a simple chat server using the code that Ryan Dahl started out with.
Wednesday, August 17, 2011
Saturday, August 06, 2011
Thursday, August 04, 2011
Recently, I had the fortune of figuring out how to boot and provision VirtualBoxes in a private network on the host machine automagically.
First, the primary objectives:
- The virtual machines should be connected in a private network on the host machine so that they can communicate securely with each other. The machines should have an ip address in the private address space.
- The virtual machines should also be able to communicate with the "outside world". From the point of view of the guest machine, this can be other machines on the same network as the host or the Internet-at-large.
- The host machine should be able to network (primarily ssh) with the virtual machines. Typically, this can be done through the router gateway of the host or a "host-only adapter" (a virtual adapter that resides on the host).
- TunTap networking. This can be tricky to setup correctly and varies across platforms.
- Each VM uses two network interface cards (NICs):
- One Host-only adapter with its own dhcp server for the private network OR use the "Internal Network" feature of virtual box.
- One bridge adapter that get its ip address from the outside world (possibly the router to which the host machine connects to).
Next, secondary objectives:
- We want to boot the VMs automagically, find out the ip address.
- Then, we want to ssh into the machine and do provisioning via chef or puppet.
- Use VBoxManage guestcontrol to execute the /sbin/ifconfig command
- Use NAT with port forwarding for ssh
($ VBoxManage --natpf<1-N> [
],tcp|udp,[ ] )
- Hack /etc/init.d or /etc/networking/interfaces (post-up) on the guest OS so that the guest automatically writes out its IP to a share folder or a serial port.