I was trying to migrate a Heroku app to WordPress, but not all the pieces are complete. So we now have to proxy the Heroku app through Apache instances, and enable selective paths to be served natively while forwarding the rest of the request to Heroku with the same hostname. The stack is my usual Varnish/Apache/PHP at EC2. To accomplish this, I did the following:
- Heroku’s DNS is a RR-DNS, and can change at any notice. Do not use the IP address. Heroku’s proxy is proxy.heroku.com
- Varnish does not like RR-DNS for its backend directives (do not attempt to open a ticket… read this: https://www.varnish-cache.org/trac/ticket/1334)
- Configured Apache’s ProxyPass with the following:
ProxyPass /wordpressapp ! ProxyPass / http://proxy.heroku.com/ ProxyPassReverse / http://proxy.heroku.com/ ProxyPreserveHost On
The first options define the paths that should not be proxied. The last directive (http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypreservehost) forwards the hostname to the proxy, so Heroku can serve up the right app.
Simple, elegant, and not so obvious. Note that you cannot alter the HTTP hostname, so if you need to do something more crazy, you can chain a mod_rewrite rule to another internal VirtualHost that has a fake hostname, and then do the ProxyPass.
I had a fun time giving a small little presentation on scaling WordPress blog and my experience on helping GrassRiots release Global Slavery Index 2013 on AWS. For those who attended DevTO, the slides for the presentation can be downloaded here.
I felt I haven’t done the topic justice given the short time, so I will elaborate on a few points.
1. Scaling WordPress is not an unique problem. It is just another LAMP-stack based application! The pressure points discussed and mitagation strategies will be similar any other PHP apps, such as Joomla, Drupal, or your own homebrew framework-based app. It just happens that WordPress blogs get slammed more frequently (legitimately or otherwise), and there are great plugins such as HyperDB and W3 Total Cache to make your scaling easier.
2. Determine your workload and nature of the site. The sites I launch are mostly read-only sites. Don’t treat my Visio diagram as gospel. If your site is highly dynamic and need write access frequently to disk and/or database, those become even greater stress points to tackle ahead of time. They are hard problems and solutions can be simple or complicated. Simple solutions include log and process later, and harder/real-time solution include cluster database or file systems (Percona XtraDB Cluster or GlusterFS are just two examples off the top of my head).
3. To AWS or not AWS. I have been a user and advocate of Amazon AWS solution since 2008 – before the days of EBS, CloudWatch, CloudFront, SES, SNS, Route53, and all the other cool solutions Amazon has brought on board to deal with the pains I put up with. Today it has the tools to enable almost anyone to run their datacentres through the AWS Console. That being said, it doesn’t mean AWS is the only solution out there, or the fastest. In fact, Google App Engine is wickedly fast and Windows Azure now boast the cheapest storage/delivery costs. I haven’t even mention smaller scale solutions such as VMFarms (managed VM), Linode (which I use personally, and full disclosure: the link is a referral link so that both you and I can get some Linode perks if you choose to join) and VPS hosting from many providers.
This can become a religious war. I have seen great implementations of Amazon AWS and some awfully dreadful ones. There will be people saying this cloud is better than that, or private cloud is more stable than public. Pick the solution that make sense both financially and technically. With Amazon, Google and Microsoft, a credit card is all you need to try them out.
4. If you are a sysadmin that is used to ordering servers, installing them on a rack, and provisioning servers in a co-location, you really have to think differently with cloud hosting. Your uptime is measured in number of instances running at any given time, not how long a server is up for. Prepare to lose not just instances occassionally, but availability zone outages once in a while. Your solution must cope!
5. A run book is often missed. Even if you didn’t write it for the release, get to it sooner or later. You will thank me when your instance crashes, got hacked, or did some insane things. Ok?
6. I have been asked – why not WordPress VIP? I have nothing but praises for WordPress VIP, but my topic was scaling WordPress on a relatively small budget, had 48 hours to release thise, and need to be torn down in about 10 days to a simple HA (High Availability) stack. I highly doubt they want my kind of business!
There are lots of conflicting information on how to get your MacBook to back up to a Linux server. Here’s the canned solution for RHEL/CentOS/SL 6 users out there so they don’t have to waste too much time:
- Add EPEL repo to your repo
yum install http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
- Install netatalk
yum install netatalk
- Modify /etc/netatalk/afpd.conf to add this line
- -transall -uamlist uams_randnum.so,uams_dhx2.so -nosavepassword -advertise_ssh
- Add this line to the /etc/netatalk/AppleVolumes.default
/TimeMachine TimeMachine allow:username options:usedots,upriv,tm cnidscheme:dbd vols
- Creates a TimeMachine share
- Writes to /TimeMachine directory
- Enable timemachine support
- Uses the proper CNID Database Schema so that it supports HFS+ stuff without the partition
- 1TB space limit
- Only username is allowed to write to it
- Make sure it advertises using avahi
<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
- start/restart your netatalk service and share that volume
Thanks to these articles for inspiration:
I gave it an honest try!
This is what I said to myself when the PlayBook arrived in the house. It was yet another shinny gadget that will work its way to my laptop bag – at least that’s what I thought when I first opened it.
The PlayBook came with packaging that was a bit lager than needed, but it was well packaged. When opened, the PlayBook came with a neoprene case, which is always welcomed as splurging $699 for a 64GB was already expensive, and their zip-pouch ($39), leather envelope ($49) or case-stand ($59) will just push this over the top. It also came with a MicroUSB cable, MicroUSB charger, and a screen wipe.
Turning this device on was quite something – the power button at the top was so stuck that I almost broke a nail before it will turn on. I was then greeted with a welcome screen followed by connecting to a Wi-Fi network. It offered WPS as an option so I tried it with my DLink DIR-825 router, but that failed. Then I tried to type in my WPA2 key, and didn’t connect. Tried with my Linksys WRT54G router and failed as well. Tried one last time on the DLink and it finally worked (that was quite an adventure). Then it bug me to do a 300MB OS update, which took about 15 minutes end-to-end. The rest was pretty uneventful, including the BlackBerry Bridge configuration, but I truly despised at the fact that you can’t ignore the welcome tutorial.
The Wi-Fi at this point works, but flaky at best! It connects most of the time, but the applications constantly complaint about “no Internet connection”. Another kicker – it refuses to connect to my iPhone 4 Hotspot, as I suspect it has something to do with the SSID reading “Alan’s iPhone”. Perhaps there’s some RIM/Apple rivalry baked into the Wi-Fi code? (Just kidding, I deduced to the apostrophe since the PB saw my iPhone as “Alan___iPhone”)
Application-wise, it is mostly solid. The bridge truly show its integration to the BlackBerry. However, every time I launched the Bridge Browser, it crashed. Also, the Browser is buggy, especially when a Flash animation is present on the same page. I will zoom into a picture, and it will crash when I zoom out. Without the Blackberry, the device becomes a over-glorified web/entertainment pad, as it lack the depth of software in the app store, as well as the lack of e-mail/calendar client.
The games – amazing showcase of what the hardware can do. I enjoyed NFS very much, and this device proves the PB is well optimized for gaming too. There is potential for it still.
Typing – I love the fact that when I hold the device with my two hands, I can reach all the keys on the screen with my thumb. I can’t say the same for the iPad. The device has some real weight, but just perfect to be held with one hand.
What did it for me are the crashes, stuck power button, and ultimately the poor MicroUSB connector. The unfortunate part is that RIM had 18 months to build this machine, but as a consumer, I felt compelled to return the machine to Best Buy at once. May be I am the exception, but the comments I heard from the Best Buy customer service desk was the same – high return rates due to similar complaints.
Next up – an Android tablet.
It has been a while since I updated the blog about the Lenovo experience. To their credit, I was finally able to change the delivery method from “deliver” to “pick-up” on day 2. Though they kept of questioning me on why I want to change the delivery method.
I finally got it on day 3 and began my two modifications:
1. Upgraded to 4GB RAM
2. Changed the hard drive to an Intel X25-M 34nm Flash (Gen 2)
The happy news is that my machine boots in about 15 seconds, and comes back from hibernation in under 9 seconds. Battery life is a staggering 7 hours (with a 9-cell battery). This is finally a useful workhorse. I can spawn Microsoft Word, Outlook, Excel, PowerPoint and Adobe Photoshop all at once in about 15 seconds – something you wouldn’t try to do with a hard disk. Life is good.
So I have bite the bullet and ordered a new Lenovo T410 for my own business use. It has been 3 weeks in the queue and I was eagerly waiting for it to arrive, except it didn’t. Two weeks after the build date, I got a notification that it is being shipped with UPS. I immediately cringe in pain – remembering all the times UPS has messed up my shipment, I was dreading this.
Last Friday (May 7) – got the note that the machine shipped. Checked Lenovo’s website and saw no tracking information.
Monday May 10 – still nothing on the website.
Tuesday May 11 – nada.
Thursday May 13 – I got tired of waiting – I called Lenovo and the lady was helpful enough to dig up the tracking number for me. Why couldn’t they just post it on the site or sent it to by e-mail? The machine was delivered to Canada and just cleared customs. I called UPS and made sure I can hold the package at the depot in case I am not home.
Friday May 14 – It was suppose to come. Knowing I am working I anticipated this shipment to be “missed”, I would call UPS and tell them to hold the machine at the depot. They changed their tune and said that the package cannot be held and cannot be redirected at all! The lady was calm but told me to call Lenovo to change the shipping information. By the time I called Lenovo, it was 6:10 and they closed 10 minutes ago. Argh!
I didn’t want to use an alternate address because in case I wasn’t at home (which generally is the case during a business day), I wouldn’t be able to go to the depot and prove my address and pick up the machine. This is now a moot point as I can’t even get the machine. How do you think I am going to get this machine given the fact no one is home to sign for it, and you can’t pick it up from the depot that is 40km from my location? They said if no one signs in 3 attempt, it gets sent back.
Wait for my day 2 story on Monday. Lenovo – expect a phone call from a grumpy guy who is waiting for his laptop!
Came across TekSavvy during my search for high speed internet, and ended up with getting their home phone service. I am a cheapskate, so I had to calculate the costs of switching from Bell to TekSavvy.
Cost of a basic Bell phone line: $29.32
$22.95, plus $2.80 for touchtone, $0.19 for 911, and $3.38 in taxes
Cost of a TekSavvy phone line: $25.18 (plus one-time $25 transfer charge)
$22.28, plus $2.90 in taxes
If Bell didn’t raise their prices next month, it would take me 7 months to break even. With their ever-greedy attitude on land line services, a basic line will cost $31.57 starting next month. The only difference with TekSavvy – no Bell!
Alan has no affiliation with TekSavvy or make any money on referral. Though he wish such scheme exists. The service practically sells itself!
I thought I share with the world my adventures in mobile broadband.
- Linksys WRT54G3G router – you won’t find one in Canada, so start your search on eBay. Don’t worry about the which network it belongs to…
- 3G PC Card datacard – I decided to pick up an Option Wireless GT Ultra (GX0302) branded AT&T, but unlocked
- 3 months of useless investigation
Let me explain the 3 months of useless investigation and searching on Google, Yahoo and Bing. I originally have a Sierra Wireless AC860 card, which I thought would work with the WRT54G3G router (idiot me – I assume the AC875/AC881 should have the same interface as the AC860). It didn’t work, so I flashed the router with OpenWRT, a firmware that is more advanced than DD-WRT, but offers PC Card support. There are also various tutorials (see Simon Josefsson’s Summer House Wireless+3G Network, which was the most clear of them all) that made me waste my time trying to get my PC Cards to work, but to no avail. Here are some of the things ran into:
- How the heck do I flash my WRT54G3G-ST (Sprint EVDO version) to OpenWRT. Try http://www.assembla.com/wiki/show/openwrt-3g
- Upgrade that version of OpenWRT to the ones found on downloads.openwrt.org? Remember these important hints:
- WRT54G3G is NOT compatible with the 2.6 kernel, so download the brcm-2.4 version of the image
- Once you have OpenWRT installed, you can flash between versions by downloading the TRX files to your router’s /tmp directory, then run mtd -e linux -r write linux
- To revert your firmware to the Linksys version, wipe the image to force the recovery mode. Run this:mtd -e linux -r (this will delete the partition and reboot), config your computer to an address in the 192.168.1.x range, and TFTP reflash the image you want. Read more here (DD-WRT site on recovering from a bad flash)
- The Sierra Wireless AC860 and Option Wireless GX0302 (in fact, most Option Wireless PC Cards) won’t work with OpenWRT, X-WRT or FreeWRT due to: 1. AC860 isn’t well supported in Linux at all; 2. Option requires the HSO kernel driver from Pharscape, which only compiles in the 2.6 kernel; 3. the latest versions of OpenWRT, X-WRT or FreeWRT with the 2.6 kernel has broken PC Card support
- Don’t bother with the Nozomi driver on OpenWRT – it only works with the old (ie. HSDPA) Option Wireless cards.
After spending 6 hours re-compiling a special version of FreeWRT on my Ubuntu machine, and many botched attempts to install OpenWRT on this router only to hit a brick wall. I decided to try the stock firmware just for kicks. Who knows if Linksys has built the HSO driver in their build? This is where I am going to tell you a secret… the different versions of WRT54G3G (Sprint, Verizon, AT&T, Vodafone) are all the same, except with different flash headers. What you need to know is that each firmware supports different modem cards, so the secret is to flash your router with the firmware that supports your data card. Most sites tell you to modify the header, but what header?
In my case, I have an Option Wireless card, which is supported with the WRT54G3G-AT V1 firmware. I have a WRT54G3G-ST V1 router. So follow these steps (everyone’s case is different, make your own decisions):
- Download the WRT54G3G-ST HW v1’s 2.01.13 firmware
- Download the WRT54G3G-AT HW v1’s 2.02.03 US firmware
- Look at the ST firmware – the first 4 bytes read W3GS
- Look at the AT firmware – the first 4 bytes read W3GA
- Modify the AT firmware with a hex file editor, change the 4th byte from S to A
- Flash your router with the newly modified firmware
Ok, if you are in my scenario, you can just follow step 2, 5 and 6 – but I wanted to illustrate the discovery for the public. Linksys reads the first 4 bytes as the firmware identifier. 10 minutes later I have a working mobile broadband router for Rogers or Fido.
Final note – you are better off buying a router with a USB port that is supported by OpenWRT. The USB port is typically for printer connections, but with OpenWRT you can turn the USB port to do anything – from sharing files from a portable USB drive to connecting to your 3G broadband with a 3G turbo/rocket/whatever stick.
Disclaimer: follow these instructions at your own risk
As a mobile gadget guy, I was interested in the iPhone alternative and trying to find a phone that defines me as “me”. It was cool when I was carrying the iPhone 2G in Toronto since no one had one, but now it’s just so common to see someone pull out an iPhone 3G or 3Gs from their pockets and haplessly try to tame the touchscreen beast.
So why did I decide to run out on day one to the Palm Pre rush? One, we were doing development with the Pre; and two it was cool that I was a part of the Pre rush! With all the signage saying “Pre-order your Pre”, I thought it will be another phenomenon like the Android and iPhone. It turned out to be a bit of a bust. I walked into my local Best Buy desperately trying to get someone’s attention to sell me a phone, there was only 1 salesperson at that point and she was helping this lady who was trying to buy something like the Pre, but not willing to pay full price for the phone (can you say cheap?). A second sales guy arrived and tried to sell me the phone but didn’t know how to go through the order system (ummm.. is this a PDA phone or 1X? What plan can you attach on a phone with no contract?), but 20 minutes later I got out with the Pre.
BTW: whatever Pre-sales training they had, they didn’t know how to activate the phone or even turn it on. It was frustrating to see the sales guy brutally destroying this beautiful package.
- Packaging: small and sleek. I am not an environmental freak but this is what all phones should be shipped in! Not this cardboard crap and oversize packaging. Palm did a great job making a great first impression. I am sure Bell had nothing to do with this.
- Phone: smaller than I anticipated. It may be a bit thick (same as my N97) but definitely smaller. As many have already noticed, when you slide out the keyboard, the bottom of the keyboard has quite a sharp edge – enough to be a paint scraper (and create skinning accidents – perhaps they need to bundle band-aids). The build quality is good – no loose parts, and the slider is very firm.
- First power-on: can I say slow. My god, I thought the Nokia N97 boot-up was terrible, this is going down in the books as the slowest booting phone. It has an ARM Cortex A8 dual-core processor just like the iPhone 3GS, and it boots up like Windows Vista (yes, terrible jab at Microsoft, but at least Windows Mobile 6 boots up marginally faster).
- User interface: 10 for the font choice, 9.5 for the colour, 9.5 for the icon, and 0 for the rounded corner around the screen. It’s a rectangular screen, give us all the pixels we paid for, not this Mac-esque rounded corner of System 6/7/8. Rounded corners around the screen is so passe.
- Applications: there just isn’t a lot of applications on the phone or in their beta store, but at least it’s functional and easy to use. Though if you are listening music while doing other work, you will see the phone stuttering just a little bit.
- iTunes support: what can I say… it’s a good feature! I wish other manufacturers would challenge Apple in their own game
- Synchronization: I give this a 11 out of 10 for Palm. They really got this right, and glad they are not letting the mobile providers screw around with this important feature! The ability to do server sync right from the activation, download contacts from Facebook, IM with AIM and GTalk, and Exchange ActiveSync support, this is a true messaging phone.
Overall – it’s a cool phone, but it’s a bit PREmature and rough around the edges (no pun intended for both). It’s really the only real alternative to the BlackBerry for Bell users. It won’t save Bell (or Telus when the exclusivity is over) from losing customers to Rogers or Fido. CDMA/EVDO is dead.