~ibm-demo/charms/trusty/wordpress/trunk

« back to all changes in this revision

Viewing changes to README.md

  • Committer: Marco Ceppi
  • Date: 2014-07-17 18:32:50 UTC
  • mfrom: (72.2.4 wordpress)
  • Revision ID: marco@ceppi.net-20140717183250-sxwd0sn46x1js9fl
[jose] Fixed bug #1309980, which throws an error when WP-FFPC is installed due to a relation with memcached.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Overview
2
2
 
3
 
WordPress is a powerful blogging platform written in PHP. This charm aims to deploy WordPress in a fashion that will allow anyone to scale and grow out
4
 
a single installation.
 
3
WordPress is a powerful blogging platform written in PHP. This charm aims to
 
4
deploy WordPress in a fashion that will allow anyone to scale and grow out a
 
5
single installation.
5
6
 
6
7
# Usage
7
8
 
8
 
This charm is available in the Juju Charm Store, to deploy you'll need at a minimum: a cloud environment, a working Juju installation,
9
 
and a successful bootstrap. Please refer to the [Juju Getting Started](https://juju.ubuntu.com/docs/getting-started.html) documentation before continuing.
 
9
This charm is available in the Juju Charm Store, to deploy you'll need at a
 
10
minimum: a cloud environment, a working Juju installation, and a successful
 
11
bootstrap. Please refer to the
 
12
[Juju Getting Started](https://juju.ubuntu.com/docs/getting-started.html)
 
13
documentation before continuing.
10
14
 
11
15
Once bootstrapped, deploy the MySQL charm then this WordPress charm:
12
16
 
23
27
 
24
28
## Scaled Down Usage for Personal Use
25
29
 
26
 
If you're just looking to run a personal blog and want to save money you can run all of this on a single node, here's an entire single node installation from scratch: 
 
30
If you're just looking to run a personal blog and want to save money you can run
 
31
all of this on a single node, here's an entire single node installation from
 
32
scratch: 
27
33
 
28
34
    juju bootstrap
29
35
    juju deploy --to 0 wordpress
31
37
    juju add-relation wordpress mysql 
32
38
    juju expose wordpress
33
39
 
34
 
This will run everything on one node, however we still have the flexibility to grow horizontally. If your blog gets more traffic and you need to scale:
 
40
This will run everything on one node, however we still have the flexibility to
 
41
grow horizontally. If your blog gets more traffic and you need to scale:
35
42
 
36
43
    juju add-unit wordpress
37
44
 
38
 
Since we're omitting the `--to` command Juju will fire up a new dedicated machine for Wordpress and relate it. You can also `remove-unit` when the surge is over and go back to a cheaper one node set up. 
 
45
Since we're omitting the `--to` command Juju will fire up a new dedicated
 
46
machine for Wordpress and relate it. You can also `remove-unit` when the surge
 
47
is over and go back to a cheaper one node set up. 
39
48
 
40
49
# Scale Out Usage 
41
50
 
42
 
You can deploy a memcached server and relate it to your WordPress service to add memcache caching. This will 
43
 
automagically install [WP-FFPC](http://wordpress.org/extend/plugins/wp-ffpc/) (regardless of your tuning settings) and configure it to cache 
44
 
rendered pages to the memcache server. In addition to this layer of caching, Nginx will pull directly from memcached bypassing PHP altogether. 
45
 
You could theoretically then turn off php5-fpm on all of your servers and just have Nginx serve static content via memcached (though, you 
46
 
wouldn't be able to access the admin panel or any uncached pages - it's just a potential scenario).
 
51
You can deploy a memcached server and relate it to your WordPress service to add
 
52
memcache caching. This will automagically install
 
53
[WP-FFPC](http://wordpress.org/extend/plugins/wp-ffpc/) (regardless of your
 
54
tuning settings) and configure it to cache rendered pages to the memcache
 
55
server. In addition to this layer of caching, Nginx will pull directly from
 
56
memcached bypassing PHP altogether. You could theoretically then turn off
 
57
php5-fpm on all of your servers and just have Nginx serve static content via
 
58
memcached (though, you wouldn't be able to access the admin panel or any
 
59
uncached pages - it's just a potential scenario).
47
60
 
48
61
    juju deploy memcached
49
62
    juju add-relation memcached wordpress
50
63
    
51
 
This setup will also synchronize the flushing of cache across all WordPress nodes, making it ideal to avoid stale caches.
52
 
 
53
 
A small note, when using the Apache2 engine and memcache, all request will still be sent to WordPress via Apache where typical caching 
54
 
procedures will take place and wp-ffpc will render the memcached page.
 
64
This setup will also synchronize the flushing of cache across all WordPress
 
65
nodes, making it ideal to avoid stale caches.
 
66
 
 
67
Once the relation is set and the hooks have ran accordingly, you will need to
 
68
manually save the settings for WP-FFPC. Everything will be configured, though.
 
69
Just log in to the administrator Dashboard, and then click the link to the
 
70
WP-FFPC Settings page displayed on the error at the top of the page. Finally,
 
71
scroll down and click on the blue button which says Save Changes.
 
72
 
 
73
A small note, when using the Apache2 engine and memcache, all request will
 
74
still be sent to WordPress via Apache where typical caching procedures will take
 
75
place and wp-ffpc will render the memcached page.
55
76
 
56
77
# Configuration
57
78
 
58
 
This WordPress charm comes with several tuning levels designed to encompass the different styles in which this charm will be used.
 
79
This WordPress charm comes with several tuning levels designed to encompass the
 
80
different styles in which this charm will be used.
59
81
 
60
82
A use case for each tuning style is outlined below:
61
83
 
62
84
## Bare
63
85
 
64
 
The Bare configuration option is meant for those who wish to run the stock WordPress setup with no caching, no manipulation of data, 
65
 
and no additional scale out features enabled. This is ideal if you intend to install additional plugins to deal with coordinating
66
 
WordPress units or simply wish to test drive WordPress as it is out of the box. This will still create a load-balancer when an additional
67
 
unit is created, though everything else will be turned off (WordPress caching, APC OpCode caching, and NFS file sharing).
 
86
The Bare configuration option is meant for those who wish to run the stock
 
87
WordPress setup with no caching, no manipulation of data, and no additional
 
88
scale out features enabled. This is ideal if you intend to install additional
 
89
plugins to deal with coordinating WordPress units or simply wish to test drive
 
90
WordPress as it is out of the box. This will still create a load-balancer when
 
91
an additional unit is created, though everything else will be turned off
 
92
(WordPress caching, APC OpCode caching, and NFS file sharing).
68
93
 
69
94
To run this WordPress charm under a bare tuning level execute the following:
70
95
 
72
97
 
73
98
## Single
74
99
 
75
 
When running in Single mode, this charm will make every attempt to provide a solid base for your WordPress install. By running in single
76
 
the following will be enabled: Nginx microcache, APC OpCode caching, WordPress caching module, and the ability to sync files via NFS.
77
 
While Single mode is designed to allow for scaling out, it's meant to only scale out for temporary relief; say in the event of a large
78
 
traffic in-flux. It's recommended for long running scaled out versions that optimized is used. The removal of the file share speeds up
79
 
the site and servers ensuring that the most efficient set up is provided. 
 
100
When running in Single mode, this charm will make every attempt to provide a
 
101
solid base for your WordPress install. By running in single the following will
 
102
be enabled: Nginx microcache, APC OpCode caching, WordPress caching module,
 
103
and the ability to sync files via NFS. While Single mode is designed to allow
 
104
for scaling out, it's meant to only scale out for temporary relief; say in the
 
105
event of a large traffic in-flux. It's recommended for long running scaled out
 
106
versions that optimized is used. The removal of the file share speeds up the
 
107
site and servers ensuring that the most efficient set up is provided. 
80
108
 
81
109
To run this WordPress charm under a single tuning level execute the following:
82
110
 
84
112
 
85
113
## Optimized
86
114
 
87
 
If you need to run WordPress on more than one instance constantly, or require scaling out and in on a regular basis, then Optimized is the
88
 
recommended configuration. When you run WordPress under an Optimized tuning level, the ability to install, edit, and upgrade themes and plugins
89
 
is disabled. By doing this the charm can drop the need for an NFS mount which is inefficient and serve everything from it's local disk.
90
 
Everything else provided in Single level is available. In order to install or modify plugins with this setup you'll need to edit and commit
91
 
them to a forked version of the charm in the files/wordpress/ directory.
 
115
If you need to run WordPress on more than one instance constantly, or require
 
116
scaling out and in on a regular basis, then Optimized is the recommended
 
117
configuration. When you run WordPress under an Optimized tuning level, the
 
118
ability to install, edit, and upgrade themes and plugins is disabled. By doing
 
119
this the charm can drop the need for an NFS mount which is inefficient and serve
 
120
everything from it's local disk. Everything else provided in Single level is
 
121
available. In order to install or modify plugins with this setup you'll need to
 
122
edit and commit them to a forked version of the charm in the files/wordpress/
 
123
directory.
92
124
 
93
 
To run this WordPress charm under an optimized tuning level execute the following:
 
125
To run this WordPress charm under an optimized tuning level execute the
 
126
following:
94
127
 
95
128
    juju set wordpress tuning=optimized
96
129
 
97
130
### Handling wp-content
98
131
 
99
 
In order to allow for custom WordPress content within the Juju charm a separate configuration option exists for pointing to any Git or Bzr 
100
 
repository. An example of a valid formed wp-content repository can be found on the [Juju Tools Github page](https://github.com/jujutools/wordpress-site). 
101
 
To set the wp-content directive to a git repository, use one of the following formats making sure to replace items like `host`, `path`, and `repo` with their 
 
132
In order to allow for custom WordPress content within the Juju charm a separate
 
133
configuration option exists for pointing to any Git or Bzr repository. An
 
134
example of a valid formed wp-content repository can be found on the
 
135
[Juju Tools Github page](https://github.com/jujutools/wordpress-site). To set
 
136
the wp-content directive to a git repository, use one of the following formats
 
137
making sure to replace items like `host`, `path`, and `repo` with their 
102
138
respective names:
103
139
 
104
140
    juju set wordpress wp-content=git@host:path/repo.git
111
147
 
112
148
    juju set wordpress wp-content=git://host/path/repo.git
113
149
    
114
 
If you wish to use a bzr repository, then apply one of the following schemes replacing items like `host`, `username`, `path`, and `repo` with their respective values:
 
150
If you wish to use a bzr repository, then apply one of the following schemes
 
151
replacing items like `host`, `username`, `path`, and `repo` with their
 
152
respective values:
115
153
 
116
154
For LaunchPad hosted repostiories:
117
155
 
125
163
 
126
164
    juju set wordpress wp-content=bzr+ssh://host/path/repo
127
165
    
128
 
Setting the wp-content option to an empty string ("") will result in no further updates being pulled from that repository; however, the last pull will remain 
129
 
on the system and will not be removed.
 
166
Setting the wp-content option to an empty string ("") will result in no further
 
167
updates being pulled from that repository; however, the last pull will remain on
 
168
the system and will not be removed.
130
169
 
131
170
## debug
132
171
 
133
 
This option will create a directory `_debug` at the root of each unit (`http://unit-address/_debug`). In this directory are two scripts: info.php (`/_debug/info.php`) 
134
 
and apc.php (`/_debug/apc.php`). info.php is a simple phpinfo script that will outline exactly how the environment is configured. apc.php is the APC admin portal which 
135
 
provides APC caching details in addition to several administrative functions like clearing the APC cache. This should never be set to "yes" in production as it exposes 
136
 
detailed information about the environments and may provide a way for an intruder to DDoS the machine.
 
172
This option will create a directory `_debug` at the root of each unit
 
173
(`http://unit-address/_debug`). In this directory are two scripts: info.php
 
174
(`/_debug/info.php`) and apc.php (`/_debug/apc.php`). info.php is a simple
 
175
phpinfo script that will outline exactly how the environment is configured.
 
176
apc.php is the APC admin portal which provides APC caching details in addition
 
177
to several administrative functions like clearing the APC cache. This should
 
178
never be set to "yes" in production as it exposes detailed information about the
 
179
environments and may provide a way for an intruder to DDoS the machine.
137
180
 
138
181
    juju set wordpress debug=yes
139
182
 
145
188
 
146
189
## Engine
147
190
 
148
 
By default the WordPress charm will install nginx and php5-fpm to serve pages. In the event you do not wish to use nginx - for whatever reason - you can switch to Apache2.
149
 
This will provide a near identical workflow as if you were using nginx with one key difference: memcached. In nginx, the cached pages are served from memcached prior to
150
 
hitting the php contents, this isn't possible with apache2. As such memcached support still works, since it falls back to the WordPress caching engine, but it's not as robust.
151
 
Otherwise, Apache2 will still perform balancing and everything else mentioned above. You can switch between engines at will with the following:
 
191
By default the WordPress charm will install nginx and php5-fpm to serve pages.
 
192
In the event you do not wish to use nginx - for whatever reason - you can switch
 
193
to Apache2. This will provide a near identical workflow as if you were using
 
194
nginx with one key difference: memcached. In nginx, the cached pages are served
 
195
from memcached prior to hitting the php contents, this isn't possible with
 
196
apache2. As such memcached support still works, since it falls back to the
 
197
WordPress caching engine, but it's not as robust. Otherwise, Apache2 will still
 
198
perform balancing and everything else mentioned above. You can switch between
 
199
engines at will with the following:
152
200
 
153
201
    juju set wordpress engine=apache2
154
202
 
162
210
 
163
211
## HP Cloud 
164
212
 
165
 
At this time WordPress + Memcached don't work on HP Cloud's standard.xsmall. To get around this deploy the WordPress charm with the 
166
 
charm to at least a `standard.small`, to do this:
 
213
At this time WordPress + Memcached don't work on HP Cloud's standard.xsmall. To
 
214
get around this deploy the WordPress charm with the charm to at least a
 
215
`standard.small`, to do this:
167
216
 
168
217
    juju deploy --constraints "instance-type=standard.small" wordpress
169
218
 
170
 
This only is a problem when attempting to relate memcached to WordPress, otherwise an xsmall is _okay_ though it's really not the best 
171
 
sized platform for running a stable WordPress install.
 
219
This only is a problem when attempting to relate memcached to WordPress,
 
220
otherwise an xsmall is _okay_ though it's really not the best sized platform for
 
221
running a stable WordPress install.
172
222
 
173
223
## Single mode and the scale-out
174
224
 
175
 
If you're in Single mode and you want to/need to scale out, but you've been upgrading, modifying, and installing plugins + themes like
176
 
a normal WordPress user on a normal install; you can still scale out but you'll need to deploy a shared-fs charm first. At the time of
177
 
this writing only the NFS charm will work, but as more shared-fs charms come out (gluster, ceph, etc) that provide a shared-fs/mount 
178
 
interface those should all work as well. In this example we'll use NFS:
 
225
If you're in Single mode and you want to/need to scale out, but you've been
 
226
upgrading, modifying, and installing plugins + themes like a normal WordPress
 
227
user on a normal install; you can still scale out but you'll need to deploy a
 
228
shared-fs charm first. At the time of this writing only the NFS charm will work,
 
229
but as more shared-fs charms come out (gluster, ceph, etc) that provide a
 
230
shared-fs/mount interface those should all work as well. In this example we'll
 
231
use NFS:
179
232
 
180
233
    juju deploy nfs
181
234
    juju add-relation nfs wordpress:nfs
182
235
 
183
 
By doing so, everything in the wp-contents directory is moved to this NFS mount and then shared to all future WordPress units. It's strongly
184
 
recommended that you first deploy the nfs mount, _then_ scale WordPress out. Failure to do so may result in data loss. Once nfs is deployed, 
185
 
running, and related you can scale out the WordPress unit using the following command:
 
236
By doing so, everything in the wp-contents directory is moved to this NFS mount
 
237
and then shared to all future WordPress units. It's strongly recommended that
 
238
you first deploy the nfs mount, _then_ scale WordPress out. Failure to do so may
 
239
result in data loss. Once nfs is deployed, running, and related you can scale
 
240
out the WordPress unit using the following command:
186
241
 
187
242
    juju add-unit wordpress
188
243
    
189
 
In the event you want more than one unit at a time (and do not wish to run the add-unit command multiple times) you can supply a `-n` number
190
 
of units to add, so to add three more units:
 
244
In the event you want more than one unit at a time (and do not wish to run the
 
245
add-unit command multiple times) you can supply a `-n` number of units to add,
 
246
so to add three more units:
191
247
 
192
248
    juju add-unit -n3 wordpress
193
249
 
 
250
## Memcached Issues
 
251
 
 
252
In order to have a working relation with memcached, you need to first set up
 
253
your Wordpress blog, by creating your first user. If you try to relate
 
254
memcached before, you will get a `cache-relation-changed` error on your
 
255
instance.
 
256
 
194
257
# Contact Information
195
258
 
196
259
## WordPress Contact Information
197
260
 
198
261
- [WordPress Homepage](http://www.wordpress.org)
199
 
- [Reporting bugs](http://codex.wordpress.org/Reporting_Bugs) on WordPress itself
 
 
b'\\ No newline at end of file'
 
262
- [Reporting bugs](http://codex.wordpress.org/Reporting_Bugs) on WordPress
 
263
itself