System Updates

This will serve, I hope, as a sort of system restart post and will cover a couple of things:

We’ve moved to the UK!

I’ve taken a short term international assignment. This blog (the one you’re reading now) is transitioning to mostly technical things. Life events will be covered over at AndrewAndRachel.com.

New Host!

After having some fun hosting this on a Linode VPS, I’ve decided I don’t really want to be in the server maintenance business. So I’ve move everything over to SiteGround over the last couple of months. It feels good to have one less thing to worry about, and SiteGround supports Let’s Encrypt! Win-Win!

New Theme!

With great sadness, Alex King (of Crowd Favorite) passed in 2015. Unfortunately, his theme, FavePersonal, hasn’t been getting updates since and things were starting to break. So, new theme.

Unfortunately, this also means that the social media interoperability has changed. Comments on Facebook and Twitter used to automatically be aggregated on this blog as well. My thinking on this continues to evolve, and while I believe it would be best to have a single commenting ecosystem, I’m more at ease with allowing separate systems to exist.

Fortunately, I’m still pushing blog posts to Facebook and Twitter since I know that’s a primary news source for many people (for better or for worse).

Email “Newsletters”

Ugh…I’ve hated this. I hate posting something and having it go out via email only to find I made a typo or something. Or wanting to post multiple time in a day and feeling worried that people would hate all the email. This has honestly been a big mental block for me. Also, the plugin I was using1 was overly complicated and often didn’t render things correctly. I thought hard about getting rid of email subscriptions entirely, but instead I’m going to try something else. You’re welcome relatives 😉

First, I’ve switched to a new system: MailPoet. We’ll see how this works…it seems to tick all the boxes I need for what I want to do.

Second, everyone who was on the old mailing list has been migrated to the new weekly digest list. If there have been blog posts from the past week, you will get an email on Monday morning with them — in theory.


  1. Subscribe2 HTML 

One Site To Rule Them All

I’ve spent a good chunk of time this week transitioning AFdN from a standalone WordPress site to be part of the ferguson.pw WordPress Multisite cluster.

This is more cool for me than you because I now only have to manage one WordPress installation for everyone, rather than two or more installations. Huzzah!

Some lessons learned:

  • Multisite cookies are the suck. Towards the end of the migration I ran into an issue where draft post previews were not working. I started running through my checklist of things that could be the cause, but nothing made sense. I eventually created a new user — notandrew — to see it was an issue limited my “super-administrator” capabilities and to my surprise notandrew could see the previews just fine. So I nuked all cookies for ferguson.pw domain and lo and behold everything worked.
  • When migrating a Standalone WordPress site to a Multisite and mapping the domain back to the original URL you can use the following Nginx rewrite to prevent breaking anything1:
            #rewrite for WordPress single site to multisite
            location /wp-content/uploads/ {
                    rewrite "^(/wp-content/uploads)/([0-9]{4}/[0-9]{2}/.*)" $1/sites/$blogid/$2;
            }

    Note: this is also predicated on using the Nginx Map{..} directive.

  • There’s a long standing bug with Nginx regarding the use of alias versus root. In the end I was able to use alias2 to host a special directory for TweetNest. Here’s the solution I ultimately arrived at:
            location /tweetnest {
                    alias /path/to/example.com/html/tweetnest;
    
                    rewrite  ^/tweetnest/sort /tweetnest/sort.php;
                    rewrite  ^/tweetnest/favorites /tweetnest/favorites.php;
                    rewrite  ^/tweetnest/search /tweetnest/search.php;
                    rewrite  ^/tweetnest/([0-9]+)/([0-9]+)/([0-9]+)? /tweetnest/day.php?y=$1&m=$2&d=$3;
                    rewrite  ^/tweetnest/([0-9]+)/([0-9]+)? /tweetnest/month.php?y=$1&m=$2;
    
    
                    location ~ \.php$ {
                            fastcgi_split_path_info ^(.+?\.php)(/.*)?$;
                            fastcgi_pass unix:/var/run/php5-fpm.sock;
                            fastcgi_index index.php;
                            include /etc/nginx/fastcgi_params;
                    }
    
            }
    

I also took the opportunity to clear out some cruft and update some look and feel stuff: redish/orangish theme, update profile, etc. Nothing should be broken, but you never know. Enjoy your weekend.


  1. in theory 

  2. which I believe is the correct way 

Countdown Timer v3.0.6

Sometime in June of 2012 I released version 3.0 of Countdown Timer. Before that, the last major release was version 2.4 in April of 2010.

I’ve just been busy with other things1. The other reason was that the program had grown from it’s modest roots as a single 321 sloc2 program to a multiple files (80% PHP / 20% JS) with 1,450 sloc. Managing all the files, testing, and integration is — well — hard and not fun. And no one pays me to do it.

It’s taken some time, but I’ve more or less completely redesigned how I develop PHP. I’ve switched to using Aptana, Git Hub, and FirePHP — a PHP integration into FireBug. This was a multimonth project to slowly learn a new way of developing, but it’s been fun! I just spent most of May 2012 essentially rewriting how Countdown Timer works. All the logic is ultimately the same, much of it was converting function and variables into appropriate classes. I’m somewhat particularly happy about being able to extend the DateTime class and use that, although the lastest bug fix release (v3.0.6) was released because of my new found hatred for the DateTime class.

Another big change from 2.4 was taking advantage of some of WordPress’ core i18n3 updates which make handling date and time information a bit easier. Version 3 (and the subsequent dot fix updates) haven’t been a big flashy update, things are more or less where you left them, but you should hopefully see some little things that make you smile and make your life easier. It’s always a challenge to keep making something truly better, but I still have a couple of things I want to implement. However, Countdown Timer is on GitHub and WordPress TRAC, I don’t want this to be code that’s hidden in a cave, so please fork, patch, push and pull away.

Anyway, version 3.0.6 is now out. It fixes some crazy bug with that developed sometime after PHP 5.2 was released that caused the “white screen of death.” There were three issues that I found:

  • WordPress is calling the sanitize callback twice…not sure if this is new behavior or not, but it was breaking things because the second time it was being called it was trying to sanitize a different type of input. I’ll probably need to rewrite the sanitize function in the future.
  • The DateTime class has been expanded and some of the new functions clashed with stuff I had written. PHP can’t overload functions, so instead it just barfs.
  • For some reason, if certain, presumably optional, methods of the new PHP DateTime class are missing, PHP will also barf. In particular, date4, timezone_type5, and timezone.

Anyway, several hours were spent backtracing the errors and providing suitable fixes. So, enjoy!

As per tradition:

Read more or download version 3.0.6!

Also, please consider that I spend several dozens hours making updates for each release…have you donated recently?


  1. which is to say that Countdown Timer has been pushed lower down my priority list 

  2. source lines of code 

  3. internationalization 

  4. which was never supposed to be exposed 

  5. also maybe a bug? 

Transition to LEMP

If you’re reading this, it means you are using the new AFdN server! As part of my foolish reason plunge in to Virtual Private Servers.

I’ve been able to migrate all the files moved over1, setup, and fine tune the new system.

It’s not that I wasn’t happy with BlueHost, just that I had grown out of Bluehost, which makes sense: Bluehost really is targeted and people new to web hosting. I’ve had a web site since I was 11.

I’ve heard rumors that Bluehost has over 500 users on each one of their boxes, upgrading to their Pro Package a couple of years ago put me on a box with “80% less accounts per server”, but it still wasn’t cutting it. I needed more!

The LEMP setup: Linux, Nginx2, MariaDB, PHP-FPM.

From a hardware standpoint, fremont is a NextGen 1GB Linode Virtual Private Server (VPS), powered by dual Intel Sandy Bridge E5-2670 processors each of which “enjoys 20 MB of cache and has 8 cores running at 2.6 Ghz” and is shared with, on average, 39 other Linodes.

Linux

I’ve chosen to run Debian 7 (64 bit); it’s a Linux distribution I trust, has a good security focus, and I’m also very familiar with it.

Setting it up the Linode was easy. I decided against using StackScripts because I wanted to know exactly what was going into my system and I wanted to have the experience in case something goes wrong down the line.

I took a fresh copy of Wheezy (Debian 7) and then used the following guides:

I very seriously considered encrypting the entire server, but decided against because ultimately the hardware was still going to be out of my physical control and thus encrypting the system was not an appropriate solution for the attack vector I was concerned with.

Nginx

I’ve always used Apache to do the actual web serving, but I’ve heard great things about Nginx and I wanted to try it. Since I was already going down the foolish path, I figured that I had nothing to lose with trying a new web server as well.

To make things easier, I installed Nginx from the repo instead of from source and then configured it using the (more or less) standard approach.

It’s really simple to install, I probably over thought it.

rtCamp has a really great tutorial on setting up fastcgi_cache_purge that allows Nginx to cache WordPress data and then purge and rebuild the cached content after you edit a post/page from WordPress dashboard or approve a comment on an article.

MariaDB

The standard tool for web-based SQL databases in my book has always been mySQL. But just like Nginx, I’ve heard some good things about MariaDB and figured why not. The great thing is, MariaDB is essentially a drop-in replacement for mySQL. Installing from the repo was a piece of cake and there really is no practical difference in operation…it just works, but better (in theory).

PHP-FPM

PHP FastCGI Process Manager (FPM) is an alternative to the regular PHP FastCGI implementation. In particular, it includes adaptive process spawning, among other things, and seems to be the defacto PHP implementation method for Nginx. Installing from the repo was a piece of cake and required only minimal configuration.

I originally used the TCP Sockets, but found that UNIX Sockets gave better performance.

Fine-tuning

Getting everything moved over was pretty easy, I did some benchmarking using Google Chrome’s Network DevTool and using Plugin Performance Profiler from GoDaddy3.

Most of the fine tuning was the little things, like better matching the threads to the number of cores I had available. I also enabled IPv6 support, which means that AFdN is IPv6 compliant:

ipv6 ready

Enjoy faster and better access to AFdN!


  1. at least for AFdN, there are other sites I run that are still in migration 

  2. pronounced engine-x, the “e” is invisible 

  3. I know, I’m just as shocked as you 

Welcome to fremont.fergcorp.com

For whatever foolish reason, I’ve decided to take the plunge in to Virtual Private Servers and sprung for a 1GB Linode.

I’m actually kind of excited by this. It’s sort of like being back in high school and running my own server from my parents house. Except I’m ten years wiser…and married.

Anyway, after some minor toiling about whether I should install nginx from the Debian repository or compile it from source, I ended up going with option C and am trying the dotdeb repo.

This has been predominately driven by my continuous desire to push BlueHost to boundaries of what shared hosting meant. I upgraded to the Pro account last year, but it’s still a bit sluggish and I still consistently find myself having to scrape together horrid workarounds for things I want to do on the server. I probably should have got VPS a year ago, but I wasn’t sure I wanted to take that task on…I’m still not sure.

The server is named Fremont, because it’s located in Fremont, California.

I’m going to move some of the sites I run off of BlueHost to see how fremont (along with nginx, MariaDB, and PHP-FPM) handles everything — and to see if BlueHost gets any snappier.

If all goes well, there’s a good chance I’ll move all the sites to fremont.

For now though, I just have the basic “Hey, it works” page up and running, including an SSL certificate, at https://fremont.fergcorp.com.

Introducing AFdN.me

Spurred on by the coolness1 that Viper007Bond (aka Alex Mills) enabled with his v007.me site-specific URL shortener, I have also implemented a similar functionality, also using YOURLS.

a-n-d-r-e-w-f-e-r-g-u-s-o-n-.-n-e-t is 18 characters. I’ve managed to reduce that down to a mere seven (a 61% reduction in effort). http://afdn.me is primarily designed to serve at the short URL location and branding for AFdN. This will primarily be seen in social media, such as Twitter, but could also show up in print locations where space may be limited.

tweet

Instead of showing a link similar to wp.me/p4tPz-2cP (as shown above), links to AFdN will now appear similar to afdn.me/mg3sm. All previous short URLs will, of course, to continue to function. Only new posts (and old posts that have been edited) will see the new shortened URLs.

The self-referential nature of using AFdN.net did occur to me, but the domain was already taken.

This has also been rolled out for AndrewAndRachel.com, which uses http://aandr.us as its shortened URL.


  1. Honestly, the real reason I implemented this is that http://andrewandrachel.com/wedding/photo-booth is too long to put on a photo strip branding logo 

Facebook Integration Philosophy

I’m trying to figure out if and how to best integrate Facebook into AFdN (which I would then presumably roll in to AnRdC), as well as to also gauge understanding in the necessity of pushing to Facebook (via user participation, or lack thereof, in the form of comments/feedback).

For several months now, I’ve been using the Social plugin from Crowd Favorite to push posts to Facebook (and Twitter), but the integration is not exactly what I want.

The ideal scenario is that a post on AFdN is also posted to Facebook (and Twitter) in full (syndication), but comments (and “likes” and retweets) are captured by and centralized at AFdN. Social does a pretty good job of this, but comments are still fragmented because while AFdN can capture comments from Facebook (and the like from Twitter), it doesn’t do a good job of integrating comments from AFdN back into Facebook (or Twitter)–the syncing problem.

I think my end goal is to use my Facebook timeline as an RSS feed of sorts for my friends, and drive any comments here to be published. I’m not sure if that’s possible though. I don’t want comments to be fragmented or lost though. I may end up saying screw it and not worry about Facebook at all.

All of this also presupposes that maintaining connectivity with Facebook is what should be done to begin with. Historically, Facebook has been the social gathering place for people my age. And Back In The Day™ (when it was called The Facebook), Facebook reached this sweet spot of with a super high signal-to-noise ratio (SNR). It aggregated all the basic data, connections, and updates of friends (high signal) while also being easy to use and free of cruft (noise). Facebook, though, has always been marching towards something else: profitability. However, their stock price since their IPO has been lackluster at best. And their SNR has continued to deteriorate. Facebook has fallen to serve the lowest common denominator (LCD): people who play FarmVille.

Well, actually the LCD is money. Facebook’s product is its users, in particular selling the users to advertisers. And generally most of us are okay with that, as long as we get some value for it. The problem for Facebook is the users aren’t getting the value from Facebook they once did. This poses a problem for Facebook because if they can’t keep their user base engaged, they don’t have a product to sell.

Anyway, for now it seems Facebook remains an integral part for many of my friends. I want to be able to keep my friends updated. Ergo, Facebook seems to be a good vehicle to do that.

I’d welcome any comments to the contrary, especially from those who see this on Facebook.

Milestone for WordPress self-hosted v0.9

The website I made for Rachel and myself is, of course, run on WordPress. After looking through some themes, I eventually settled on the Forever theme. Forever is a WordPress.com theme, but can be downloaded via SVN from
https://wpcom-themes.svn.automattic.com/forever/1 so someone can use it on a self-hosted WordPress installation. Everything was going great, but I couldn’t find the plugin for this really neat widget they have that counts down to The Big Day:

The Milestone Widget in Forever (http://en.blog.wordpress.com/2012/01/12/wedding-theme/)

It’s called Milestone and as of January 2012 it was supposed to be included in a future release of Jetpack, the official WordPress plugin for things of that nature.

But here we are in August and there’s no plugin.

And I don’t know what the timeline is for actually releasing it.

So I did what any engineer would do when they don’t want to wait, I made my own version. There’s decent enough documentation on the backend and the front end is just stylized with CSS. It’s a pretty simple implementation and only took a few hours to crank out. There are some more things I want to add and tweak, like adding a drop down calendar select and better input checking, but it will work for now.

Here’s how it looks:

Milestone clone

It’s a quick solution that I hope others will enjoy too. I also got a chance to try out using a deploy script to help automate the push from GitHub to SVN. This could help a lot of things go smother.

Read more or download v0.9!


  1. svn co http://wordpress.org/extend/plugins/milestone/ 

Servers Moved

I’ve been moving around some of the technological assets under my control. I completed a Registrar switch in May. I’ve been working the last month to move servers. I’m still with BlueHost because they are great, I just moved to a box with fewer people on it (i.e. less resources to share). I also get my very own IP address and SSL certificate!

I just completed the switch of AFdN (which was the last asset on the old server) this afternoon. Everything should be okay, but if not, please let me know.

For those interested, here’s what I did (over SSH from the new server):

ssh old_server.com 'cd ~/www/; mysqldump -u username -p mysql_wp > dump.sql;'
rsync -av --exclude 'notthisfolder' -e ssh old_server.com:~/www/ ~/www/.
mysql -u username_new -p mysql_wp < ~/www/dump.sql
rm ~/www/dump.sql

Some resources I used:

Moving Registrars

I’m switching registrars so I can leave GoDaddy. There should be no issues since only the registrar data is changing. While this technically touches the DNS system, it’s only updating the registrar data at Internic and leaving the DNS servers the same (including the Start of Authority server). However if something does go wrong, now you know why.

This is the first step in a reorganization of some of the technical assets that I use worldwide. I’m cooking up some really cool things that I hope will leverage WordPress in an incredibly awesome way and also let me move away from Facebook.