• Stars
    star
    1,113
  • Rank 41,718 (Top 0.9 %)
  • Language
    PHP
  • Created over 12 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A toolkit for creating professional WordPress deployments

WP Stack

A toolkit for creating professional WordPress deployments.

Commissioned by Knewton.

Why

WordPress runs professional sites. You should have a professional deployment to go along with it. You should be using:

  • Version control (like Git)
  • A code deployment system (like Capistrano)
  • A staging environment to test changes before they go live
  • CDN for static assets

Additionally, you should be able to easily scale out to multiple web servers, if needed.

WP Stack is a toolkit that helps you do all that.

WordPress Must-use Plugins

"Must-use" plugins aka mu-plugins are WordPress plugins that are dropped into the {WordPress content dir}/mu-plugins/ directory. They are autoloaded — no need to activate them. WP Stack comes with a number of these plugins for your use:

CDN

wp-stack-cdn.php

This is a very simple CDN plugin. Simply configure the constant WP_STACK_CDN_DOMAIN in your wp-config.php or hook in and override the wp_stack_cdn_domain option. Provide a domain name only, like static.example.com. The plugin will look for static file URLs on your domain and repoint them to the CDN domain.

Multisite Uploads

wp-stack-ms-uploads.php

The way WordPress Multisite serves uploads is not ideal. It streams them through a PHP file. Professional sites should not do this. This plugin allows one nginx rewrite rule to handle all uploads, eliminating the need for PHP streaming. It uses the following URL scheme for uploads: {scheme}://{domain}/wp-files/{blog_id}/. By inserting the $blog_id, one rewrite rule can make sure file requests go to the correct blog.

Note: You will need to implement this Nginx rewrite rule for this to work:

rewrite ^/wp-files/([0-9]+)/(.*)$ /wp-content/blogs.dir/$1/files/$2;

Manual DB Upgrades

Normally, WordPress redirects /wp-admin/ requests to the WordPress database upgrade screen. On large sites, or sites with a lot of active authors, this may not be desired. This drop-in prevents the automatic redirect and instead lets you manually go to /wp-admin/upgrade.php to upgrade a site.

Capistrano

Capistrano is a code deployment tool. When you have code that is ready to go "live", this is what does it.

Setup

  1. Create a deploy user on your system (Ubuntu: addgroup deploy; adduser --system --shell /bin/bash --ingroup deploy --disabled-password --home /home/deploy deploy ).
  2. Create an SSH key for deploy, make sure it can SSH to all of your web servers, and make sure it can pull down your site repo code.
    • Switch to the deploy user (su deploy).
    • ssh-keygen
    • cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    • Add the contents of ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys on every server you're deploying to.
  3. Install RubyGems.
  4. Install Capistrano and friends: sudo gem install capistrano capistrano-ext railsless-deploy
  5. Switch to the deploy user (su deploy) and check out WP Stack somewhere on your server: git clone [email protected]:markjaquith/WP-Stack.git ~/deploy
  6. Customize and rename config/SAMPLE.{config|production|staging}.rb
  7. Make sure your :deploy_to path exists and is owned by the deploy user: chown -R deploy:deploy /path/to/your/deployment
  8. Run cap deploy:setup (from your WP Stack directory) to setup the initial shared and releases directories.

Deploying

  1. Switch to the deploy user: su deploy
  2. cd to the WP Stack directory.
  3. Run cap production deploy (to deploy to staging, use cap staging deploy)

Rolling Back

  1. Switch to the deploy user: su deploy
  2. cd to the WP Stack directory.
  3. Run cap deploy:rollback

About Stages

There are two "stages": production and staging. These can be completely different servers, or different paths on the same set of servers.

To sync from production to staging (DB and files), run cap staging db:sync.

Assumptions made about WordPress

If you're not using WordPress Skeleton, you should be aware of these assumptions:

  1. Your wp-config.php file exists in your web root. So put it there.
  2. WP Stack replaces the following "stubs":
    • %%DB_NAME%% — Database name.
    • %%DB_HOST%% — Database host.
    • %%DB_USER%% — Database username.
    • %%DB_PASSWORD%% — Database password.
    • %%WP_STAGE%% – will be production or staging after deploy.
  3. WP Stack uses the constants WP_STAGE (which should be set to '%%WP_STAGE%%') and STAGING_DOMAIN, which should be set to the domain you want to use for staging (something like staging.example.com).

More Repositories

1

WordPress-Skeleton

Basic layout of a WordPress Git repository. I use this as a base when creating a new repo.
PHP
1,836
star
2

WP-TLC-Transients

PHP
338
star
3

WordPress

This is legacy. Use github.com/WordPress/WordPress/ instead!
PHP
229
star
4

WordPress-Plugin-Directory-Slurper

Slurps down every stable version of every plugin in the WordPress plugin directory.
PHP
163
star
5

clerk-sveltekit

Clerk adapter for SvelteKit
Svelte
137
star
6

encute

WordPress plugin for fluent management of scripts and styles.
PHP
107
star
7

page-links-to

#WordPressPlugin: Lets you make a WordPress page (or other content type) link to an external URL of your choosing, instead of its WordPress URL.
PHP
106
star
8

wp-help

#WordPressPlugin: Site operators can create detailed, hierarchical documentation for the site's authors, editors, and contributors, viewable in the WordPress admin
PHP
104
star
9

cache-buddy

#WordPressPlugin: makes more WordPress pages cacheable
PHP
78
star
10

BetterBible

The Bible has some issues. Let's make it better.
72
star
11

Showdown

Example WordPress plugin created for WordCamp San Francisco 2014, to show off wp.Backbone.View
PHP
52
star
12

WordPress-Plugin-Readme-Parser

PHP
42
star
13

gifdrop

#WordPressPlugin GIF repository plugin for WordPress
PHP
36
star
14

Localdev

Simple Ruby command line utility to point domains to your localhost
Ruby
34
star
15

markdown-on-save

#WordPressPlugin: allows you to author posts in Markdown, but stores rendered HTML in post_content so you can deactivate with impunity.
PHP
29
star
16

slug-control

#WordPressPlugin: Helps you craft amazing post URL slugs, for that hand-crafted URL feel.
PHP
27
star
17

i-make-plugins

#WordPressPlugin: For plugin authors. Showcase your plugins on your WordPress site. You only update your readme.txt files!
PHP
19
star
18

WordPress-Jetpack-Valet-Driver

A Laravel Valet driver that routes missing images to your public site, via Jetpack's Site Accelerator (formerly "Photon") CDN.
PHP
18
star
19

wpsql

DEPRECATED. Use WP-CLI instead! Old: Bash script that, given a wp-config.php file, opens a MySQL session to the DB server described within
17
star
20

scheduled-post-guardian

#WordPressPlugin: Watches over scheduled posts, so that no funny business interferes with their mission
PHP
16
star
21

WordPress-Plugin-Installer

PHP
16
star
22

nice-search

#WordPressPlugin: Makes search URLs pretty
PHP
15
star
23

login-logo

#WordPressPlugin: Customize the logo on the WP login screen by simply dropping a file named login-logo.png into your WP content directory. CSS is automatic!
PHP
15
star
24

wp-feature-better-passwords

PHP
11
star
25

WPPlugin

Command line tool for updating and managing WordPress plugins
Ruby
11
star
26

gist-indexer

#INACTIVE: Use swdyh/gisty instead!
PHP
10
star
27

workerbee

A friendly tool for composing Cloudflare Workers
TypeScript
9
star
28

cmdy

Your friendly command manager
Shell
7
star
29

BlockStub

PHP
6
star
30

BashGato

Control Elgato lights with a Bash script
Shell
6
star
31

categorized

#WordPressPlugin: Unchecks the default post category when you select a non-default category
PHP
5
star
32

stabletweet

JavaScript
5
star
33

hotfix

Provides unofficial fixes for selected WordPress bugs, so you don't have to wait for the next WordPress core release.
PHP
5
star
34

Alfred-Silent-Mention

Alfred 4 Workflow to silently type @usernames, domains.com, or #hashtags without them being linked or parsed
3
star
35

sveltekit-playwright-fetch-mock

Tools for mocking SSR fetch() requests in SvelteKit for use in Playwright
TypeScript
2
star
36

WordPress-Skeleton-Updater

PHP
2
star
37

switch-controller

PHP
2
star
38

p3-neutraliser

WordPress plugin which prevent's Pipdig's P3 plugin from updating or requesting malicious URLs
PHP
2
star
39

grunt-wp-simple-plugin

Simple WordPress Plugin Template
CoffeeScript
2
star
40

dieulot.github.io

instantclick.io
JavaScript
1
star
41

grunt-puphpet-site

Initialize a PuPHPet site with grunt-init
Ruby
1
star
42

Wherewithal

Given constraints, parses a string of conditions into a valid MySQL WHERE clause
PHP
1
star
43

BigBrain

A familiar game to help you, uh, master your... mind.
Svelte
1
star
44

prefsync

Syncs macOS preferences
Shell
1
star