If you’re using WordPress or another web application that utilizes uploads in a load balanced and autoscaled environment, you know what a pain it can be to manage the uploads so they don’t disappear when an instance shuts down. Likewise, you need to make sure that every instance would have to have a copy of the resources because a request could go to any of them. We use WordPress, and use media uploads quite a bit. We’ve been looking for a nice solution to the problem but until recently we didn’t have one. As we recently changed our autoscaling configuration and we recycle instances daily now, we found ourselves needing a better solution to this problem, and quickly.
The obvious choice for centralized resource storage is AWS S3. The unobvious choice is how to go about it. We tried using a few different WordPress extensions to do the task, however all of them had faults in one way or another that make them not well suited for a load balanced and autoscaled environment. Then we stumbled upon s3fs-fuse. In short, it’s a FUSE filesystem extension to mount an S3 bucket as a local folder on the file system. This seemed like the perfect solution. I checked into some other S3 File System FUSE extensions and this one seemed to be the most mature and actively maintained, despite it’s high open issue count, some of which are more questions about the product than actual issues.
Fortunately, getting s3fs-fuse setup to work with AWS Beanstalk is as easy as adding a .config file to your .ebextensions folder and adding your Access Keys to your Elastic Beanstalk configuration and that’s it! No changes to WordPress! Now, if you have the need to use CloudFront for your WordPress resources, then you’ll probably need an additional custom plugin (ie: you’ll have to write it, I haven’t found anything that will do this) that will inspect content of your posts and rewrite the URLs to a CloudFront url. But you can still use this s3fs-fuse extension as a backend to ensure files are uploaded to S3.
So without further delay, here is the config file. Simply add an Access Key to your Elastic Beanstalk configuration (one that has access to the bucket you’re referencing), replace the bracketed options with your specific details and drop this file into your .ebextensions folder and deploy it to your Beanstalk environment.
Rather than try and reconfigure the Amazon Linux AMI to use Nginx and PHP-FPM, it was much easier to reconfigure Apache to use the Event MPM instead of Prefork, and utilize PHP-FPM. This uses the 2014.03 version of the Amazon Linux AMI for PHP 5.5. Save this file in your .ebextensions folder in the root of your project. More >
When you have hundreds of applications managed via a central repository which are checked out to multiple production and staging servers, it can become burdensome to manage and/or remember where every working copy of that code resides. We recently ran into this issue at my work so we needed a solution that was going to be developer friendly and easy to manage on a per-repository basis. More >
I recently needed to write a pretxnchangegroup hook that would check if any new tags had been pushed, and if so, if they were GPG signed. I had the requirement that the changeset with the tag be signed, not the changeset that added the tag. I’m not a python coder, so I opted to go for a simple bash script to accomplish the task. The only option the script has is whether or not the hook can fail if a changeset does not have a valid signature. If the option is disabled, it will only throw an error, but the hook will still pass. More >
In some recent development work, I ran into a brick wall with Suhosin. I have both the patch and extension installed on all of my dev boxes on all PHP versions I test with. I found the need to change a configuration directive, but I did not want to change that value in the suhosin server configuration, I wanted to change it via either .htaccess or PHP’s ‘user.ini’ file. More >
I’ve spent the last week looking through the web at everything I could possibly find in an effort to find some shred of information that made some sort of sense and didn’t take a rocket scientist to configure. I found plenty of instructions on manually installing Openswan, xl2tp and modifying their configuration files and entering a pre-shared key here, or putting a certificate there, blah, blah blah, blah blah. After many failed attempts, I was pretty much ready to give up. More >
If you’ve scoured through Windows Server configurations for the DHCP server looking to set the Search Domains and have come up empty, there’s good reason: Most, if not all, versions of Windows do not support setting Search Domains via DHCP (option 119), thus Microsoft does not include a visible option to set this on their DHCP servers. More >
With the releases of SMF 2.0 RC4 and RC5, many new integration hooks were added to allow mod authors to extend the code without hacking it up. Previously to this, the primary use of these hooks was for integration with bridges or other systems, no one really used them for modifications. SimpleSEF was the first mod to really exploit these hooks and use them to accomplish some pretty major tasks. What I am presenting here is a simple PHP class that can be used to easily extend SMF using it’s integration hooks with very little effort. If you are fairly new to PHP or new to PHP5′s OOP model, you should turn away now. More >
This is a simple run through on how to get the W3C Validator up and running on your Ubuntu 10.04+ system. While you can already have Apache installed and running, this walk through assumes you are installing the validator on a brand new Ubuntu install. More >
I recently had the task at work of setting up a simple DoS protection for our public web server. After poking around some bit, I settled on using DDoS-Deflate. We use Ubuntu 10.04 on our server and unfortunately, the script seems to have been last updated over 5 years ago and I needed some modifications to make it work in our environment. I also didn’t like the idea of the install script needing to download files from some web server and have packaged it up all in one (linked at the end of this post).