Glimpse + AppHarbor = Sad Face :(

So…you’re using MVC3 right? Good. And you’re using the awesome new server debugging/troubleshooting tool Glimpse right? Naturally! And you’re deploying to fantastic AppHarbor platform right? Of course you are! And they all go together like peanut butter and chocolate right? WRONG!

While all 3 of these things are quite awesome, you’ll be quite disappointed when you push your site to AppHarbor and then try to get a Glimpse into what’s happening on the server-side. This is because Glimpse, by default, only allows you to use it from localhost and if you want to use it from any other hosts you have to specify the IPs in the web.config. OK, that’s cool, I’ll just add my public IP and we’ll be in business right? Nope.  That’s because the IP restrictions are enforced by this code:

So, what’s wrong with that? Nothing. The problem lies in the architecture of AppHarbor. They use load balancers to send requests to the server your app is running on. That means that Request.UserHostAddress is going to be the IP of the load balancer rather than the actual client.

At this point you have two options:

  • Add the IP of the load balancer
  • Allow all IPs

Both of these result in any client being allowed to turn on Glimpse on your site. That’s not good. It reveals too much info about your server. The code could be updated to also check the HTTP_X_FORWARDED_FOR header value but that would be pretty easy to fake in a non-loadbalanced environment.

Tags: , ,

Delicious Digg Facebook LinkedIn reddit StumbleUpon Twitter Email Print Friendly

Customize an Existing Amazon Machine Image (AMI) from Windows

Creating a custom AMI from scratch can be a daunting task, not to mention time consuming. There are a lot of public AMI’s that are a pretty good start to many tasks, so it might be easier and quicker to just customize one.

I’ll assume that you have already:

  1. Signed up for EC2
  2. Installed and Setup the EC2 Command Line Tools
  3. Launched an instance of the AMI you wish to customize.
  4. Customized the instance and it is still running.
  5. Can SSH into the instance with PuTTY.

So you’ve got your image all polished up just the way you want it. Now what? Well, first you need to save your x509 EC2 certificate to the image. The most straight forward way to accomplish this is to open your certificate locally and copy all the text to your clip board. Now hop over to putty, type

vi /mnt/cert.pem

and hit enter. This will create a file called cert.pem in /mnt and open it for editing. (NOTE: The image bundling utility will ignore certain sub folders when it creates the image. One of those is /mnt which makes it a good place to store things like private key files and the new image itself that you wouldn’t want bundled with the image.) Press ESC followed by i to enter INSERT mode. Now you can paste the text of your certificate into PuTTY by simply right clicking in the PuTTY window.

Do the same for your private key file saving it to /mnt/privatekey.pem.

OK, now you’re ready to bundle the AMI and save the image. run the following command from the console of the AMI you customized:

ec2-bundle-vol -d <path to save the image> -k <path to private key file> -c <path to certificate file> -u <user account number>

<path to save the image> = Where you want to save the AMI that you are bundling. I suggest something like /mnt/ami so that the image won’t be included in the bundled image. (That would be rather redundant!)

<path to private key file> = The path to your private key file on the image. In this example we used /mnt/privatekey.pem.

<path to certificate file> = The path to your certificate file on the image. In this example we used /mnt/cert.pem.

<user account number> = Your Amazon Web Services account number. You can find this by logging into the AWS site and clicking on Access Identifiers. Your account number is listed near the top right corner right under “Welcome, Your Name”.

Alright, now we need to upload the image S3 so that it will be usable. From the console of the image run the following command:

ec2-upload-bundle -b <bucket name> -m <path to manifest file> -a <access key> -s <secret key>

<bucket name> = The bucket in your S3 account that you want to save the image to.

<path to manifest file> = Path to manifest.xml created by the image bundling tool. In this example /mnt/ami/manifest.xml.

<access key> = Your AWS access key from the Access Identifiers page of AWS.

<secret key> = Your AWS secret key from the Access Identifiers page of AWS.

We’re almost done! Now you just need to register the image with EC2. From your desktop (not the image you customized.) run the following command:

ec2-register <bucket name>/manifest.xml

Congratulations! You now have a customized AMI ready to be launched.

Tags: , ,

Delicious Digg Facebook LinkedIn reddit StumbleUpon Twitter Email Print Friendly

Remove ‘Compress Old Files’ from Disk Cleanup Wizard

Haven’t had to use this trick in a while since I’m running Vista on all my machines these days. I was over at my Mom’s house using her ancient XP box that was almost out disk space. I fired up the disk cleanup wizard and then I remembered why I don’t like it. It takes about 3 years to scan every file on the disk and suggest that I compress the old ones. Follow the steps below and you can use the disk cleanup wizard without it trying to compress all your old term papers still on your hard drive!

  1. Start>Run type regedit and hit enter.
  2. Cruise on down to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
  3. Delete the ‘Compress Old Files’ key.
  4. Have glass of your favorite beverage and use the Disk Cleanup Wizard to free up some extra space.

Of course, if your looking for something that will help you get a better handle on what file are taking up so much space and where they are you should check out WinDirStat. It will scan your drives and draw a picture of every file on your hard drive so you can see where the big ones are and delete them.

Tags:

Delicious Digg Facebook LinkedIn reddit StumbleUpon Twitter Email Print Friendly

Installing Ubuntu 8.04 under Microsoft Virtual PC 2007

Trying to install Ubuntu on VPC 2007 I kept getting the following error:

An unrecoverable processor error has been encountered.

The virtual machine will reset now.

image 

 

After much searching I landed at a blog post by Robert Cain over at Arcane Code. He has a nice step by step for installing Ubuntu 8.04 on VPC 2007, however like myself, many folks were still getting this error. Reading down the comments there were several suggested workarounds. This one from SteveZ fixed the problem:

- At the prompt, press F4 and select “Safe graphics mode”.
- Then press F6 and delete the part that says “quiet splash –” and replace it with “vga=791 noreplace-paravirt”.

You can read Robert’s excellent step by step at:

Installing Ubuntu 8.04 under Microsoft Virtual PC 2007 « Arcane Code

And be sure to check all the way down the comments if you are still having issues. Lot’s of smart folks chiming in over there.

 

PS: Don’t forget to edit grub to use those options after you install or you won’t be able to boot ;)

Delicious Digg Facebook LinkedIn reddit StumbleUpon Twitter Email Print Friendly
Get Adobe Flash playerPlugin by wpburn.com wordpress themes