WordPress is the most popular QuickStart on OpenShift Hub. Here are some tips to make the most of it!
Tip 1: Use PHP 5.4 and MySQL 5.5
For new deployments, make sure you use PHP 5.4 and MySQL 5.5. Don’t get started yet! We began here to lead into tip #2.
Tip 2: Move your Database to a Separate Gear
Another easy win. It’s not immediately obvious how to do this in OpenShift Online, but it’s very easy once you’re aware it’s possible.
The solution: deploy WordPress as a ‘scalable’ application with PHP set to scale to a maximum of 1 gear. OpenShift will run PHP on one gear and MySQL on a separate gear. Your database will have a separate set of resources (memory, storage, and CPU).
For new deployments from the web console, select the option to “Scale with web traffic”:
IMPORTANT: Make sure you update your scaling settings after your app is created! Click on your app, then click the link under ‘Scales’ to adjust your scaling settings. Set PHP to scale to a max of 1 gear.
For new deployments from the command line:
$ rhc create-app <app name> php-5.4 mysql-5.5 --from-code=https://github.com/openshift/wordpress-example -s $ rhc cartridge scale php -a <app name> --min 1 --max 1
Tip 3: Upgrade to Bronze to Disable Idling (it’s free)
If you live in the US, Canada, Europe, or Israel and you haven’t upgraded to the OpenShift Bronze Plan you’re missing out on a completely free upgrade. ‘Upgrading’ to the OpenShift Online Bronze Plan disables application idling for any gears running on your account. And, I can’t re-iterate this enough, it’s FREE. You get all the benefits of the Free Plan, but with application idling disabled, support for private SSL certificates, and team management with the OPTION to pay to use extra gears and storage.
If this isn’t absolutely clear on our pricing or plan comparison pages please let me know in the comments! If you live outside of our supported regions for OpenShift Online Bronze/Silver plans, help us help you by filling out the Geo Request Form to let us know you’re interested.
Tip 4: Enable Hot Deployment
Tip 5: Install the W3 Total Cache Plugin
Using the W3 Total Cache plugin with your WordPress installation will significantly speed up your site. Install it from the WordPress admin panel or download it from wordpress.org and check it in through source control.
Update: I recommend enabling both page and database caching in the W3 Total Cache general settings menu with ‘Opcode: Alternative PHP Cache (APC)’ as the caching method for both.
Tip 6: Use CloudFlare
Have a custom domain name for your WordPress site? Route your custom domain through CloudFlare’s DNS service.
CloudFlare will automatically detect images and static assets on your site and serve them to your visitors using their global CDN. CloudFlare also offers free SSL for custom domains. If you haven’t heard of CloudFlare, check out their features page.
If you followed tip #5, CloudFlare is provided as a W3 Total Cache extension. Setup instructions can be found here.
If you aren’t planning to use W3 Total Cache, follow this blog post.
Tip 7: Use SendGrid for Email Notifications
We recommend replacing the built-in WordPress mail system with SendGrid for improved deliverability and enhanced reporting. There’s even a note about this in our latest version of the WordPress QuickStart in the wp-config file.
Check out the Developer Portal article to learn how to install SendGrid for WordPress on OpenShift.
Tip 8: Add the WP Optimize Plugin
WordPress can generate a lot of waste in your database. Clean it up with WP Optimize. Install it from the WordPress admin panel or download it from wordpress.org and check it in through source control.
Tip 9: Enable ‘Development’ Mode During Development
The latest version of our WordPress QuickStart offers support for advanced debugging. Learn how to enable ‘development’ mode.
Tip 10: Throw Some Money at It
Need to support more traffic? Do you have resource-intensive plugins or themes? Step up to a larger gear size for PHP, your database, or both. We run this blog using the WordPress QuickStart with Large gears – one for the database and another for PHP.
Is your user base largely in Europe? Switch over to any of our Production gears (Small.highcpu, Medium, and Large gears) and re-deploy your site closer to your users in our European hosting region. Learn how.
Tip 11: Backup WordPress with OpenShift Backup Server
If you used tip #2, this step will require you to pay for an extra gear on your account. Still, it’s worth mentioning if you take your application seriously.
Use the OpenShift Backup Server to create one-time or scheduled backups for your WordPress site. It’s the easiest, most complete way to backup your OpenShift applications using OpenShift’s built-in
snapshot system for backup/restore.
Tip 12: Risk it with Scaling (experts only)
I wouldn’t recommend scaling the current WordPress QuickStart (beyond separating the database from tip #2 or using larger gears from tip #10). For the more daring and hopefully expert users out there, we plan on releasing an experimental ‘Scalable WordPress’ QuickStart available on the OpenShift Hub shortly. There are quite a few downsides to scaling WordPress without a shared file system, namely that plugins, themes, and updates will have to be managed through source control. Nevertheless, we can try to create a workable solution…together :)
Have your own tips for using WordPress on OpenShift? Share your tips in the comments!