/[drupal]/contributions/modules/cdn/README.txt
ViewVC logotype

Contents of /contributions/modules/cdn/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (hide annotations) (download)
Sun Jan 27 14:21:47 2008 UTC (22 months ago) by wimleers
Branch: MAIN
CVS Tags: DRUPAL-5--1-0-RC1, DRUPAL-5--1-0-RC2, DRUPAL-5--1-0
Changes since 1.15: +4 -10 lines
File MIME type: text/plain
- Minor improvement in the cdn_log() function.
- Updated the example configuration.
1 wimleers 1.16 // $Id: README.txt,v 1.15 2008/01/22 11:57:28 wimleers Exp $
2 wimleers 1.6
3     Description
4     -----------
5     The aim of this module to provide easy Content Delivery Network integration
6     for Drupal sites. Obviously it has to patch Drupal core to rewrite the URLs,
7     not only to serve them from another domain, but also to make the filenames
8     unique.
9    
10     It has synchronization plugins, so it allows you to use any protocol or
11     algorithm to synchronize your files. Currently however, only one plugin is
12     available: FTP. Since proper usage of a CDN demands unique filenames for each
13     version of a file, we can optimize a lot: to validate a file on the CDN while
14     synchronizing, we must only know if it 1) exists and 2) has the correct size.
15    
16     Which files and directories should be synchronized can be configured very
17     precisely. Consult the README for details about that.
18    
19     The FTP synchronization plugin allows you to use a $15 per month CDN (thus
20 wimleers 1.9 making CDNs accessible to /a lot/ of Drupal users) with no effort after the
21 wimleers 1.6 installation!
22     For those who know of the infamous YSlow test: if you install and configure
23     this module and apply the core patch that also adds Javascript aggregation,
24     you will score 98. Almost the maximum! The remainder of points is due to the
25     lack Javascript minification (compression).
26    
27     This module was developed for http://driverpacks.net/.
28    
29    
30 wimleers 1.7 Aren't CDN's so expensive only big companies can afford them?
31     -------------------------------------------------------------
32     Not anymore (in order of best price-value ratio):
33    
34     1) CacheFly, http://cachefly.com/, starts at USD 15 for 30 GB per month
35    
36     2) Influxis, http://influxis.com/, starts at USD 10 for 1 GB per month
37    
38    
39 wimleers 1.6 Installation
40     ------------
41     1) Place this module in your modules directory (this will usually be
42     "sites/all/modules/").
43    
44     2) Enable the module.
45    
46     3) Apply the Drupal core patch. See below.
47    
48     4) Apply the theme patch to every theme. See below.
49    
50     5) Read how to configure the CDN synchronization filters. See below.
51    
52     6) Configure the $conf array in settings.php See below.
53    
54     7) Copy cdn_cron.php to your Drupal root directory.
55    
56     8) Configure cdn_cron.php like Drupal's cron.php. See http://drupal.org/cron.
57    
58     9) Go to admin/logs/status. If the CDN integration module is installed
59     correctly or not, it will report so here.
60    
61    
62     Usage
63     -----
64     When the module is installed properly (see step 9 of the installation), you
65     can check the site-wide statistics at admin/settings/cdn. At that same page,
66     you can enable the per-page statistics as well. This will show the number of
67     files served from the CDN at the bottom of each page, as well as a list of
68     files that haven't been synchronized to the CDN yet, to users with the
69     "administer site configuration" permission.
70    
71 wimleers 1.1
72     Applying the Drupal core patch
73     ------------------------------
74 wimleers 1.8 You *must* apply this patch! It has been created against Drupal 5.5.
75 wimleers 1.1
76     First, change the directory to the Drupal root directory.
77    
78     You can apply the included Drupal core patch like this:
79 wimleers 1.15 patch -p0 < d5_file_url_rewrite.patch
80 wimleers 1.1
81     To undo the patch:
82 wimleers 1.15 patch -p0 -R < d5_file_url_rewrite.patch
83 wimleers 1.1
84 wimleers 1.5 Note: there is also a patch that combines the CDN integration core patch with
85     the JS aggregation. It's included in this module because if you apply both
86 wimleers 1.15 patches separately, you will get a conflict. This patch also sets the default
87     location for drupal.js and jquery.js to the footer of the page, and defaults
88     calls to drupal_add_js() to the footer as well.
89 wimleers 1.5
90 wimleers 1.1
91     Applying the theme patch
92     ------------------------
93     You *must* apply this patch to *every* theme that's being used on your website!
94    
95     Repeat this process for every theme: first, change the directory to the
96     directory of the theme. Applying the patch is identical to the example above,
97     only with a different filename.
98    
99    
100 wimleers 1.6 Setting up CDN synchronization filters
101     --------------------------------------
102     First of all: each filter works *recursively*! Now, the explanations:
103 wimleers 1.2 - paths: This is an array of paths (each path being relative to the Drupal
104     root directory) on which this filter should be applied.
105 wimleers 1.6 - pattern: Regular expression that will be used to filter the files in each
106 wimleers 1.2 directory. Like the $mask parameter in file_scan_directory().
107 wimleers 1.6 - ignored_dirs: Array of directories that should be ignored in each directory.
108     Like the $nomask parameter in file_scan_directory().
109 wimleers 1.2 - unique: Determines how the uniqueness will be applied. You can set it to
110     'filename', which will alter the filename, or 'common parent
111     directory', which will alter the path of the file. The latter is
112     strongly recommended for themes, since it will not break URLs in
113     CSS files.
114     - unique_method: The method that should be used to generate unique filenames.
115 wimleers 1.12 Currently supported: 'none' (no unique filename!), 'mtime'
116     (the file's mtime property), 'md5' (md5 hash of the file) or
117     'md5 of mtimes' (md5 hash of the concatenated mtimes of a set
118     of files). This last option is only available if you have set
119     the unique property to 'common parent directory'.
120 wimleers 1.2
121    
122 wimleers 1.1 Configuring the $conf array in settings.php
123     -------------------------------------------
124 wimleers 1.2 This is my configuration:
125 wimleers 1.1
126     $conf = array(
127 wimleers 1.15 // CDN integration module settings.
128 wimleers 1.2 'cdn_url' => 'http://wimleers.cachefly.com/wimleers.com',
129 wimleers 1.1 'cdn_sync_filters' => array(
130 wimleers 1.6 // Add all Javascript, CSS, image and flash files from the most common
131     // directories in Drupal.
132 wimleers 1.2 0 => array(
133     'paths' => array('misc', 'profiles', 'modules', 'sites/all/modules', 'sites/default/modules'),
134 wimleers 1.12 'pattern' => '.*\.(ico|js|css|gif|png|jpg|jpeg|svg|swf)$',
135 wimleers 1.3 'ignored_dirs' => array('CVS'),
136 wimleers 1.2 'unique' => 'filename',
137     'unique_method' => 'mtime',
138     ),
139 wimleers 1.6
140     // We want to add *everything* in the files directory. Except for the
141 wimleers 1.13 // files in the CSS and JS directory, because they need other treatment:
142     // we assume that files in this directory don't change, so we can use
143     // non-unique filenames, resulting in nicer filenames when they're
144     // downloaded.
145 wimleers 1.2 1 => array(
146     'paths' => array('sites/wimleers.com/files'),
147     'pattern' => '.*',
148 wimleers 1.13 'ignored_dirs' => array('CVS', 'css', 'js'),
149     'unique_method' => 'none',
150     ),
151    
152     // Add all files in the files/css directory, *but* update the URLs in the
153     // files. This is only necessary if we use CSS aggregation.
154     2 => array(
155     'paths' => array('sites/wimleers.com/files/css'),
156     'pattern' => '.*',
157     'ignored_dirs' => array('CVS'),
158     'unique' => 'filename',
159     'unique_method' => 'mtime',
160     'update_urls_in_files' => TRUE,
161     ),
162    
163 wimleers 1.16 // Add all files in the files/js directory, *but* update the URLs in the
164     // files. This is only necessary if we use JS aggregation.
165 wimleers 1.13 3 => array(
166     'paths' => array('sites/wimleers.com/files/js'),
167     'pattern' => '.*',
168     'ignored_dirs' => array('CVS'),
169     'unique' => 'filename',
170     'unique_method' => 'mtime',
171 wimleers 1.16 'update_urls_in_files' => TRUE,
172 wimleers 1.2 ),
173 wimleers 1.6
174     // Add all Javascript, CSS, image and font files from our themes. But
175     // make sure the URLs don't break when CSS aggregation is disabled, by
176     // using the "common parent directory" unique level and the "md5 of mtimes"
177     // uniqueness method. We can revert to normal values if we have CSS
178     // aggregation enabled.
179 wimleers 1.13 4 => array(
180 wimleers 1.2 'paths' => array('sites/default/themes/garland-customized'),
181 wimleers 1.10 'pattern' => '.*\.(js|css|gif|png|jpg|jpeg|otf)$', // We *include* css files, because some (e.g. fix-ie.css) are not included in the aggregation.
182 wimleers 1.3 'ignored_dirs' => array('CVS'),
183 wimleers 1.2 'unique' => 'common parent directory',
184     'unique_method' => 'md5 of mtimes',
185     ),
186 wimleers 1.1 ),
187     'cdn_sync_method' => 'ftp',
188     'cdn_sync_method_settings' => array(
189     'host' => 'ftp.cachefly.com',
190 wimleers 1.2 'remote_path' => 'wimleers.com',
191 wimleers 1.1 'port' => 21,
192     'user' => 'user',
193     'pass' => 'pass',
194     ),
195     );
196 wimleers 1.6
197    
198     Author
199     ------
200     Wim Leers
201    
202     * mail: work@wimleers.com
203     * website: http://wimleers.com/work
204    
205     The author can be contacted for paid customizations of this module as well as
206     Drupal consulting, development and installation.

  ViewVC Help
Powered by ViewVC 1.1.2