Skip to content
Newer
Older
100644 95 lines (62 sloc) 4.61 KB
65f6883 @markjaquith First commit
authored Apr 17, 2012
1 # WP Stack
f501f8e @markjaquith Update the readme
authored May 3, 2012
2 A toolkit for creating professional [WordPress][wp] deployments.
3
ff0b8dc @markjaquith Note that this project was originally commissioned by Knewton.
authored Jul 5, 2012
4 Commissioned by [Knewton](http://www.knewton.com/).
5
f501f8e @markjaquith Update the readme
authored May 3, 2012
6 [wp]: http://wordpress.org/
7
8 ## Why
9 WordPress runs professional sites. You should have a professional deployment to go along with it. You should be using:
10
11 * Version control (like Git)
12 * A code deployment system (like Capistrano)
13 * A staging environment to test changes before they go live
14 * CDN for static assets
15
16 Additionally, you should be able to easily scale out to multiple web servers, if needed.
17
18 WP Stack is a toolkit that helps you do all that.
19
20 ## WordPress Must-use Plugins
21
e6c4cfc @markjaquith Update the README.md to reflect the reorganization of files
authored Jun 6, 2012
22 "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:
f501f8e @markjaquith Update the readme
authored May 3, 2012
23
24 ### CDN
25
26 `wp-stack-cdn.php`
27
28 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.
29
30 ### Multisite Uploads
31
32 `wp-stack-ms-uploads.php`
33
34 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.
35
33a2541 @markjaquith Provide the Nginx rewrite rule that is needed for Multisite uploads r…
authored Jun 7, 2012
36 **Note:** You will need to implement this Nginx rewrite rule for this to work:
37
38 `rewrite ^/wp-files/([0-9]+)/(.*)$ /wp-content/blogs.dir/$1/files/$2;`
24c6b39 @markjaquith Capistrano prerequisites.
authored May 25, 2012
39
98748d1 @markjaquith Talk about the new manual DB upgrades drop-in in the README.md
authored Jun 13, 2012
40 ### Manual DB Upgrades
41
42 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.
43
24c6b39 @markjaquith Capistrano prerequisites.
authored May 25, 2012
44 ## Capistrano
45
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
46 Capistrano is a code deployment tool. When you have code that is ready to go "live", this is what does it.
24c6b39 @markjaquith Capistrano prerequisites.
authored May 25, 2012
47
48 ### Setup
49
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
50 1. Create a `deploy` user on your system (Ubuntu: `addgroup deploy; adduser --system --shell /bin/bash --ingroup deploy --disabled-password --home /home/deploy deploy
51 `).
1421492 @markjaquith More verbose instructions
authored Jun 5, 2012
52 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.
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
53 * Switch to the deploy user (`su deploy`).
54 * `ssh-keygen`
55 * `cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys`
2b4f3bb @brandondove Corrected spelling error in Readme
brandondove authored Aug 30, 2012
56 * Add the contents of `~/.ssh/id_rsa.pub` to `~/.ssh/authorized_keys` on every server you're deploying to.
30705ba @markjaquith A bunch of README updates
authored Jun 7, 2012
57 3. [Install RubyGems][rubygems].
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
58 4. Install Capistrano and friends: `sudo gem install capistrano capistrano-ext railsless-deploy`
510cb7d @markjaquith Provide the git clone command
authored Jun 7, 2012
59 5. Switch to the deploy user (`su deploy`) and check out WP Stack somewhere on your server: `git clone git@github.com:markjaquith/WP-Stack.git ~/deploy`
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
60 6. Customize and rename `config/SAMPLE.{config|production|staging}.rb`
510cb7d @markjaquith Provide the git clone command
authored Jun 7, 2012
61 7. Make sure your `:deploy_to` path exists and is owned by the deploy user: `chown -R deploy:deploy /path/to/your/deployment`
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
62 8. Run `cap deploy:setup` (from your WP Stack directory) to setup the initial `shared` and `releases` directories.
50afe56 @markjaquith Update the readme to handle stages
authored Jun 5, 2012
63
64 [rubygems]: http://rubygems.org/pages/download
1421492 @markjaquith More verbose instructions
authored Jun 5, 2012
65
66 ### Deploying
67
68 1. Switch to the deploy user: `su deploy`
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
69 2. `cd` to the WP Stack directory.
70 3. Run `cap production deploy` (to deploy to staging, use `cap staging deploy`)
1421492 @markjaquith More verbose instructions
authored Jun 5, 2012
71
72 ### Rolling Back
73
74 1. Switch to the deploy user: `su deploy`
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
75 2. `cd` to the WP Stack directory.
76 3. Run `cap deploy:rollback`
24c6b39 @markjaquith Capistrano prerequisites.
authored May 25, 2012
77
50afe56 @markjaquith Update the readme to handle stages
authored Jun 5, 2012
78 ### About Stages
79
d43f110 @markjaquith Beef up the README with more examples and clarifications.
authored Jun 7, 2012
80 There are two "stages": production and staging. These can be completely different servers, or different paths on the same set of servers.
81
30705ba @markjaquith A bunch of README updates
authored Jun 7, 2012
82 To sync from production to staging (DB and files), run `cap staging db:sync`.
83
84 ## Assumptions made about WordPress
85
86 If you're not using [WordPress Skeleton](https://github.com/markjaquith/WordPress-Skeleton), you should be aware of these assumptions:
87
88 1. Your `wp-config.php` file exists in your web root. So put it there.
89 2. WP Stack replaces the following "stubs":
90 * `%%DB_NAME%%` — Database name.
91 * `%%DB_HOST%%` — Database host.
92 * `%%DB_USER%%` — Database username.
3f3057a @markjaquith Fix documentation typo. Props @joncave
authored Jul 6, 2012
93 * `%%DB_PASSWORD%%` — Database password.
30705ba @markjaquith A bunch of README updates
authored Jun 7, 2012
94 * `%%WP_STAGE%%` – will be `production` or `staging` after deploy.
95 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`).
Something went wrong with that request. Please try again.