Thursday, April 19, 2012

Pure Joy: Setting up a cloud on my desktop [Nerdgasm]

I am currently running the following setup on my beast of a desktop:


  • VirtualBox x64
  • Two VMs of XenServer, each with 8 GB of RAM
  • A guest OS of CentOS Desktop, one on each of the XenServers
  • A VM of CloudStack via VirtualBox with 4GB of RAM, managing the XenServer servers
  • Using XenCenter directly from the Desktop as another means of Managing the XenServers.
I'm pretty sure that's the beginning of a cloud right there, without ever having to leave 127.0.0.1.

Bad UX: Schwab's Check Deposit App for iPhone is Broken

Ed. Note: I wrote this when I was quite annoyed, and unfortunately I left out the larger context that this is actually one of the best checking accounts I've ever owned. It's free, you gain interest, and all ATM fees get refunded at the end of the month. 


Also, in the interest of Schwab, who I (rightfully) criticize here, they also reached out to me personally and I have a direct line of contact to help them fix this bug if I'm able to reproduce it in the future. Pretty good social media response.

Just an FYI -- if you're considering Schwab because of their touted mobile phone check deposit system, might want to think again if you have an iPhone.

On my iPhone 4S, here is the experience I just had trying to deposit a check:


  1. Open the app
  2. Login to the app using my poor-by-mandate password
  3. Select Schwab Bank account, even though my Schwab investor account is inactive (an extra unnecessary click)
  4. Click "Deposit Check"
  5. Enter the amount of the check
  6. Click the button to take a picture of the front of the check
  7. line the check up with the blue box on the screen and then hit the camera button.
  8. See a preview image of the front of the check. But wait, it's not the cropped version inside the blue box, but instead it's the whole picture, which looks much smaller and off-center.
  9. Hit the "Use Image" button. Nothing happens.
  10. Wait, anticipating something to happen (i.e. data transfer). Nothing happens.
  11. Hit "Cancel" button. Nothing happens.
  12. Hit "Cancel" again. Nothing happens.
  13. Hit "Retake Image" button. Nothing happens.
  14. Hit buttons many times hoping for something to happen. Nothing happens.
  15. Hope there's a back button. There is none.
  16. Hit the Home button and then force-quit the app from the app tray, just to be sure.
  17. Repeat steps 1-14, which ends in utter frustration.
  18. This time, try switching away from the app and switching back (instead of quitting)
  19. Repeat steps 1-14, with no success.
  20. Force quit the app again.
  21. This time, repeat steps 1-14 ignoring the blue box (thinking that the bug is maybe that it's expecting the whole picture to be the check). No success there either.
  22. Repeat steps 1-14, attempting to scan the back of the check first, even though it's the second button.
  23. IT WORKED!
  24. Click the button for the front of the check. it worked!
  25. Hit Review deposit
  26. Hit submit deposit.
26 Steps. But really, when you account for the fact that I was repeating sections of steps,  I had to take around 78 steps just to do something as "intuitive" as submitting a check.

Now that I've figured out a way around their UX madness, I hope to be able to submit this to their support accounts and hopefully get some results.

</rant>

Tuesday, April 17, 2012

Building a Build Process, Part 4: Source Code Management via Subversion and Apache on CentOS

This is part of a larger series in building a proper build process. For more information and additional series links, check out the introductory post.


Now we’re getting ready for some of the fun stuff. This time around, we’re going to install Apache (aka “httpd”) and Subversion (aka “svn”) and prepare to create a basic repository over https authentication.

Installing the Binaries

  • Login to your CentOS VM as the root user.
  • Open the Terminal (it can be found in Applications –> Accessories –> Terminal)
  • Type the following in the terminal (without quotes): “yum install mod_dav_svn subversion”. This tells CentOS to use its package manager to pull down the subversion module for Apache and the subversion binaries itself. NOTE: A nice feature here is that CentOS knows that mod_dav_svn requires Apache, and so it’s going to install Apache for us as well. Very kind!

Creating Directories for Subversion

We need to give the subversion repositories a place to live, and we want to provide a common directory for subversion authentication.
In the terminal, type the following:
  • mkdir /var/www/svn
  • mkdir /var/www/svn/repositories
  • mkdir /var/www/svn/auth
This will create the Subversion folder that lives within Apache’s www directory.

Create Local User Accounts

These accounts are separate from operating system accounts – they’ll apply only to Apache via the configuration files we’ll be setting up soon.
NOTE: These user accounts will apply across multiple repositories if we’d like them to; think of them as “subversion-wide” user accounts.
We’ll create two test users by running the following via the terminal:
  • htpasswd -csb /var/www/svn/auth/svn.htpasswd svnuser1 passw0rd1
  • htpasswd -sb /var/www/svn/auth/svn.htpasswd svnuser2 passw0rd2
NOTE: Leave off the “-c” parameter from the second line, or you’ll create a completely new file, erasing your svnuser1 account!
This creates the credentials for both users in the svn.htpasswd file. –c is the command to create a new file, –s forces SHA encryption of the password, and –b lets us pass the password via the command line (otherwise, it would have prompted us one at a time).

Creating our First Repository

We’ll create a repository called TestProjectRepo under our repositories directory that we’ve created by running the following on the terminal:
  • svnadmin create /var/www/svn/repositories/TestProjectRepo
That’s it! We’ve created the repository. Pretty simple, huh?

Granting Apache Ownership of the Repository Folder

Apache installs its own user account when setting itself up. The user, of course, is “apache”, and a group called “apache” now exists as well.
Run the following command in the terminal to grant apache the access it needs:
  • chown -R apache:apache /var/www/svn/repositories/TestProjectRepo

Editing the Apache Configuration to View our Repository

First, we’ll need to create configuration file. To do this by creating and opening a blank file, type the following into your terminal:
  • gedit /etc/httpd/conf.d/svn.conf
This brings up gedit, a nice graphical text editor (Nerd note: I can feel the Linux pros glaring at me for not suggesting that we use “vi”.)
Enter the following into the text file:
   1:  <Location /svn>
   2:  DAV svn
   3:  SVNListParentPath on
   4:  SVNParentPath /var/www/svn/repositories/
   5:   
   6:  AuthType Basic
   7:  AuthName “TestProject Repository Site”
   8:  AuthUserFile /var/www/svn/auth/svn.htpasswd
   9:  Require valid-user
  10:  </Location>

Save the file. This text does the following:
  • Line 1: Tells apache that off of the main URL, the virtual directory will be “/svn”. (so if apache is hosting a web site at www.myreposite.com, our app will be located at www.myreposite.com/svn)
  • Line 2: Tells apache we’ll be using the mod_dav_svn module
  • Line 4: the location of our repositories on the actual server
  • Line 6: Configures basic authentication (which is the type of auth that our basic file setup is using)
  • Line 7: Defines the Text that will show up when the user is prompted for a username and password
  • Line 8: This is the reference to the file we created that holds the basic passwords
  • Line 9: This states that for this directory, Apache will deny anyone who doesn’t login as a user that is listed in our auth file.

We need to restart the server for these changes to take effect. To do this, enter the following into the terminal:
  • /etc/init.d/httpd restart

Seeing it in Action


Since the default configuration for apache is to host web site’s on port 80, you should be able to point a web browser on another machine to your subversion server’s web site via its IP address and get the result.

I didn’t know what the IP address was for my subversion server, so I typed “ifconfig” into the terminal to get. I saw that my “inet addr” for my connection “eth0” is 10.0.0.15, and I know that the site is hosted on port 80 by default (which I don’t have to enter into my web browser because it knows this), and I know that the virtual directory is /svn, so I type the following into my web browser:


…and lo & behold, I’m greeted with a password prompt! I enter one of our pre-defined usernames and passwords, I’m greeted with the following in my web browser:

09 - SVN on Apache

Great – I can see my repository!

Now, bear in mind, this is an empty repository, so clicking on it won’t give you the satisfaction of seeing any project files. But don’t worry, we’ll be taking care of that next.

Starting Apache Upon System Startup

For use multiple times, it will likely make sense to have Apache start up with the system.

On the Centos VM command line, run the collowing:


  • chkconfig httpd on

That's it; the server will start at boot.

Feedback Welcome!

I'd love to hear any comments on this series. Find it useful? Think there's a better way to implement the technique or something I should have mentioned? Please drop a line in the comments to help me improve the series!

References

Some of the great resources that I pulled this information from:


<— Part 3: OS Setup

Monday, April 16, 2012

Building a Build Process, Part 3: OS Setup

This is part of a larger series in building a proper build process. For more information and additional series links, check out the introductory post.

Alright, this is a little bit of a cheat post but I wanted to emphasize the simplicity of these setups.

Installing the OSes on our VMs

Windows

  • Select whichever edition of Windows Server you'd like to install if prompted.
  • Follow the default setup options or customize as you like. Allow it to use the full space of the Virtual HDD we created.

CentOS


  • Start up the VM and proceed through normal, default setup options.
  • Allow the OS to use the standard partition format and use the entire virtual disk when it asks.
  • You will have to set up a root password and an additional user. For memory's sake in the demo, I made the root and user password the same, and made the user my first name. This is, again, not recommended for a production environment. Use a very secure password for the root user, and don't be a dunce about your user account's password, either.
  • Disable the Firewall and SELinux. These are both important components, and I may turn them on again after everything is configured, but due to my own limitations on their intricacies and the demo purposes, we'll leave them. IMPORTANT: DO NOT run a production system without these turned on. I'll likely do a follow-up post later indicating ways to do this more securely.
  • I chose the Gnome desktop environment because it was the default. Choose the flavor that suits you.
  • When presented with the option for additional components, I checked off "Server - GUI". To be honest, I'm not even sure what exact capabilities this gives us; it just seemed like a good gut choice. I'll try to look up more on that later (maybe).

After Installation

Windows

IE 9 -- But not through Windows Update
You should have IE 9 on a Windows Server. To be honest, I'm not sure why, but it feels right to have the OS-supported "standard" available, even if it's not your first go-to browser. IE 9 on Windows Server provides a great layer of protection over potentially harmful actions, so I use it when I'm in "caution mode".
However, you'll likely want to obtain IE via my method described here, because as of this writing the MS Installer on Windows Update is screwed up. 
An alternative browser to IE
You should also have a browser on your machine for those I-know-what-I'm-doing-and-just-get-out-of-my-way-damnit times when you don't feel like dealing with IE's extra protection. I use Google Chrome, but pick whichever browser suits you.
VirtualBox Guest Additions
This is as easy as clicking Devices from the VirtualBox host window (the window that surrounds your VM), and then clicking “Install Guest Additions”.

VirtualBox pops up an installer on the screen. Follow the default steps to install, or select custom options.
IIS WebPI
I highly recommend downloading the Web PI (Web Platform Installer) from Microsoft. It’s got a great interface for quick configuration of applications and installs.
WebPI Downloads – Install the following packages:
  • .NET Framework 4.0
  • IIS 7 recommended settings 
  • ASP.NET MVC 3

CentOS

VirtualBox Guest Additions
  • Click Devices from the VirtualBox Host screen (the screen surrounding your VM) and click Install Guest Additions…
  • This will bring up a link to a CD on your CentOS desktop, indicating the CD is mounted.
  • From there, follow these directions. Leave a message in the comments if you’d like me to expound on the subject.

On Both OSes

Updates and Patches!
This is very important. I did the following.
On Windows
  • Run Windows Update. Restart. Run Windows Update. 
  • Repeat this process until there are no more updates available.
On CentOS
  • Go to the Software Updater, which you can access via Applications --> System Tools --> Software Updater, as seen below:

  • Click "Apply Updates" for all available updates.
  • Restart (if necessary).
  • Repeat process until there are no more updates available.

Initial VM Snapshot

This is optional, but I find that it's always helpful to be able to go back to the beginning when necessary, so I always take a snapshot of VMs after they're created.
  • First, shut down all your VMs so you get a clean snapshot state.
  • Click on an image and then click the Snapshots button at the upper-right corner, shown below:
07 - Details and Snapshots
  • Right-click on “Current State” and select “Take Snapshot”, as shown below. You’ll be asked to save the snapshot; I choose the name “Initial Setup” the first time I go through the process.
08 - Take Snapshot

That’s it! Next, we’ll look at setting up our source code management system.


Feedback Welcome!

I'd love to hear any comments on this series. Find it useful? Think there's a better way to implement the technique or something I should have mentioned? Please drop a line in the comments to help me improve the series!



<-- Part 2: Groundwork -- The VMs

Quick Fix: Windows Server 2008 R2 Internet Explorer Windows Update Issue [Field Notes]

Problem

On a fresh install of server 2008, after adding IE 9 via Windows Update, the installation appears again in later updates.

When trying to perform this install, you receive the error code "9c48".

Cause

In layman's terms: Essentially, it looks like the installer binaries after April 2012 are screwed up somehow. This causes it to install incorrectly the first time, and see itself as ready to be downloaded for the first time (instead of ready to download updates).

Solution

Step 1: Uninstall your current Internet Explorer


  • Go into Windows Updates
  • Click "View Update History"
  • In the search box up top, type "Internet" and the search should filter to include "Internet Explorer 9".
  • Right-click on Internet Explorer 9 and Choose Uninstall.

Step 2: Download a good installer

Via this great thread, I found a solution on the download location.

You can download a non-broken IE 9 Installer from Microsoft at http://www.microsoft.com/download/en/details.aspx?id=23332.

Step 3: Install the Downloaded (non-Windows-Update) IE 9

This one's pretty straightforward. You'll have to restart once you're done.

Step 4: Check for Updates

When checking for Windows Updates, you should no longer see Internet Explorer 9 offered as an update, and should instead see updates for the program (if available).

Sunday, April 15, 2012

Building A Build Process, Part 2: Groundwork -- The VMs

This is part of a larger series in building a proper build process. For more information and additional series links, check out the introductory post.


A note before we begin: This post is going to run us through how get up and running with VirtualBox. For those of you already living in virtual (machine) reality, just create VMs for Windows Server 2008 and CentOS 5.x (5.7 at the time of this writing).
Ingredients
For now, you'll need:
  • A host machine for your Virtual Machines
  • A VM app (this will use VirtualBox)
  • CentOS 5.7 (or the latest current stable release of 5)
  • Windows Server 2008 R2 (or your preferred variant) -- you're on your own for this one. You can get windows in lot of places, though: retail, MSDN, educational discounts, or the BizSpark program can all be good options.
  • Visual Studio 2010 (or your .NET editor of choice)
I used my lovely new desktop rig as the host for the VMs (it can handle the strain). You may want to use multiple machines or a server. In my case, we'll be running VirtualBox on top of my Windows 7 Professional setup. I only mention the host as being important now as we may add some more VMs later in the process.

Installing VirtualBox
This one's pretty easy -- download VirtualBox and install it on your host system of choice.

Creating our VMs
We'll be creating two VMs initially for our current purposes:

  • A CentOS VM to handle Subversion for source code management and Trac for issue management / wiki documentation
  • A Windows Server 2008 R2 VM for our build server, which will handle all the necessary steps to integrate our application and publish it in the way(s) that we want.
Open VirtualBox; you'll be greeted with a blank slate like the one below:
A new installation of VirtualBox, just waiting for us to muck with it.
The Windows VM
We'll create the Windows VM first, because why not? Click New to create a new VM. After the introductory screen, you'll be greeted with a screen like the following. Set your options similarly:
You can even steal the "Bob The Builder" name from me if you want. Because it's just that cool.

Clicking Next brings you to the base memory size. You can put whatever constraints you want, but I usually give a Server 2008 R2 VM 4 GB of RAM (it can do fine on 2 but my machine's a beat so why not?):


Next up is the hard disk. Conceptually, think of it like this -- you're going to create a file, sitting on your hard drive, that the computer living on VirtualBox thinks is a real physical hard drive. It's pretty nifty. You'll want to mark this disk as the startup disk as well, so your VM will know to boot from it eventually:

We then choose the disk format. There are plenty of theories and reasons to choose one over another, but the default (VDI) will work just fine for the purposes of this tutorial.

Next up, we choose whether we'd like it to be dynamic or fixed allocation. To me, this is a no-brainer. A dynamically-sized drive means you create 32 GB drive, but VirtualBox just expands the size of the drive as it gets bigger, so 32 GB is is max but the size of the file will be whatever it actually uses. Unless I have to (i.e. needing to squeeze every bit of speed possible), I don't change this, and we don't have to now.
We then have to tell VirtualBox where to plop this file, what to call it, and how big we should let it get. Give it a descriptive name and a decent chunk of space (though we won't use nearly all of it):

And presto! Your VM is created. Now to tweak the settings. Right-click on your VM in the list of VMs and click settings:



The CentOS VM
I repeat the process for CentOS, selecting an OS type of Linux/RedHat (what CentOS is based on), calling it "SCM" and giving it a similarly-sized 32 GB HDD but half the memory.

Installing the OSes
Next up, we have to prepare the OSes.

VM Settings
You'll want to make sure your VMs are set up to function correctly as independent machines. To do this, we'll change some settings around.

Open VirtualBox, right-click the VM, and choose Settings...:



You'll want to ensure that your VMs are functioning using their own simulated network adapters instead of a NAT connection. To do this, open the Network section, enable the network adapter, and change it to a "Bridged Adapter":


Adding the Boot / Installation Media
We need to add the installation media for each OS so that it boots up with that media. I'm going to use the Windows server as an example, but you'll want to do this on both VMs, adding the appropriate disc.

From the Settings window, click the Storage section.  You'll be greeted by the storage window below. Note the "Empty" IDE controller, as this is where we'll attach our ISO files for the installations.

Click the Empty entry, then click the CD-ROM icon to the right, select Choose a Virtual CD/DVD Disk File, and choose the ISO for your instsallation:


Do this for both OSes. You're now ready to start them up and install the operating systems!


Feedback Welcome!

I'd love to hear any comments on this series. Find it useful? Think there's a better way to implement the technique or something I should have mentioned? Please drop a line in the comments to help me improve the series!