Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label virtual. Show all posts
Showing posts with label virtual. Show all posts

2009-08-06

Hudson & Virtual Box, Part 2: Creating a common share with vboxsf

My experiment last week with sshfs came to a grinding halt when I realized that while the share works, and can be automatically started, the permissions do not work and Hudson can't actually use the sshfs share; also, I couldn't get sshfs to compile for OpenSolaris, so it's really a non-starter.

Next up was mount_nfs, but after fighting with that, /etc/nfs.conf and /etc/exports for a couple days off and on, I realized there's a much simpler solution using Virtual Box itself: vboxsf. Note that it's sf (shared folder) not fs (file system).

Thanks to David Herron for the inspiration.

Here's how to set up a vboxfs share:

  1. Ignore the Virtual Box wiki which suggests that you can't just use a Shared Folder: you can.
  2. Guest: Launch your guest, then install the Virtual Box Guest Additions onto it.
  3. Host: Create a user and set its uid and gid to some value which can be created on the guest / slave. For example, on Mac OSX 10.5 Server, launch System Preferences > System > Accounts, and create a "hudsonbuild" user with User ID and Group ID set to 500.
    Note that uid 500 and gid 500 are the defaults for the first user on a Fedora system; on Ubuntu it's 1000; on other systems YMMV.
  4. Host: Create a folder in the root of your host called /shared. Put some files there. Give it full write permissions, and set its ownership to the user who'll be sharing the files:
    find /shared -type f -exec chmod 666 \;
    find /shared -type d -exec chmod 777 \;
    chown -R 500:500 /shared
  5. Host: Add a Shared Folder. NOTE: If your guest is running, shut it down or see the next item. From the Virtual Box GUI (on the host), select Settings > Shared Folders > New (+). Add a shared folder called "shared" mapped to /shared (or call it something else and map it to a different path on your host).
  6. Guest: Alternatively, you can add a Shared Folder to a running guest from its Devices menu. Add a shared folder called "shared" mapped to /shared.
  7. Guest: As root, create a folder on the guest called /shared. Leave it empty, but make sure it's owned by your user.
  8. Guest: As root, add this to the guest's /etc/fstab:
    shared  /shared vboxsf  auto,exec,rw,uid=500,gid=500    0       0
  9. Guest: As root, mount the share one of three ways:
    # mount everything in /etc/fstab
    mount -a
    
    # mount using mount (and optional -o options)
    mount -t vboxfs -o auto,exec,rw,uid=500,gid=500 shared /shared
    
    # mount using mount.vboxsf (and optional -w and -o options)
    /sbin/mount.vboxsf -w -o rw,uid=500,gid=500 shared /shared
  10. Guest: If this mount doesn't start automatically when the VirtualBox guest is started, you can add one of the above commands to the script you use to start the Hudson slave, eg:
    !/bin/bash
    #
    # Init file for Hudson server daemon
    #
    # chkconfig: 2345 65 15
    # description: Hudson server
    
    # HOWTO:
    # 1. rename this file on target server (Hudson slave node) to /etc/init.d/hudson
    # 2. to enable this script to run on startup, as root type the following:
    #    Fedora: 
    #        chkconfig --add hudson; chkconfig --list hudson
    #    OpenSolaris:
    #         for n in 0 1 6;   do cd /etc/rc${n}.d; ln -s /etc/init.d/hudson K15hudson; done
    #         for n in 2 3 4 5; do cd /etc/rc${n}.d; ln -s /etc/init.d/hudson S65hudson; done
    #         svccfg add hudson; svcs | grep hudson
    
    RETVAL=0
    
    #run Hudson as a slave node
    java -jar /opt/hudson/slave.jar -jnlpUrl \
      http://vboxsvr:8080/computer/${slaveNodeName}/slave-agent.jnlp &
    
    /sbin/mount.vboxsf -w shared /shared &
     
    exit $RETVAL

2009-07-28

Hudson & Virtual Box: Creating a common share with SSHFS

I've been working a recently with my own Hudson server, setting up Fedora and OpenSolaris images as slave nodes to prototype new ways to build. Tonight I found a very handy trick for mounting shared drives using SSHFS. Kudos to the man page writers -- all the tips I found via Google were outdated or just plain wrong. man sshfs to the rescue!

Step 1: create a folder on the Hudson master / Virtual Box host with files you want to share, eg., /shared

Step 2: create an empty folder on each Hudson slave / Virtual Box guest as a mount point for the shared folder, eg., /shared

Step 3: on the guest, install sshfs, eg., sudo yum install fuse-sshfs.

Step 4: mount the share: sshfs user@hudson-master-host.your-domain.com:/shared /shared

Of course you'll probably want to set up ssh keys and add this to your startup scripts so that the mount happens automatically when the guest is launched, but I'll leave that for next time.

2009-07-07

Learning to Love the Mac, Part 2: Mouse Tips & Desktop Management

I have an 8-button Logitech MX500 optical mouse, and this week is the first time I've ever successfully mapped functionality to all the buttons. Windows did a reasonable job with a few of the buttons; Linux doesn't support anything beyond the first three; Mac OS X Server just gets it done.

Out of the box, my third button (scroll wheel) is mapped to the seemingly pointless Dashboard, which is a huge pain when you're used to middle-clicking to open a link in a new tab or to copy/paste text in a console. To get that functionality back, go to Applications > System Preferences > Exposé & Spaces then remove Mouse Button 3 from the Dashboard's "Hide and Show" feature.

Next, I set Mouse buttons 5, 6, and 8 to All windows, Application windows, and Show Desktop.

But even cooler than these is Spaces, though as yet I can't find a way to replicate Gnome or XFCE's ability to move windows from from Space to Space which lets you drag open app windows from Space to Space which in the Spaces view (F8). Still, having up to 16 virtual desktops is very handy, particularly when you need to virtualize Windows and Linux. If you want to be able to have console windows on all Spaces rather than having them all collected on a single Space, uncheck the "When switching to an application, switch to a space with open windows for the application".

2009-07-06

Learning to Love the Mac: 13 Tips

A month ago a very large package arrived in the mail: my first MacPro server. I at once fell in love with the case design - clean, simple, and dead-easy to take apart in order to add more drives and RAM. However, that's where the love boat ran aground.

To say it's been a gradual learning curve would be an understatement. Here are a few things I've learned over the past month of dealing with Mac hardware and OS, as well as retraining my fingers to use Mac keyboard bindings (META = Apple Key or Windows Key, depending on your keyboard).

  1. Use META-TAB instead of ALT-TAB to cycle applications
  2. Use META-LEFT/RIGHT instead of HOME/END to jump to start/end of a line
  3. Use ALT-LEFT/RIGHT instead of CTRL-LEFT/RIGHT to jump to prev/next word on a line
  4. META-A, META-X, META-C, META-V replace CTRL-A, CTRL-X, CTRL-C, CTRL-V for select all, cut, copy, & paste. META-L, META-T, META-N replace CTRL-L, CTRL-T, CTRL-N (jump to location bar, new tab, new window). But CTRL-TAB still switches tabs. However, if you have multiple Firefox windows open, there is no way to toggle between them with the keyboard. Same problem with multiple Terminal windows. META-TAB only switches between groups of applications, but not windows within an application.
  5. Sometimes ESC works to dispose a dialog; sometimes only clicking the red X works.

  6. Q replaces qemu, but doesn't seem to work very well for my existing vmware or Virtual Box images
  7. Virtual Box rocks on Windows, Linux and Mac

  8. XCode provides gcc, make, etc.
  9. Fink and DarwinPorts replace Debian/Ubuntu's apt-get and Gentoo's emerge, respectively. Once XCode and DarwinPorts are installed, you can port install vpnc (to fetch deps and compile on the fly) or apt-get install curl (to fetch deps and install).
  10. rEFIt replaces grub, and more or less works as I'd expect. /efi/refit/refit.conf approximately replaces /boot/grub/menu.lst at least as far as picking what partition to default-boot and how long to wait

  11. Java is in /System/Library/Frameworks/JavaVM.framework/Home instead of /opt/ or /usr/lib/jvm/java
  12. Subversion was easier to set up on Mac (using Fink) than on Fedora 10 (using yum), especially since there's now the Galileo+ Update Site from Cloudsmith so you don't have to download from multiple update sites to get it installed.
    However, the version of Subversion available via Fink doesn't work with projects checked out using Eclipse - seems that the commandline client (Subversion 1.4.4) and Subversive with SVNKit (SVN 1.6.1 w/ SVNKit 1.3.0.beta.r5741) are not compatible: svn: This client is too old to work with working copy '.'; please get a newer Subversion client. Using DarwinPorts to update the subversive client to 1.6.3 fixed this issue, but installed it into a different path (/opt/local/bin instead of /sw/bin or /usr/bin).
  13. Eclipse looks better on Mac than on Linux; however, I recently stumbled across a great tip for making Eclipse waste less screen space under gtk on Linux. Highly recommended bit of gtk hackery - one file makes a world of difference!
Do you have any other tips for Linux or Windows people, surviving the transition to Mac OSX? Is there any way to tell OSX to use Windows or Linux keyboard defaults so I don't have to retrain myself?

2008-09-14

Windows XP in Xubuntu with VirtualBox: Aw, snap!

This weekend, on a tip from CDT Doug, I decided to play around with VirtualBox, because there's still a few things I can't do in Linux. I've tried VMware in the past, but the last time I found NAT networking to be a pain to set up. By contrast, VirtualBox is great for drivers and hardware, but getting file sharing to work took some effort. Just make sure you install the VirtualBox Guest Additions into your guest OS, and you'll have video, sound, usb, networking, and sharing.

So, what prompted this? Well...

  1. I can load pages in IE6 or IE7, thanks to WINE and great work of the IESs 4 Linux project... but support for IE7 is still beta, and it's a little slow.
  2. I can run Picasa, also thanks to WINE. The latest version even works properly with Picasa Web Albums and Blogger.
  3. I can open and edit MS Office docs, thanks to OpenOffice (or Google Docs).

But...

  1. I can't run Quicken or QuickTax (ranked bronze or garbage by WineHQ's AppDB).
  2. I can't run iTunes.
  3. I can't run Google Chrome.
  4. I can't run SBCG4AP, or any Windows-only games from Popcap or Gamehouse.

So, it was time to get virtual. I created an 8Gb Win XP Home image, with 192Mb of RAM, running inside my 1.6Ghz, 1.25Gb RAM Thinkpad R51 Xubuntu laptop, and it works great. I can run Chrome, iTunes, Quicken, and at least one GameHouse game. Note that in this screenshot (top right corner), the CPU has clocked itself down to a whopping 600MHz using kpowersave's Powersave scheme and Dynamic CPU policy. You'll also notice I changed the default 'Right Control Key' mouse/keyboard grab toggle to 'Left Windows Key' because that way I don't have to use my right hand to switch from the main desktop to the virtual one.

Unfortunately, SBCG4AP won't start due to this error:

When trying to get a copy of the Win XP Power Toys Tweak UI control panel applet, I managed to kill Chrome, and got this for my collection.

Finally, let me show one last feature of VirtualBox: "seamless mode". With this enabled, you can blend XP apps right into your linux desktop. They're still managed by the Windows Start menu (which I've set to auto-hide in the shot below), and tend to force themselves to be above other linux-managed windows, but it provides an uncluttered way to work, if you prefer it.

2008-05-01

Welcome To The Machine

Looking for concert tix at Ticketmaster tonight, I got to talking about reCaptcha w/ SWMNBN, and found this video. Take a look.

Web 2.0 ... The Machine is Us/ing Us

In related news (or lack thereof), Terminator: The Sarah Connor Chronicles has not yet been picked up for a second season. C'mon, FOX, surely Summer Glau beating people up trumps another *freakin'* season of Family Guy or American Dad??

2007-12-04

Eclipse Development All-In-One

I'm shocked. Check this out:

Twelve per cent [of those companies surveyed] said they focussed “exclusively” on .Net development while an additional 49 per cent focussed “primarily” on .Net. Only three per cent of enterprises were exclusively Java shops, while an additional 20 per cent focussed “primarily” on Java.
...
But as more companies adopt Microsoft Exchange as their messaging software and SQL Server as their database, the decision to use .Net develop tools is “almost a no-brainer,” Goodall said. (source).

This seems counterintuitive to me. Sure, there's entrenchment. Sure, there's comfort in using Microsoft products as for most people that's who provides their operating system, office tools, and mail software. But c'mon, which companies did they survey? I'd love to find out but I can't find a copy of their survey results online, and even if I could I'm not about to cough up $150 - $990 for a 200K PDF file. Begs the question -- who commissioned this report, and how deep are their pockets? IMHO, there's a fine line between market research and marketing.

Or... is it possible that OSS people just don't have time to answer surveys because they're too busy contributing to their community? ;-)

Pointed pontifications aside, perhaps the real point here is that Microsoft does a better job at selling the 'one stop shop' idea of operating system + office tools + database + mail tools + mail server + dev platform. Sure, all of that is also available in the FLOSS / LAMP world, but are we failing to market it it as a cohesive offering? Is it still too disparate, too complex?

And has anyone thought of building an ubuntu + Ganymede self-contained offering? I know there's some cool virtual appliances out there, such as Grandma's LAMP, but AFAIK there's never been an attempt to bundle Eclipse w/ an OS for an all-in-one offering. Now that there's an Eclipse Store and an Eclipse Donations site, isn't it time for some Eclipse DVDs to complete the trifecta? Along with the new EPP bundles planned for next July, wouldn't it be cool to have an Eclipse Ganymede + ubuntu 08.04 Distro DVD? A collector's item, for sure.

Oh, and with the advent of the EMF4Net proposal (yes, that's EMF for the .Net plaftorm), this all-in-one DVD would also allow people to develop C# apps as well as Java. And php. And perl. And ruby. And python. And C/C++. Whoops, there we go again with too many choices. ;-) Once again, maybe Microsoft continues to dominate mindshare not because they're better or more entrenched, but out of a sense of simplicity.

So, here's my new mantra:

Simple is sexy.
Options are overwhelming.

Agree? Disagree? Post your thoughts here, or blog them and/or link here. I'd love to know your experiences as a customer or as a vendor, as a client or as a developer.