Database Administration on a VPS

June 10, 2007

Lets say you are setting up a lightweight VPS for hosting a rails stack. You install Nginx a high-performance HTTP server and reverse proxy with a small memory footprint and doesnt leak memory like my scirocco leaked petrol.

You also install mysql and tweak it like a mofo to decrease the memory usage and increase speed. You also install mongrel and mongrel_cluster to make scaling a reality for when your app hits the big time. It hasnt quite yet; so one mongrel process in the cluster will do for now :-)
You also configure a firewall, update ubuntu to the latest version, change ssh ports and make the server pretty lightweight and secure.

Usefuljaja has a pretty good guide on VPS setup.

Also, props to the amazing nginxconfiggenerator which makes setting up this beast from the motherland a sinch.

Now database admin. I like using phpmyadmin for simple database tasks. I have command line skillz but there is something about the visual representation in the browser that appeals to me. Does this mean I need to install php, fastcgi and lighttpd; or the industry heavyweight and Macdonald’s fan Apache2? Nope! Just setup a tasty ssh tunnel to port 3306 on the VPS and use a local install of phpmyadmin! It is pretty fast and works really well for simple tasks.

Also something like wamp or instant rails will give you a phpmyadmin install in a couple of minutes.

There is something about a VPS which gives you a new sense of power and the feeling that your hosting is truly in your hands. Out with the shared, in with the VPS!