Themetry is no longer operational. This site is here for archival purposes. See what Leland is working on at le.land.

Setting up the update server

Step 1: Sign up to Digital Ocean, fund your account

If you’ve never used Digital Ocean before, there may be a brief period before you can create a Droplet while staff manually approve your account.

A “Droplet” is another word for virtual private server (VPS). When one is spun up, you get unrestricted access to do whatever you want with it.

Step 2: Create a Droplet

Under “Choose an Image” select: Ubuntu 16.04.2 x64

Under “Choose a Size” select: $5/mo (this can always be upgraded later, but we like to start small)

Under “Choose a datacenter region” choose a location near you, or your clients.

Step 3: Initial server setup

Follow the Initial Server Setup with Ubuntu 16.04 guide. You’ll also need to configure the firewall:

sudo ufw allow http
sudo ufw allow https
Step 4: Install Apache
sudo apt-get update
sudo apt-get install apache2

Open the Apache configuration file:

sudo nano /etc/apache2/apache2.conf

Add the following line at the end:

ServerName updates.themetry.com

Then restart Apache:

sudo systemctl restart apache2
Step 5: Install a Let’s Encrypt certificate
sudo apt-get install python-letsencrypt-apache
sudo letsencrypt --apache -d updates.themetry.com
Step 6: Clone the Automatic Theme/Plugin Updater repository
cd /var/www/html
rm index.html
sudo chown -R youruser:youruser /var/www/html
git clone https://github.com/jeremyclark13/automatic-theme-plugin-update.git .

Then clean up unnecessary files:

rm -rf .git/ theme/ plugin/
rm readme.md readme.txt
Install PHP
sudo apt-get install php libapache2-mod-php
sudo systemctl restart apache2
Protect direct .zip access

Edit /etc/apache2/apache2.conf and change AllowOverride None to AllowOverride All within the /var/www/ directory block.

Step 7: Make your themes and plugins updateable

For themes, require the update.php from your functions.php:

function prefix_theme_updater() {
    require( get_template_directory() . '/inc/update.php' );
}
add_action( 'after_setup_theme', 'prefix_theme_updater' );

For plugins:

include( dirname( __FILE__ ) . '/update.php' );
Step 8: Release an update

Zip your theme/plugin, place the .zip file in the api/update/ directory, and edit your api/packages.php file to add the new package.

Step 9: Wait for site admins to update

Any sites running themes or plugins with update.php properly configured will eventually be notified an update is available, downloading from your update server instead of WordPress.org.

Frequently Asked Questions

Can’t I just use my regular web hosting account for this too?

Sure you can, but $5/month for a dedicated server provides separation of concerns and easy Let’s Encrypt installation.

Can’t I just use WordPress.org as my update server?

You could, but you might want your own server if you’re tired of the review process, your product doesn’t meet guidelines, or it’s intended only for clients.

Previous Post
Preventing unwanted theme updates from WordPress.org
Next Post
Cache-busting enqueued scripts and styles in WordPress