Featured Posts

Using DKIM with Exim and cPanel Similar to the intentions of SPF records and DomainKeys, DKIM is intended to authenticate a sender by using a public/private key pair to digitally sign email, therefore increasing deliverability. At this...

Readmore

Copy Outgoing Email on a cPanel Server with Exim A common request we get is how a user can automatically BCC outgoing email to another address. This is most often requested by law firms that need to be able to retain copies of communication. Forwarding...

Readmore

Do You Care About Your Customers' Data? I was working a case last week for a new client that's been hosting local business websites for over three years. As with all of my case studies, I did a short survey of the client's infrastructure, processes,...

Readmore

Tips to Reduce Your Customer Support Costs When hosting websites, whether as a mainstream hosting provider, a hobby, or to supplement another service, it's your job to make sure your customers have access to technical support in case they need...

Readmore

Roundcube: MySQL or SQLite? cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I've come to the conclusion that SQLite is definitely...

Readmore

The cPanel Admin Rss

Automating Apache and PHP Updates

Posted by Vanessa | Tagged under ,,, | Posted on May 19, 2010

0

A lot of hosts that deploy a large number of servers are automating updates instead of running them manually. While cPanel updates can be automated as well, it’s become a common question of how to automate Apache and PHP updates across a large number of servers without having to manually run EasyApache on each server, which can be a very time-consuming process. If Apache and PHP were built via RPM, you could simply run a yum update. However, since they are built with EasyApache it’s not quite as simple as updating an RPM, but it’s still very easy to automate.

A few things I want to mention before you consider automating Apache and PHP updates:

  • You shouldn’t do this unless you have cPanel updates running automatically as well, for stable and release builds only. This reduces the chance of something going wrong and leaving you with broken builds across a ton of servers
  • Always test your build first on one server before deploying

Scenario:

You have a large number of servers that are set up almost identically, and you want to schedule monthly updates to make sure PHP and Apache are always up to date, but still similar to provide consistency.

The easiest way to set this up is as follows:

1) Run EasyApache on one of the servers, configure your build as you wish, then save the profile. I would also recommend running the build to make sure that it works properly before you deploy it.

2) Go into /var/cpanel/easy/apache/profile and look for a file called _last_success.yaml. This will be the one you just saved, unless you updated a template that was already named, or you know for a fact that it’s named something else. Rename this template to something you would recognize, like latest.yaml. Edit the yaml file and change these fields:

name: Shared server build
note: “Default build for all shared servers”

The name and note will identify the build in your EasyApache interface.

3) Move this script to the ‘custom’ folder (/var/cpanel/easy/apache/profile/custom)

From here, what I recommend doing is uploading the build template to a repository so it can be easily “grabbed”. That way each time you update the build, you would update the template in the repository and automate the command that downloads it and builds Apache.  Since I named my yaml file latest.yaml, this is the command I’d run via cron on all my servers:

wget -O /var/cpanel/easy/apache/custom/latest.yaml http://repo.mydomain.com/ea/latest.yaml && /scripts/easyapache –profile=latest.yaml –build

The following command builds the profile automtically:

/scripts/easyapache –profile=latest.yaml –build

The latest.yaml file is the file name of the template I’m using, and –build indicates that the build should be started immediately instead of loading the EA configuration screen.

Here are a couple other options you might want to pass to /scripts/easyapache:

  • –do_not_revert_on_conf_failure : Use if you want to fix httpd.conf problems manually after the build. NOT recommended for automated EA updates
  • –skip-cpanel-version-check: Use if you don’t run automated cPanel updates and don’t want EasyApache to prompt for an update
  • –always_do_the_latest_phps : Always use the latest PHP version, keeping in mind that “latest version” refers to the latest version available in EA
  • –always_do_the_oldest_phps : Always use the oldest PHP version available in EA

You may also want to consider using hooks to automate post-build tests, and report any issues that may arise. Hooks are events/commands that run before or after a specific action. You can read more about hooks below:

http://etwiki.cpanel.net/twiki/bin/view/EasyApache3/EasyApacheHooks

Liking this article? Share it and spread the word!
  • Print
  • PDF
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Live
  • MySpace
  • RSS
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts:

Write a comment