Drupal5Mirroring » History » Version 2
Lutz Suhrbier, 05/30/2008 02:45 PM
1 | 1 | Lutz Suhrbier | |
---|---|---|---|
2 | # Mirroring Drupal |
||
3 | 2 | Lutz Suhrbier | |
4 | |||
5 | This article describe the installation of a [Shibboleth protected mirror":https://sp.e-taxonomy.eu/expertsdb/ of the current "EDIT Drupal installation](http://dev.e-taxonomy.eu/expertsdb) for the [[ExpertsDatabase]] Web Application. The aim is to demonstrate the current state of the single sign-on integration into Drupal applications. |
||
6 | |||
7 | |||
8 | Both Drupal instances are running against the same [[MySQL]] database, while user authentication is handled indepently. |
||
9 | |||
10 | |||
11 | |||
12 | ## Installing Drupal |
||
13 | |||
14 | |||
15 | Drupal bases on PHP5, and we are running Drupal on a [[MySQL]] database. So, we need to install PHP5 and the [[MySQL]] module for PHP5 first. |
||
16 | |||
17 | ~~~ |
||
18 | apt-get install php5 php5-mysql |
||
19 | ~~~ |
||
20 | |||
21 | We are using Drupal 5, so we downloaded the last recent version of Drupal 5 and extract the archive to the directory _/var/www_ |
||
22 | |||
23 | ~~~ |
||
24 | wget http://ftp.drupal.org/files/projects/drupal-5.7.tar.gz |
||
25 | tar xvfz drupal-5.7.tar.gz -C /var/www |
||
26 | ~~~ |
||
27 | |||
28 | |||
29 | ## Configuring Drupal |
||
30 | |||
31 | |||
32 | Since, we want to mirror the ExpertsDB application, we start to create a subdirectory of the same name within Drupals _sites_ directory. |
||
33 | |||
34 | ~~~ |
||
35 | mkdir -p /var/www/drupal-5.7/sites/expertsdb |
||
36 | ~~~ |
||
37 | |||
38 | Next, the configuration file _settings.php_ from the master installation should be copied into that directory and adapted to the mirror's environment,if necessary. |
||
39 | |||
40 | In this special configuration, we introduced two modifications. First, we adapted the database access configuration within the variable _db_url_: |
||
41 | |||
42 | ~~~ |
||
43 | $db_url = 'mysql://drupal:secret@<ext_db_ip>/drupal5_expertdb'; |
||
44 | ~~~ |
||
45 | Next, a special database table (+sp_expertdb+) was introduced backing up potential specific configurations beside the mirror installation on _sp.e-taxonomy.eu_. This has to be configured within the _db_prefix_ variable. |
||
46 | |||
47 | ~~~ |
||
48 | $db_prefix = array( |
||
49 | 'default' => 'expertdb_', |
||
50 | 'users' => '_shared_', |
||
51 | 'sessions' => '_shared_', |
||
52 | 'sequences' => '_shared_', |
||
53 | ''' 'system' => '_sp_expertdb_' ''' |
||
54 | ); |
||
55 | ~~~ |
||
56 | |||
57 | |||
58 | ### Installing Drupal Modules |
||
59 | |||
60 | The mirror site should run with the same modules as the master site. So, they need to be installed on the mirror site too. Modules can be downloaded from this URL http://ftp.drupal.org/files/projects. The file name of a given module and version can built along the pattern _${moduleName}-${moduleVersion}.tar.gz_. For instance, the full URL to retrieve version _5.x-1.2_ of the module _addnode_ equals to http://ftp.drupal.org/files/projects/addnode-5.x-1.2.tar.gz. |
||
61 | |||
62 | |||
63 | After having downloaded the required module archive, they should be extracted into the _sites/all/modules_ directory of the Drupal installation. This is the general location to install the Drupal modules to. Modules installed there, can be used by any site configured in Drupal. Only special module requirement should be met by installing these modules into the _modules_ subdirectory the specific site (e.g. _sites/expertsdb/modules_) |
||
64 | |||
65 | ~~~ |
||
66 | wget http://ftp.drupal.org/files/projects/addnode-5.x-1.2.tar.gz |
||
67 | tar xvfz addnode-5.x-1.2.tar.gz -C /var/www/drupal-5.7/sites/all/modules |
||
68 | ~~~ |
||
69 | |||
70 | This is a list of the currently installed module versions |
||
71 | |||
72 | | **Module** | **Version** | |
||
73 | | | | |
||
74 | | addnode | 5.x-1.2 | |
||
75 | | admin_menu | 5.x-2.2 | |
||
76 | | auto_nodetitle | 5.x-1.0 | |
||
77 | | cck | 5.x-1.6-1 | |
||
78 | | cck_field_perms | 5.x-1.10 | |
||
79 | | computed_field | 5.x-1.2 | |
||
80 | | date | 5.x-1.6 | |
||
81 | | devel | 5.x-1.x-dev | |
||
82 | | fieldgroup | part of module cck | |
||
83 | | jstools | 5.x-0.6 | |
||
84 | | nodefamily | 5.x-1.3 | |
||
85 | | nodeprofile | 5.x-1.2 | |
||
86 | | subform_element | 5.x-1.3 | |
||
87 | | taxonomy_xml | 5.x-1.x-dev | |
||
88 | | token | 5.x-1.9 | |
||
89 | | usernode | 5.x-1.3 | |
||
90 | | views | 5.x-1.6 | |
||
91 | | views_fusion | 5.x-1.2 | |
||
92 | |||
93 | |||
94 | Some modules (e.g. _taxon_experts_) are currently implemented by EDIT developers. These modules have to be retrieved and installed directly from the following EDIT subversion respository path: http://dev.e-taxonomy.eu/svn/trunk/drupal/modules |
||
95 | |||
96 | ~~~ |
||
97 | svn checkout "http://dev.e-taxonomy.eu/svn/trunk/drupal/modules/taxon_experts" "/var/www.drupal-5.7/sites/all/modules/taxon_experts" |
||
98 | ~~~ |
||
99 | |||
100 | Here is a list of modules developed by EDIT. |
||
101 | |||
102 | | **Module** | **Version** | |
||
103 | | taxon_experts | | |
||
104 | | webserver_auth-modified | | |
||
105 | |||
106 | |||
107 | |||
108 | ### Patching Drupal Modules |
||
109 | |||
110 | Some of the Drupal modules used within EDIT have been adapted by EDIT developers. These patches can be retrieved from the following EDIT subversion respository path: http://dev.e-taxonomy.eu/svn/trunk/drupal/module-patches followed by the module name. |
||
111 | |||
112 | Within this directory, patch files should be named according the following pattern: _${moduleName}-${moduleVersion}.patch_. So, the most recent patch for version _5.x-1.10_ of module _cck_field_perms_ should be available under this URL: http://dev.e-taxonomy.eu/svn/trunk/drupal/module-patches/cck_field_perms/cck_field_perms-5.x-1.10.patch. |
||
113 | |||
114 | Furthermore, patches should be made avaible in a way that they are applicable within the module directory, i.e. without the need to strip of levels. If so, applying a patch to the _cck_field_perms_ module should be easily done running this commands: |
||
115 | |||
116 | ~~~ |
||
117 | svn checkout "http://dev.e-taxonomy.eu/svn/trunk/drupal/module-patches/cck_field_perms/cck_field_perms-5.x-1.10.patch" "/var/www/drupal-5.7/sites/all/modules" |
||
118 | patch -p0 -d "/var/www/drupal-5.7/sites/all/modules/cck_field_perms" -i "$cck_field_perms-5.x-1.10.patch" |
||
119 | ~~~ |
||
120 | |||
121 | Here is a list of module patches applied. |
||
122 | |||
123 | | **Module** | **Version** | |
||
124 | | cck_field_perms | 5.x-1.10 | |
||
125 | | nodefamily | 5.x-1.3 | |
||
126 | |||
127 | |||
128 | ## Install Drupal Themes |
||
129 | |||
130 | Next, the installed Drupal themes should be identical on both sites. So, get a copy of the necessary Drupal themes and copy them into the Drupal subdirectory _sites/all/themes_ to make them accessible for any Drupal sites. |
||
131 | |||
132 | ~~~ |
||
133 | tar xvfz themes.tgz -C /var/www/drupal-5.7/sites/all/themes |
||
134 | ~~~ |
||
135 | |||
136 | ## Install Drupal Files |
||
137 | |||
138 | The same applies to the Drupal files subdirectory, but you have to copy them to the Drupal subdirectory _files_. |
||
139 | |||
140 | ~~~ |
||
141 | tar xvfz files.tgz -C /var/www/drupal-5.7/files |
||
142 | ~~~ |
||
143 | |||
144 | |||
145 | ## Set ACLs |
||
146 | |||
147 | The Drupal installation should only be accessible by the user _www-data_ (Apache web server). So, change the owner of Drupal files like this: |
||
148 | |||
149 | ~~~ |
||
150 | chown -R www-data:www-data /var/www/drupal-5.7 |
||
151 | ~~~ |
||
152 | |||
153 | |||
154 | ## Configure Apache |
||
155 | |||
156 | For instance, it should be adequate to provide the Drupal installation as a site. To protect access to Drupal by a running [[ShibbolethSPInstallDebianEtch|Shibboleth SP installation]], the following file located in _/etc/apache2/sites-available/drupal_ should do the job |
||
157 | |||
158 | ~~~ |
||
159 | <Location /drupal-5.7> |
||
160 | AuthType shibboleth |
||
161 | ShibRequireSession On |
||
162 | require valid-user |
||
163 | </Location> |
||
164 | ~~~ |
||
165 | |||
166 | Don't forget to enable the drupal site in Apache. |
||
167 | |||
168 | ~~~ |
||
169 | a2ensite drupal |
||
170 | ~~~ |
||
171 | logStepStart "enable Drupal site in Apache" |
||
172 | |||
173 | |||
174 | |||
175 | ## Further refinements |
||
176 | |||
177 | By default, Drupal runs the site defined within the _sites/default_ subdirectory. If you like to be more flexible regarding the selection of the default site, use symbolic links. |
||
178 | |||
179 | ~~~ |
||
180 | rm -R /var/www/drupal-5.7/sites/default |
||
181 | ln -s /var/www/drupal-5.7/sites/expertsdb /var/www/drupal-5.7/sites/default |
||
182 | ~~~ |
||
183 | |||
184 | The same applies, if you want more flexibility regarding the Drupal version run by default. So, use symbolic links to determine the current Drupal version, and rename the access path within _/etc/apache2/sites-available/drupal_ from drupal-5.7 to e.g. _drupal_ or _expertsdb_. |
||
185 | |||
186 | ~~~ |
||
187 | ln -s /var/www/drupal-5.7 /var/www/drupal |
||
188 | ~~~ |
||
189 | and |
||
190 | |||
191 | ~~~ |
||
192 | <Location /drupal> |
||
193 | ... |
||
194 | </Location> |
||
195 | ~~~ |