This is the second of several articles concerning our system architecture. It’s primarily aimed at technically minded ladies and dudes. But don’t feel left out if you didn’t read this first one! It’s right here: Site Architecture: Servers
Read it and come back, because today we’re talking about software!
Just to recap: We’re hosted in the cloud with Xen virtualization. We have a couple of servers at the moment running Ubuntu 8.10. We can start, stop, copy and delete instances of our servers at any time. So how does it all work and what did we do to get it there?
Once our first server was online, the first thing we did was update Ubuntu to ensure we had the latest security patches and software.
1 | me@stoopad:~$ sudo apt-get update; sudo apt-get upgrade |
We also locked down the firewall on each machine, opening addresses on specific ports from machine to machine where needed, something like this for httpd (in a file called iptables.up.rules):
-A INPUT -p tcp --dport 80 -j ACCEPT -A INPUT -p tcp --dport 443 -j ACCEPT
1 | me@stoopad:~$ sudo iptables-restore < iptables.up.rules |
We were now ready to go. In no particular order, we deployed Apache, MySql, memcached, and several others. All were downloaded through source, compiled and installed in the usual *nix fashion:
1 2 3 4 | me@stoopad:~$ wget whateverpackage.tar.gz me@stoopad:~$ tar xzf whateverpackage.tar.gz me@stoopad:~$ cd whateverpackage me@stoopad:~$ ./configure; make; sudo make install |
So, by way of example, here’s how we installed PHP 5.2.6:
1 2 3 4 5 | me@stoopad:~$ wget php-5.2.6.tar.gz me@stoopad:~$ tar xzf php-5.2.6.tar.gz me@stoopad:~$ cd php-5.2.6 me@stoopad:~$ ./configure --with-curl=/usr --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib --enable-zip --with-gettext --disable-cgi --with-gd me@stoopad:~$ make; sudo make install |
After compiling and installing all essential software we went about configuring the various daemons we needed to have running, including mysqld, httpd and memcached.
I touched on memcached a bit in the previous post. memcached is a distributed object cache; it’s basically a big in-memory hash table that can be spread across multiple servers. Regarding WordPress, it just so happens that it has a nice plugin for utilizing memcached servers. It was created by Ryan Boren (see his post here). The plugin can be downloaded here. Just drop the object-cache.php file under your wp-content folder add the following lines to your wp-config.php file:
1 2 3 | $blog_id = 'yourblogname'; global $memcached_servers; $memcached_servers = array('default' => array('192.168.0.1:11211', '192.168.0.2:11211', ...)); |
This, along with the WordPress WP-Super-Cache plugin we have installed, drops our database usage for WordPress down to almost nothing. Which is good, because our database is used for other things. I would like to eventually extend the cache plugin (and ComicPress in particular) to use our bucket on Amazon S3… but this may never happen. Oh well.
And I believe that wraps it up for this post! I realize it’s a bit discombobulated, but I plan on re-visiting some of the ideas presented here in a later post. In the next post, I’ll talk about our WordPress installation specifically. After that, I’ll chat about Amazon S3 and our database deployment.
Have fab day!
