1
|
# CDM Data Portal
|
2
|
|
3
|
Drupal 7 modules and themes as web frontend to publish data hosted in a [cdm server](https://github.com/cybertaxonomy/cdm-server).
|
4
|
|
5
|
This project has a monolithic structure, that is it contains multiple projects in one git repository.
|
6
|
|
7
|
Project dependencies required for bundling the final installation package are managed via composer.
|
8
|
Dependencies of sub-projects like *modules/cdm_dataportal*, *themes/zen_dataportal*, etc still have manually copied dependencies.
|
9
|
|
10
|
Information on setting up the development environment are found in [](DEVELOPER.md)
|
11
|
|
12
|
## Project structure
|
13
|
|
14
|
* `./drush`: commands, configuration and site aliases for Drush
|
15
|
* `./debug`: scripts that help debugging problems with drupal multisite setups
|
16
|
* `./modules`: drupal modules, the actual **cdm_dataportal** module is found here.
|
17
|
* `./scripts/composer`: scripts, installed by composer and manually added ones
|
18
|
* `./scripts/jenkins-ci`: scripts for testing, release, deployment in jenkins.
|
19
|
* `./site`: documentation source code, will be build by maven (see `pom.xml`)
|
20
|
* `./src`: java project with selenium tests
|
21
|
* `./themes`: drupal themes
|
22
|
|
23
|
**Generated folders which must not be comitted to the repository:**
|
24
|
|
25
|
* `./target`: target folder of maven, used for the side documentation (source in `./site`) and selenium tests (source in `./src`)
|
26
|
* `./screenshots`: screenshots taken during the selenium test execution
|
27
|
* `./vendor`: composer cache
|
28
|
* `./web`: final installation bundle of drupal 7 with modules, themes, profiles, etc. that is created by `composer update`
|
29
|
|
30
|
**Creation of the composer project**
|
31
|
|
32
|
The parent composer project (`./composer.json`) has been created using the official drupal project template:
|
33
|
|
34
|
~~~
|
35
|
composer create-project drupal-composer/drupal-project:7.x-dev -n dist
|
36
|
~~~
|
37
|
|
38
|
### On using composer with drupal projects
|
39
|
|
40
|
https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-and-manage-dependencies
|
41
|
|
42
|
https://www.drupal.org/docs/develop/using-composer/using-composer-with-drupal
|
43
|
|
44
|
https://www.drupal.org/docs/develop/using-composer/managing-dependencies-for-a-custom-project
|
45
|
|
46
|
### Installation
|
47
|
|
48
|
**NOTE:** For detailed instructions which also cover the setup of apache and mysql please refer
|
49
|
to: https://cybertaxonomy.eu/dataportal/installation
|
50
|
|
51
|
#### Requirements
|
52
|
|
53
|
* mysql (v5.x) or MariaDB (v10.0 to v10.3) server
|
54
|
* http server: apache or nginx; in this guide we will only cover the configuration of apache 2 (v 2.4)
|
55
|
* php 7, or php 5.6+ if php 7.x is not yet available for your system. php 8 will not work!
|
56
|
|
57
|
|
58
|
##### php
|
59
|
|
60
|
Install php 7.4 or 7.2 with the following extensions:
|
61
|
|
62
|
~~~
|
63
|
export PHP_VERSION=7.4 ; apt-get install php$PHP_VERSION php$PHP_VERSION-mysql php$PHP_VERSION-gd php$PHP_VERSION-json php$PHP_VERSION-curl php$PHP_VERSION-xml libapache2-mod-php$PHP_VERSION
|
64
|
~~~
|
65
|
|
66
|
For running the CDM Data Portal it is required to assign sufficient memory to php.
|
67
|
Please open your `/etc/php/7.4/apache2/php.ini` and set the `memory_limit` parameter (memory_limit) to at least `128M`.
|
68
|
The php.ini responsible for the php processes executed in apache is found in current Debian Linux and derivatives at
|
69
|
`/etc/php/7.4/apache2/php.ini` or `/etc/php/7.2/apache2/php.ini` .
|
70
|
|
71
|
~~~
|
72
|
;;;;;;;;;;;;;;;;;;;
|
73
|
; Resource Limits ;
|
74
|
;;;;;;;;;;;;;;;;;;;
|
75
|
memory_limit = 128M ; Maximum amount of memory a script may consume (128MB)
|
76
|
~~~
|
77
|
|
78
|
##### Git
|
79
|
|
80
|
Git is needed for downloading (cloning) the CDM Dataportal Drupal 7 installation package and to keep it up-to-date.
|
81
|
|
82
|
~~~
|
83
|
sudo apt-get install git
|
84
|
~~~
|
85
|
|
86
|
#### Download & extract
|
87
|
|
88
|
Download the latest release from https://cybertaxonomy.eu/download/dataportal/stable/ to the location where you want
|
89
|
to install the cdm-dataportal Drupal 7 project e.g.
|
90
|
|
91
|
~~~
|
92
|
cd /var/www
|
93
|
wget https://cybertaxonomy.eu/download/dataportal/stable/drupal-7-cdm-dataportal-5.23.0.tar.gz
|
94
|
~~~
|
95
|
|
96
|
This archive contains a shallow clone of the whole project together with a ready to use drupal 7 installation with the
|
97
|
cdm-dataportal module, zen_dataportal theme and other requirements. The drupal-7 installation is in the sub folder `./web`
|
98
|
|
99
|
extract and adapt the ownership of the some folders:
|
100
|
|
101
|
~~~
|
102
|
tar -xzf drupal-7-cdm-dataportal-5.23.0.tar.gz
|
103
|
./drupal-7-cdm-dataportal/scripts/admin/fix-permissions.sh --web-user www-data
|
104
|
~~~
|
105
|
|
106
|
##### Apache2 configuration
|
107
|
|
108
|
Install required modules
|
109
|
|
110
|
~~~
|
111
|
sudo a2enmod headers
|
112
|
sudo a2enmod ssl
|
113
|
sudo a2enmod rewrite
|
114
|
~~~
|
115
|
|
116
|
|
117
|
You may now want to copy the apache 2 site configuration files from `scripts/apache2.4/` to `/etc/apache2/sites-available/`
|
118
|
and to activate one of them, preferably the ssl site configuration:
|
119
|
|
120
|
~~~
|
121
|
cd /var/www
|
122
|
sudo cp drupal-7-cdm-dataportal/scripts/apache2.4/dataportal.test* /etc/apache2/sites-available/
|
123
|
sudo a2ensite dataportal.test-ssl.conf
|
124
|
sudo a2ensite dataportal.test.conf
|
125
|
sudo systemctl restart apache2
|
126
|
~~~
|
127
|
|
128
|
You may now want to add the hostname to the `/etc/hosts` file:
|
129
|
|
130
|
~~~
|
131
|
echo "127.0.0.1 dataportal.test" | sudo tee -a /etc/hosts
|
132
|
~~~
|
133
|
|
134
|
**NOTE**: The virtual host `dataportal.test` is only suitable for development purposes.
|
135
|
For production systems you will need to rename the virtual host so that it matches a public host name.
|
136
|
|
137
|
Site installation
|
138
|
|
139
|
Now you are prepared to install a dataportal drupal site.
|
140
|
|
141
|
A template for the below script can be found in `scripts/user/`
|
142
|
Make an executable copy from `new-site.sh.template` as `new-site.sh`
|
143
|
|
144
|
~~~
|
145
|
cp new-site.sh.template new-site.sh; chmod u+x new-site.sh
|
146
|
~~~
|
147
|
|
148
|
Adapt the below shown variables in the script to match your desired setup:
|
149
|
|
150
|
~~~
|
151
|
################################################################
|
152
|
## Configure below variables
|
153
|
|
154
|
SITE_NAME='test-site'
|
155
|
|
156
|
# HOST_NAME and PROTOCOL determine the base URL of the new site
|
157
|
# The default values will form the base URL like http://dataportal.test
|
158
|
# See also MULTI_SITE below
|
159
|
HOST_NAME='dataportal.test'
|
160
|
PROTOCOL='https' # values 'http' ot https'
|
161
|
# For MULTI_SITE=0 the site will be installed at the base BASE_URL
|
162
|
# In multisite setups (MULTI_SITE=1), however, the site URL results
|
163
|
# in http://dataportal.test/test-site
|
164
|
# !! Mutisite support ist still experimental !!
|
165
|
MULTI_SITE=0 # values: 1 = true, 0 or other = false
|
166
|
|
167
|
ADMIN_USR='admin'
|
168
|
ADMIN_PWD='change--me'
|
169
|
ADMIN_EMAIL='admin@dataportal.test'
|
170
|
|
171
|
MYSQL_USR='root'
|
172
|
MYSQL_PWD='change--me'
|
173
|
DB_PREFIX='drupal7_dataportal_'
|
174
|
|
175
|
|
176
|
################################################################
|
177
|
~~~
|
178
|
|
179
|
Execute the script **from within the folder** `scripts/user/`, otherwise the `$DRUPAL_ROOT` variable will not match the `./web` folder !
|
180
|
|
181
|
Once the script has fished it will print out the final URL of the new site together with other useful information.
|
182
|
|
183
|
### Update - method 1
|
184
|
|
185
|
**Strategy**: Downloading of the installation package for a new release of the cdm-dataportal and replacing the old
|
186
|
installation by the content of the installation package.
|
187
|
|
188
|
* Pro: Few simple steps.
|
189
|
* Con: The steps described here are not suitable for multi-site installation or when additional modules are installed.
|
190
|
|
191
|
~~~
|
192
|
cd /var/www
|
193
|
mv drupal-7-cdm-dataportal drupal-7-cdm-dataportal.last
|
194
|
~~~
|
195
|
|
196
|
remove old installation packages
|
197
|
|
198
|
~~~
|
199
|
rm drupal-7-cdm-dataportal*.tar.gz*
|
200
|
~~~
|
201
|
|
202
|
now follow the steps in the chapter **Download & extract** above.
|
203
|
|
204
|
finally copy the default site to the new installation
|
205
|
|
206
|
~~~
|
207
|
cp -r drupal-7-cdm-dataportal.last/web/sites/default/ drupal-7-cdm-dataportal/web/sites/
|
208
|
~~~
|
209
|
|
210
|
apply any pending database updates
|
211
|
|
212
|
~~~
|
213
|
drush updatedb
|
214
|
drush cc all
|
215
|
~~~
|
216
|
|
217
|
Once you have confirmed that the updated installation is working correctly:
|
218
|
|
219
|
~~~
|
220
|
rm -r drupal-7-cdm-dataportal.last
|
221
|
~~~
|
222
|
|
223
|
### Update - method 2
|
224
|
|
225
|
**Strategy**: In-place updating of the installation by making use of git and drush or composer.
|
226
|
|
227
|
*THIS METHOD IS RECOMMENDED FOR MOST SITUATIONS**
|
228
|
|
229
|
* Pro: Update of drupal and custom modules independent of what is provided by the installation package.
|
230
|
* Con: Initial preparation is more complex,
|
231
|
|
232
|
#### Preparation
|
233
|
|
234
|
**Install composer v 1.10.x**
|
235
|
|
236
|
!!! *Composer v2.x would fail to preserve existing site installations* !!!
|
237
|
|
238
|
In case the version provided by apt is too old (<1.10), you can install composer manually in the project
|
239
|
directory `/var/www/drupal-7-cdm-dataportal`. In the following we assume you have installed composer this way and
|
240
|
will use `./composer` instead of `composer`.
|
241
|
|
242
|
~~~
|
243
|
cd /var/www/drupal-7-cdm-dataportal
|
244
|
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
245
|
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
|
246
|
php composer-setup.php --filename=composer --version 1.10.22
|
247
|
php -r "unlink('composer-setup.php');"
|
248
|
~~~
|
249
|
|
250
|
The above commands fails with "Installer corrupt"? Please update the corresponding command with the new one from [http//getcomposer.org/download/](http//getcomposer.org/download/). It is **important not use use a version > 1.*!**
|
251
|
|
252
|
**Un-shallow the installation package**
|
253
|
|
254
|
The installation package contains a shallow clone of the git repository only. In order to easily upgrade the
|
255
|
dataportal-module it is highly recommended to un-shallow the git repository clone
|
256
|
|
257
|
~~~
|
258
|
git fetch --unshallow
|
259
|
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
260
|
git fetch origin
|
261
|
git checkout origin/master
|
262
|
~~~
|
263
|
|
264
|
**install dependencies**
|
265
|
|
266
|
This will also install **drush**
|
267
|
|
268
|
~~~
|
269
|
./composer install --no-dev
|
270
|
~~~
|
271
|
|
272
|
#### Updating to a specific cdm-dataportal release
|
273
|
|
274
|
NOTE: The modules and themes in the `./web/sites/all/` are sym-linked to the source code in `./modules` and `./themes`.
|
275
|
Hence, updating the dataportal only involves checking out the according release from the git remote:
|
276
|
|
277
|
To see the list of available release tags:
|
278
|
|
279
|
~~~
|
280
|
git tag --list | egrep '[0-9]+\.[0-9]+\.[0-9]+' | sort -V
|
281
|
~~~
|
282
|
|
283
|
Checkout the release tag. For example to checkout the release `5.23.0`:
|
284
|
|
285
|
~~~
|
286
|
git checkout 5.23.0
|
287
|
scripts/admin/fix-permissions --web-user www-data
|
288
|
~~~
|
289
|
|
290
|
Git will respond with a warning that "*You are in 'detached HEAD' state.*", this is OK and no need to be concerned.
|
291
|
|
292
|
Finally apply any pending database updates and clear the cache. **NOTE**: Below we assume that the command is being
|
293
|
executed in the installation package root e.g. `/var/www/drupal-7-cdm-dataportal` and that the site is available under
|
294
|
https://dataportal.test. Please adapt to your specific settings if needed.
|
295
|
|
296
|
~~~
|
297
|
./vendor/drush/drush/drush -r /var/www/drupal-7-cdm-dataportal/web/ -l https://dataportal.test updatedb
|
298
|
./vendor/drush/drush/drush -r /var/www/drupal-7-cdm-dataportal/web/ -l https://dataportal.test cc all
|
299
|
~~~
|
300
|
|
301
|
#### Updating drupal and modules
|
302
|
|
303
|
The drupal-7-cdm-dataportal installer provides a script for convenient and secure updating of single or multisite setups.
|
304
|
It will
|
305
|
|
306
|
1. create backups
|
307
|
1. set the site(s) to maintenance mode
|
308
|
1. Update drupal core and contributed modules via `composer`
|
309
|
1. Run any pending database updates and clear the caches
|
310
|
|
311
|
A brief help for this script is available from `scripts/admin/update-dependencies.sh --help`
|
312
|
|
313
|
~~~
|
314
|
USAGE: update-dependencies.sh [--deactivate-install] [--multi-site] [--mailto <ADDRESS>]
|
315
|
--deactivate-install : The install.php will be hidden by appending '.off' to the filename
|
316
|
-h, --help: Print this help text
|
317
|
--mailto <ADDRESS>: send a email to the ADDRESS with a log of the update process
|
318
|
--multi-site: Do a multi-site update. Requires dataportals-drush.
|
319
|
See https://dev.e-taxonomy.eu/svn/trunk/server-scripts/dataportal-admin/
|
320
|
--site-url: The site url to be used with drush. This option disables the --multi-site option
|
321
|
~~~
|
322
|
|
323
|
|
324
|
|
325
|
Update a single site installation with default site URL
|
326
|
|
327
|
~~~
|
328
|
scripts/admin/update-dependencies.sh --deactivate-install
|
329
|
~~~
|
330
|
|
331
|
Update a single site installation with custom site URL
|
332
|
|
333
|
~~~
|
334
|
scripts/admin/update-dependencies.sh --deactivate-install --site-url http://edit.test/d7/cichorieae/
|
335
|
~~~
|
336
|
|
337
|
Update a multi-site installation with custom site URL
|
338
|
|
339
|
~~~
|
340
|
scripts/admin/update-dependencies.sh --deactivate-install --multi-site
|
341
|
~~~
|