Shift8 Creative Graphic Design and Website Development

Server Administration

Migrated to Rackspace

Posted by Tom on Tue, Sep 27 2011 16:55:00

Well, Slicehost is coming to an end. I think many people are sad about that, if there aren't...There should be. It was an amazing hosting company. So amazing that mega hosting company Rackspace purchased them a while back. If you don't migrate yourself, they will migrate for you...To Rackspace! That's the good news.

I've been avoiding the inevitable migration from Slicehost to Rackspace... But over the past few days here I have done it. I love Rackspace just as much as Slicehost and would always recommend them to everyone out there.

What does that mean? Well, depending on how much bandwidth you run through, you will likely be paying a little less per month for hosting. The control panel does not have as many features as Slicehost's did...Though the design is a little neater if you're a fan...I'm a minimalist (w/o things being fugly), so I like Slicehost's manager design better...But Rackspace does have a cool API.

I've used many hosts over the years, for myself and for clients...You name it, I've likely tried it...Slicehost, Rackspace, VPS.net, MediaTemple, Lunarpages, AptHost, HostGator, GoDaddy (yuck - please stick to domain names only), and many many more... Even back in the day, geocities! Yea! haha. So at the end of a lot of banging my head on the desk, if you are out there looking for a good host, I would absolutely reccommend Rackspace. Best hosting company I have ever seen hands down. I really do bet I've seen (and worked with) more than your average bear too.

That said. Hosting. What is the hosting landscape in 2011? Are you on a shared host? Get off. Now. If you're a web designer/developer then you should be on a VPS by now. Cost was a pretty hard thing to get around, but Rackspace has a 256MB slice (Slicehost terminology, I mean cloud server size or whatever they call it) and it's going to run you around $12/mo. With bandwidth maybe a little more like $15 tops. I was around long enough to see shared hosting dip to like $7/mo. I have no clue what it's like now...It should be free. Regardless. Switch to a VPS. Sure, you'll need to setup the server from scratch, but there's enough tutorials out there and the only way for you to progress as a web developer is to tinker with a VPS.

When you let technology and your web server limit what you can do...You limit what you can learn and do as a web developer.

Rackspace has some really great servers with their cloud server offering. They also have cloud sites which as far as I'm concerned basically replaces shared hosting as we know it.

What else in 2011? Well, even in 2010, likely 2009 we have this really cool new thing PaaS. "Platform as a Service" ... Things like OpenShift from RedHat, CloudFoundry from VMWare (hey, they are down the road from me!), Orchestra.io, and a whole ton of Ruby services. These services let you deploy web apps (the cool word for sites when they do more than just show a web page) in the "cloud" (the cool word for having essentially mirrored copies of your site on multiple servers so perhcance one go down, your site is still visible by the world and scalability or in other words, "many hands make light work"). 

These services are great because you just run a command (I imagine it's not long before some IDE has it bulit in, if not already) and voila! Your site is out on the internet. 

The future is cool. Well, the present...Sorta. A lot of these services still can't quite get a grasp on the beast that is PHP. Orchestria.io by far is the best for PHP. The other PaaS' have varied support for PHP when it comes to MongoDB. They'll get there though.

So, just as I have migrated...This little blog post is a reminder that you too should probably take a look at your hosting situation and think about a little spring ... er late summer or fall cleaning. I can't tell, I'm all out of whack, where I live spring felt like winter and now late summer/fall feels like mid-summer.

MongoDB in the Cloud

Posted by Tom on Sun, Sep 18 2011 11:58:00

So I'm growing tired of configuring servers. I simply don't have the time...Between designing sites/apps and then actually coding them on top of all sorts of project management, dealing with clients, getting paid, etc. There's just no time with all the projects I work on. So I'm looking more and more toward various PaaS solutions (platform as a service). I've been looking at RedHat's solution as well as VMWare's CloudFoundry and Orchestra.io as well. Only Orchestra has support for PHP currently (aside from RedHat's service) as well as support for MongoDB with PHP. I'm sure I'll have a comparison/review/my two cents for those services later.

However, today I'm going to talk about two hosted MongoDB solutions that I've come across. When I was at the MongoSV conference the other year I met some of the vendors there and MongoHQ really stuck in my head. There was also another company there, Mongo Machine. They go about their pricing differently. Mongo Machine is more cost up front so I haven't tried it to be honest. I'm not sure I will either. If I'm at the point of putting in that much money, then I'm going to just host my own database on my own servers. 

A side note. Hosting your own MongoDB (single or cluster) is going to likely yield better performance, especially with your cost/performance ratio. Plus you gain control over what your server setup is like. So there's two reasons why I'd suggest one of these services. First, it's amazingly simple to setup and manage and you don't need to worry about scaling. So convenience is number one. The second reason is more of a scenario. When you don't need super performance because your traffic isn't as high or maybe you're not doing anything as intensive (lots of map/reduces, etc.), it's probably a very good idea to use one of these services. Think about your own personal website. It's likely that you can have a free database solution for your own blog or something. Pretty cool!

Back on point. I've signed up for and have created two databases on MongoHQ and also MongoLab. MongoLab either was not at the MongoSV 2010 conference or I didn't see them...But I like them. So I'm going to compare these two services because they are extremely similar in pricing models, interface, and everything. 

Getting Started
It took all of 5 minutes to setup both services. MongoHQ I had to enter a credit card number, MongoLab I did not.

Configuration
I'm going to talk about Lithium here since that's what I use for a PHP framework (and you should probably too, if I can be an advocate for a few seconds here). Setting up Lithium to use MongoDB on MongoHQ and MongoLab was easy...Once you know what your config array should look like and also once you realize that you have to set the default timeout from 100ms to something higher, like a few seconds. The port number has to be in the host key value. The login key has to be set as well as the password key. This process was identical for both services.

However... Here's an interesting difference. MongoLab has several options when it comes to "where" you're hosting your database(s). You can choose to use Amazon EC2, Rackspace Cloud, or Joyent. This is a major point to MongoLab over MongoHQ. The reason is because one of my gripes is with performance. This is mainly due to hostname lookups and such. If you so happen to be using Rackspace for your hosting (again, I'm going to be a fan for them) you can use the private IP that's within their network! This should (I haven't tried it because I'm on Slicehost and have yet to move my server) help with the timeout setting that you just had to increase in your configuration. I imagine the same goes for Joyent and Amazon EC2 when choosing those locations for your database as well.

MongoHQ uses Amazon EC2 exclusively and you do not get to choose. I'm not sure which region or how it's setup, but I imagine if you also use Amazon EC2, you may get a performance bump when using MongoHQ when it comes to connecting to the database.

Pricing
The pricing models are the same. They both offer a free tier, but, what you get for what you pay is much different between the two. Not incredibly different...Except for when it comes to the free tier. You can likely run an entire blog/personal web site off MongoLab for free because they give you 240MB for free while MongoHQ gives you 16MB for free. Both then have similar plans, but not identical. You're talking about $5/mo differences here and there depending on which tier you fall into between the two services. Nothing to worry about.

It's only when you get into needing replication that things start to get different. MongoLab gives you replication on their plans that cost money. MongoHQ has it available, but you have to pay $300/mo to get it. MongoLab you get it even with their $10/mo plan.

Both have backups, that's cool. Both seem to be monitored, etc. What I'm not sure about is if MongoLab has you on a dedicated instance. MongoHQ lets you know that you are when you hit the mid range to higher end plans. The only thing MongoLab has is their dedicated plan which has a variable cost and I imagine you'd need to get in touch with them to price that.

So I'm not sure what that all means, but it could definitely affect performance. Maybe MongoLab can shed some light on that...Or maybe bcause MongoLab has it all replicated, the dedicated instance per account isn't as important because they are scaling with MongoDB's features.

I have to say neither wins the pricing category. They are comparable, but if I had to choose...I'd say MongoLab because their free tier is better.

Features
I have to say that I think MongoLab is going to have better features here. 

Update: Anyone who previously read this section would have seen info about how MongoLab offers replication. Which it does, but I have been informed it is not replica-sets. Meaning the failover is not automatic. Replica-sets are offered on their higher tier plan. This is more consistent with MongoHQ. Not knowing much about the internals of both services, I can't say if one is better than the other when it comes to scaling.

Here's another important note. MongoHQ seems to be running on an old version of MonogDB depending on which pricing plan you choose. You could be on 1.6.x or you could be on 1.8.x. 1.6.x is a bit old considering 2.0 is now out. MongoLab uses 1.8.x for everything. The "micro" instance on MongoHQ runs a 32-bit instance of MongoDB where the rest are 64-bit. MongoLab appears to use 64-bit for everything, but I could be wrong. They don't explicitly state that anywhere. Do you "need" 64-bit? No, not for 16MB or 240MB of storage.

Both services have a nice interface for browsing and even editing documents in your database. I love both. They have import/export features and it's everything you'd want. I don't think either service is better than the other when it comes to your database browser. MongoLab has the whole dark theme thing going while MongoHQ has a light design...If that matters to you. The important thing to note here is that MongoHQ allows you to hook up any database to their GUI. You can't do that with MongoLab. It's minor, but a cool feature.

Both services also have a REST API. This is neat for mobile apps, etc. Situations where you don't have acccess to a MongoDB driver...Which I think is pretty rare, but you never know. However, what MongoLab's API doesn't seem to do (which I wish it did) is allow you to deploy new databases. Being able to setup new databases via an API might make for a very nice solution when it comes to certain applications. For example, you may wish to create a service where every user who signs up pays you and each of those users gets their own database for security reasons and also so you can track their usage so you can in turn, charge them money to recover your hosting costs. Automation on that, would be great. MongoHQ appears to let you do that with their API.

Both services show you your database stats as well. I think MongoLab presents them with a little more helpful info which is good if you're new to MongoDB. MongoLab allows you to profile things as well whereas MongoHQ doesn't have anything like that built into their GUI. I imagine you could code your own profiling tools within your app though.

Overages
There's "soft" limits or overages that you can run into with both services. They both seem to be fair with this, but you need to be on top of your databases and if you are moving out of one tier, you need to switch your plan to the next tier. However, it's important to note that MongoHQ only has a soft limit on their high end plan. This means your database will not accept any more writes until you upgrade. I can only imagine for (just) the free plan on MongoLab the same is true. Given that you don't need to enter a credit card, I'm not sure how they would allow you to just keep using more and more. You get charged overages with the other tiers until you can switch plans. 

Nothing to really worry about with both services, but I think MongoLab handles things a little bit more nicely in case you're one of those people who don't really pay attention to your database and how it may be growing in size.

Reliability/Performance
This is something I can't speak about. I haven't used either service long enough to know. It can be completely possible that MongoHQ performs better and is more reliable than MongoLab. That would ultimately be the deciding factor for me to use MongoHQ over MongoLab, despite the pricing and features. It's simply more important than a database stays up.

My Choice
Both are very comparable services and are great. The differences between the two are minor and unless you're familiar with MongoDB, you likely won't really know what the differences are. You may not even care.

I personally will continue to play with both services since they have a free tier, but I am leaning toward MongoLab. I think they are definitely a service to follow and use. If you have a personal site that you want to use MongoDB, then I'd suggest trying one of these services. If you're on shared hosting, you likely need to use one of these services in order to use MongoDB. 

I think they also currently have the edge due to four reasons -- listed in order of what's most important to me.
#1 Choice of EC2, Rackspace, or Joyent with private IPs for (hopefully) better performance
#2 Replication
#3 Their free tier gives you more storage space
#4 Version 1.8.x of MongoDB

MongoDB Local Admin GUI

Posted by Tom on Wed, Feb 23 2011 09:39:00

I'm very excited to see a few more admin GUIs for working with MongoDB out there. I'm on Windows so I decided to try MongoVUE. Works great! I really haven't used it for a lengthy period of time, but my first reaction is that it's really good. For the OS X users out there, I think MongoHub might be worth taking a look at. 

So how to connect? Well, if you're working locally, it should be pretty trivial...But what if you're trying to connect to a firewalled server? Tunnel time. However, MongoVUE (I don't know about MongoHub) doesn't have built in tunnel support. That's probably the only thing I don't like about it so far. Not to worry though, you can simply make an SSH tunnel using PuTTY (or KiTTY, which I like better). Here is a really good article on how to setup a tunnel, it takes no time at all. After you're done, connect to localhost on the port you defined for the tunnel and you should be set!

MongoVUE gives you several ways to view the data in your collection. You can use the "text" view which shows you a JSON string that you're probably used to see in the mongo console, but you can also choose a tree and table view which is probably what you're hoping to see with an admin GUI for any database. The only other thing I might like to see is an actual console within this tool so you can manually enter commands. While I don't see that (if it's there somewhere) I do see that it will return the commands used while browsing and performing actions with the GUI. This is nice because you can then copy and paste those commands to an actual terminal window or something. I'm definitely looking forward to seeing feature enhancments for this tool.

My Ideal Development Setup

Posted by Tom on Mon, Dec 20 2010 10:07:00

I finally took the plunge and got a new laptop (with the kind help of my parents with a generous Christmas gift). It's been a few years really and I did need a new computer. What did I end up with? Well, I almost got a Macbook Pro (of course) being the good web developer (and graphic designer) that I am. Apple finally came down on their pricing a while ago so I was all ready to do that but then saw this HP ENVY ended up being half the cost for better hardware. Apple needs to put a 1GB graphics card in their Macbook Pros, 512MB on a $3,000 laptop is just pathetic. 

So reasoning aside, how was I going to setup this machine for web development, design, graphic design, and photography? Prior to this computer, I had dual boot Windows (Vista, ick) and Fedora Linux. Awesome, it ran fast it was simply to setup a webserver and it basically mirrored the servers I worked on. Photo editing was tough in Linux and forget Adobe (though there is a portable version of Photoshop that works); GIMP was the real tool. So I had to go back to Windows for any design work. Not that I do a whole lot these days and that's more because I've learned to deal w/o those nice programs and get by with GIMP (and GIMP is good don't get me wrong).

Now this time around I decided that since I have 4 cores (8 virtual) why not run virtualized machines? No more dual booting, no more hard drive partitioning, etc. So I setup Fedora 14 virtualized, and here's in my opinion, the very best setup for web development/design that you can get (and you can do this if you have a Mac too):

Base Host OS: Windows 7 (or OS X)

Virtualized Guest OS: Linux and Windows (or OS X, oops yea you can virtualize this, but its slow, that's ok though read down further why)

So you virtualize Linux so you can setup a web server that's practically identical to the ones you'll be uploading your files to for the live sites. Why setup a web server with Mac ports, homebrew, or MAMPP? That's silly. Why use XAMPP or setup IIS if using a Windows host? Oh god no IIS. OS X is better but at the same time, you just can't beat a Linux package manager for speed and ease (and grabbing all the libraries you need when you do need to compile something). Also, you really want to mirror as close as you can the actual server that your files will live on because then you'll run into less accidents. You know that everything will work, not "should" work. Rolling with updates is also much easier.

So the trick is you have to make sure your virtual machine has internet access and it's IP is static. With VMWare and Virtualbox you can set things to NAT and then within the guest OS (in Linux' settings for the network card) you can assign a manual IP address within the range of allowed addresses. I have mine at like 192.168.126.200 or something. It won't conflict with any other machine on my LAN. It's not even in the same range.

You will want to probably disable SELinux since you aren't too concerned with security and it'll make things a lot nicer when it comes to shared folders. Make sure your firewall settings are letting Apache through as well. You'll want to setup a shared folder so your files are hosted on your host machine. So in my case Windows 7 holds my web site files. I have a different folder for each site and the Apache conf settings uses virtual hosts to assign a new domain to each site/folder. You can Google all of this. I don't want to make this a tutorial (unless I get some requests) but just a general idea for how to set things up. Pointing the Apache conf to the location for the shared folders. Awesome. Now you can edit files on the host OS with the editor of your choice, no problemo. Use git, svn, etc. The most important thing about this is that your files are now always available whether running the virtual machine or not and they are a bit better protected. Say your virtual machine gets corrupt somehow? Oh crap! Well, not anymore. Now it's just setting it up again worst case scenario, a few Apache config files lost. No big deal.

How do you access this webserver from the host OS? could setup a DNS server (like BIND) if you were nuts. Then set your host OS to look at that DNS before going out to your ISP. I personally didn't want to do that because I figured it would make things just ever so slightly slower. Then if Linux wasn't running, maybe even slower until things timed out before moving on to the next DNS. Instead, I alter my hosts file. In Linux this is easy because Gnome (and I'm sure other desktops) has a GUI to add entries to your hosts file. Very nice, but wait just one minute! There's an app for that! Windows and OS X both have 3rd party apps that will allow you to change up your hosts file in a nicer way. The one on Windows 7 that I'm using now is called HostsMan. It's actually quite cool and can provide some other handy features to help warn you about possible hijacks and such. Anyway, I just use it for my sites. So I have a lithium.local for example that points to the IP of the Linux virtual machine. Save that...Open up the web browser and bingo! Again, there's apps for OS X too and some that also work in your dashboard I believe, which is handy.

Yes, I do need to add a new setting (line) each time I setup a new site, but I have to also do that in Linux under the Apache configuration for the virtual host anyway. No big deal, it takes less than 5 minutes one time every time I setup a new site. I could figure some sort of automation script maybe or something through the web browser. You could setup a free control panel like you see on hosting providers...But I'm ok with typing in the config manually from a terminal.

Bonus! I don't need to use Putty (or Kitty) because I can use the terminal from Linux. Putting the virtual machine into "unity" mode, or "seamless" mode for Virtualbox users, will make this so much nicer. I basically now look at things and get confused...Am I running Windows? Or Linux? Nice, best of both worlds.

Now, virtualizing OS X isn't kosher. It's a no no. But...You can actually do it. I find that I can just test with Chrome and Firefox and be ok. I don't use OS X. There's also a Safari for Windows (though it's slightly different I hear). However, Firefox and Chrome are pretty good and I don't typically end up with OS X only CSS issues. Conversely, if you're doing this in OS X, you can virtaulize Windows XP or 7 or ME? Vista? No no, you'll be ok with XP or 7, haha. Now you have two virtual machines giving you ALL of the major operating systems. Why do this? Well, dual booting is a pain in the rear and it doesn't matter how fast your Windows or OS X guest runs because you're just going to use it for browser testing. Microsoft used to have images available just for this purpose. They were incomplete operating systems, but gave you just enough to test browsers. Personally I think it was genius, but also...They owed it to the world because of Internet Explorer.

So there you have it. My idea of the perfect setup for a web developer/designer. I can run all of the programs that I want to for design (since Linux isn't great for design of course) and also have my proper webserver with Linux. There's also a few helpful apps that Linux has that neither OS X or Windows has so now I won't miss out on those. I can test just about every web browser and make sure my site looks the same on all. The things we have to go through in order to make web sites. It's absurd...But at least we don't need 5 computers to do it. Running two operating systems full time is not a big deal either on any newer i5 or i7 processor. Also as an added bonus I can play Starcraft 2 :)

Yes, Apple fanboys will say they can do it all with just OS X...Well, no you can't actually. You can't test all the browsers without virtualizing and your web server is just going to be a joke running on OS X. I've setup several web servers before on just about every operating system short of Solaris. So believe me, you want the "real deal" you want something that's going to reflect the final live environment. You don't see hosting companies offering up OS X to run your web sites now do ya? Also, it's good to have your web server virtualized because it doesn't take a lot of resources to run and it will familiarize you with a Linux machine. That's important! It's also still just as convenient as setting up (through port/brew or compiling from scratch) a web server on OS X. In fact, it's more convenient. While MAMPP is probably the most convenient, it doesn't offer enough when it comes to all those PHP extensions. Now this is strictly speaking to PHP developers...Now how about you want to run other things on the server? Some things simply aren't available for Windows or OS X, and that's why you really want to virtualize Linux for your web development. Plus, you can have multiple machines and simulate/setup/test out load balancing and database clustering...But of course, to each their own.