~jamesbeedy/charms/trusty/wordpress/apache2_trusty_fix

51.1.71 by Marco Ceppi
Added the Readme makrdown file
1
# Overview
2
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
51.1.71 by Marco Ceppi
Added the Readme makrdown file
6
72 by Jorge O. Castro
README and Metadata audit updates.
7
# Usage
51.1.71 by Marco Ceppi
Added the Readme makrdown file
8
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
51.1.71 by Marco Ceppi
Added the Readme makrdown file
14
15
Once bootstrapped, deploy the MySQL charm then this WordPress charm:
16
17
    juju deploy mysql
18
    juju deploy wordpress
19
20
Add a relation between the two of them
21
22
    juju add-relation wordpress mysql
23
24
Expose the WordPress installation
25
26
    juju expose wordpress
27
72 by Jorge O. Castro
README and Metadata audit updates.
28
## Scaled Down Usage for Personal Use
29
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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: 
72 by Jorge O. Castro
README and Metadata audit updates.
33
34
    juju bootstrap
35
    juju deploy --to 0 wordpress
36
    juju deploy --to 0 mysql
37
    juju add-relation wordpress mysql 
38
    juju expose wordpress
39
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
72 by Jorge O. Castro
README and Metadata audit updates.
42
43
    juju add-unit wordpress
44
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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. 
72 by Jorge O. Castro
README and Metadata audit updates.
48
49
# Scale Out Usage 
50
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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).
72 by Jorge O. Castro
README and Metadata audit updates.
60
61
    juju deploy memcached
62
    juju add-relation memcached wordpress
63
    
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
64
This setup will also synchronize the flushing of cache across all WordPress
65
nodes, making it ideal to avoid stale caches.
72 by Jorge O. Castro
README and Metadata audit updates.
66
72.2.3 by José Antonio Rey
Added note for memcached relation on README.md
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
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
72 by Jorge O. Castro
README and Metadata audit updates.
76
51.1.71 by Marco Ceppi
Added the Readme makrdown file
77
# Configuration
78
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
79
This WordPress charm comes with several tuning levels designed to encompass the
80
different styles in which this charm will be used.
51.1.96 by Marco Ceppi
Allow users to specify a location for wp-content + extra wordpress files
81
51.1.71 by Marco Ceppi
Added the Readme makrdown file
82
A use case for each tuning style is outlined below:
83
72 by Jorge O. Castro
README and Metadata audit updates.
84
## Bare
51.1.71 by Marco Ceppi
Added the Readme makrdown file
85
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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).
51.1.72 by Marco Ceppi
Updated readme
93
94
To run this WordPress charm under a bare tuning level execute the following:
95
51.1.73 by Marco Ceppi
Updated tuning 'level'
96
    juju set wordpress tuning=bare
51.1.71 by Marco Ceppi
Added the Readme makrdown file
97
72 by Jorge O. Castro
README and Metadata audit updates.
98
## Single
51.1.71 by Marco Ceppi
Added the Readme makrdown file
99
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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. 
51.1.71 by Marco Ceppi
Added the Readme makrdown file
108
51.1.72 by Marco Ceppi
Updated readme
109
To run this WordPress charm under a single tuning level execute the following:
110
51.1.73 by Marco Ceppi
Updated tuning 'level'
111
    juju set wordpress tuning=single
51.1.72 by Marco Ceppi
Updated readme
112
72 by Jorge O. Castro
README and Metadata audit updates.
113
## Optimized
51.1.71 by Marco Ceppi
Added the Readme makrdown file
114
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
51.1.71 by Marco Ceppi
Added the Readme makrdown file
124
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
125
To run this WordPress charm under an optimized tuning level execute the
126
following:
51.1.72 by Marco Ceppi
Updated readme
127
51.1.73 by Marco Ceppi
Updated tuning 'level'
128
    juju set wordpress tuning=optimized
51.1.71 by Marco Ceppi
Added the Readme makrdown file
129
72 by Jorge O. Castro
README and Metadata audit updates.
130
### Handling wp-content
51.1.96 by Marco Ceppi
Allow users to specify a location for wp-content + extra wordpress files
131
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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 
51.1.96 by Marco Ceppi
Allow users to specify a location for wp-content + extra wordpress files
138
respective names:
139
140
    juju set wordpress wp-content=git@host:path/repo.git
141
142
or
143
144
    juju set wordpress wp-content=http://host/path/repo.git
145
    
146
or
147
148
    juju set wordpress wp-content=git://host/path/repo.git
149
    
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
51.1.96 by Marco Ceppi
Allow users to specify a location for wp-content + extra wordpress files
153
154
For LaunchPad hosted repostiories:
155
156
    juju set wordpress wp-content=lp:~username/path/repo
157
    
158
For other Bzr repositories:
159
160
    juju set wordpress wp-content=bzr://host/path/repo
161
162
or
163
164
    juju set wordpress wp-content=bzr+ssh://host/path/repo
165
    
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
51.1.96 by Marco Ceppi
Allow users to specify a location for wp-content + extra wordpress files
169
51.1.97 by Marco Ceppi
Added debugging information
170
## debug
171
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
51.1.97 by Marco Ceppi
Added debugging information
180
181
    juju set wordpress debug=yes
182
55.1.1 by Marco Ceppi
Memcache support
183
to disable debugging:
51.1.97 by Marco Ceppi
Added debugging information
184
185
    juju set wordpress debug=no
186
55.1.1 by Marco Ceppi
Memcache support
187
The debugging is disabled by default.
51.1.97 by Marco Ceppi
Added debugging information
188
60.1.6 by Marco Ceppi
Final changes to make apache2 switches work properly in the charm
189
## Engine
190
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
60.1.6 by Marco Ceppi
Final changes to make apache2 switches work properly in the charm
200
201
    juju set wordpress engine=apache2
202
203
Then back to nginx:
204
205
    juju set wordpress engine=nginx
206
207
Any other value will result in the default (nginx) being used.
208
72 by Jorge O. Castro
README and Metadata audit updates.
209
# Known Limitations and Issues
51.1.71 by Marco Ceppi
Added the Readme makrdown file
210
72 by Jorge O. Castro
README and Metadata audit updates.
211
## HP Cloud 
55.1.4 by Marco Ceppi
Added warning about HP Cloud standard.xsmall
212
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
55.1.4 by Marco Ceppi
Added warning about HP Cloud standard.xsmall
216
217
    juju deploy --constraints "instance-type=standard.small" wordpress
218
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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.
55.1.4 by Marco Ceppi
Added warning about HP Cloud standard.xsmall
222
51.1.79 by Marco Ceppi
Updated Readme with more goodness
223
## Single mode and the scale-out
224
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
51.1.79 by Marco Ceppi
Updated Readme with more goodness
232
233
    juju deploy nfs
51.1.90 by Marco Ceppi
Fixed typo in readme
234
    juju add-relation nfs wordpress:nfs
51.1.79 by Marco Ceppi
Updated Readme with more goodness
235
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
51.1.79 by Marco Ceppi
Updated Readme with more goodness
241
242
    juju add-unit wordpress
243
    
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
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:
51.1.79 by Marco Ceppi
Updated Readme with more goodness
247
51.1.80 by Marco Ceppi
Minor grammar updates
248
    juju add-unit -n3 wordpress
55.1.1 by Marco Ceppi
Memcache support
249
72.2.4 by José Antonio Rey
Added note on README.md for memcached relation
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
72 by Jorge O. Castro
README and Metadata audit updates.
257
# Contact Information
258
259
## WordPress Contact Information
260
261
- [WordPress Homepage](http://www.wordpress.org)
72.2.2 by José Antonio Rey
Fixed 80 line wrapping on README.md
262
- [Reporting bugs](http://codex.wordpress.org/Reporting_Bugs) on WordPress
263
itself