DataPortalDeveloperEnvironmentSetupLinux » History » Revision 75
« Previous |
Revision 75/91
(diff)
| Next »
Patrick Plitzner, 09/13/2018 01:20 PM
Local dataportal development and test environment on Debian based Linux¶
- Table of contents
- Local dataportal development and test environment on Debian based Linux
- Xdebug
- Setup of PhpStorm
- Setup of the PDT project in eclipse
Install PHP packages¶
sudo apt-get install php libapache2-mod-php php-cli php-common php-curl php-gd php-mcrypt php-mysql php-xdebug php-json php-xml php-mbstring
copy edit.test.conf to /etc/apache2/sites-available/
open /etc/apache2/sites-available/edit.test.conf
and replace all {USER_NAME}
with the output of echo ~/
add the following line to /etc/hosts
127.0.0.1 edit.test
create the workspace folder
mkdir ~/workspaces/www/
enable the test vhost:
sudo chown root:root /etc/apache2/sites-available/edit.test.conf sudo a2enmod rewrite sudo a2ensite edit.test.conf sudo systemctl restart apache2.service
Check if php is working:
Copy info.php in the http root (e.g. ~/workspaces/www/) and open http://edit.test/info.php in your browser
Install Drush¶
http://docs.drush.org/en/8.x/install/
Local data portal installation¶
create the cdm_dataportal workspace:
mkdir ~/workspaces/cdm cd ~/workspaces/cdm git clone ssh://git@dev.e-taxonomy.eu/var/git/cdm-dataportal.git
now you should have the folder ~/workspaces/cdm/cdm-dataportal
install drupal core:
cd ~/workspaces/www/ drush dl drupal-7.x drush dl admin_menu backup_migrate ctools devel drupal_maintenance_block i18n imce imce_wysiwyg l10n_update languageicons module_missing_message_fixer smtp variable wysiwyg wysiwyg_codemagic
setup the cdm_dataportal by creating symlinks to the according folders in the cdm_dataportal workspace
cd ~/workspaces/www/drupal-7.x-dev/ ln -s ~/workspaces/cdm/cdm-dataportal/themes/zen_dataportal/polyfills ln -s ~/workspaces/cdm/cdm-dataportal/debug/db_debug.php.inc ln -s ~/workspaces/cdm/cdm-dataportal/debug/drupal_site_debug.php rm -rf ~/workspaces/www/drupal-7.x-dev/sites/all/themes cd ~/workspaces/www/drupal-7.x-dev/profiles ln -s ~/workspaces/cdm/cdm-dataportal/modules/cdm_dataportal/profile/CDM_Portal CDM_Portal ln -s ~/workspaces/cdm/cdm-dataportal/modules/cdm_dataportal/profile/CDM_Portal_Testing/ CDM_Portal_Testing
Delete ~/workspaces/www/drupal-7.x-dev/modules/cdm_dataportal
if it exists (it should not!!!)
change group ownership of drupal folder to www-data
sudo chown -R :www-data ~/workspaces/www/drupal-7.x-dev/
Create a site¶
Each new site must be added to the sites/sites.php. We recommend using the following php code to generate the correct site information in the sites.php:
$portal_names = array('my-first-site', 'my-second-site', 'new-site');
$portal_site_prefixes = array(
'edit.test.d7'
);
$sites = array();
foreach ($portal_site_prefixes as $prefix) {
foreach ($portal_names as $name) {
$sites[$prefix . '.' . $name] = $name;
}
}
The drupal sites will be available at http://edit.test/d7/{site_name}/. A per site configuration in apache is not needed since the virtual host configuration file edit.test.conf
contains a AliasMatch
directive which will make all drupal sites available under http://edit.test/d7/
:
AliasMatch ^/d7/([^/]+)(.*) /home/your-user-name/workspaces/www/drupal-7$2
In order to test your site.php copy the sites-debug.php into the sites folder and execute it with php:
php sites/sites-debug.php`
clone an existing site site from a server¶
copy the according site folder to ~/workspaces/www/drupal-7.x-dev/sites/new_site
restore a dump of the according mysql database
edit ~/workspaces/www/drupal-7.x-dev/sites/sites.php
to add your site
fix potential problems (drupal-fix-missing-modules.sh is available in server-scripts/drupal/drupal-fix-missing-modules.sh
) https://dev.e-taxonomy.eu/old/trac/browser/trunk/server-scripts/drupal/drupal-fix-missing-modules.sh,
see also How to restore CDM DataPortal database dumps
drupal-fix-missing-modules.sh http://edit.test/d7/new_site/
for trouble shooting (drupal_site_debug.php has been installed above!)
cd ~/workspaces/www/drupal-7.x-dev/ drush -l ${site-ulr} scr ~/drupal_site_debug.php
create a brand new site¶
in this example the new site is named "new_site"
mkdir ~/workspaces/www/drupal-7.x-dev/sites/new_site cd ~/workspaces/www/drupal-7.x-dev/sites/new_site ln -s ~/workspaces/cdm/cdm-dataportal/themes mkdir modules cd modules ln -s ~/workspaces/cdm/cdm-dataportal/modules/cdm_dataportal
for further steps on setting up a site please refer to https://wiki.bgbm.org/bdinotes/index.php/EDITProductionNewDataPortal#Setup_and_install_the_new_site
====== from here on the documentation is not yet up to date ======
- Create database as root:
new_site
if you're not logged in to mysql as root then also:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON new_site.* TO 'username'@'localhost';
- got to localhost/drupal/install.php
NOTE: If you are having problems with the graphical installer ("page not found" after installation) you may consider editing /var/www/drupal7-cdm_dataportal/sites/default/settings.php
with the following and repeat all the steps above
$databases = array(); $databases['default']['default'] = array( 'driver' => 'mysql', 'database' => 'new_site', 'username' => 'user', 'password' => 'pass', 'host' => 'localhost', 'prefix' => '', );
NOTE: If you see this message "Multibyte string input conversion in PHP is active and must be disabled" then add the following to your mbstring.ini or php.ini file
mbstring.http_input = pass ; mbstring.http_output = pass ;
Starting local CDM server from workspace¶
Requirements:
- You need to have cdmlib checked out and imported into your eclipse workspace (http://cybertaxonomy.eu/cdmlib/getting-started.html#Developing_the_CDM_Library_with_Eclipse)
- You neet a CDM database (called
cdmDB
in this example) - You need Jetty installed in your workspace (EclipsePreferencesforTeams#RunJettyRun)
- In your run configurations you will find two Jetty Webapp launch configs ("cdmlib-remote-webapp - run" and "cdmlib-remote-webapp - profile")
- "cdmlib-remote-webapp - run" will start the local CDM server
- if you don't have anything configured yet the following output explains how to configure the CDM data bases for the CDM server
2014-04-15 13:41:08,244 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - property {cdm.datasource} not found. 2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - --> This property can be set in two ways: 2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - --> 1. as attribute to the ServletContext 2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - --> 2. as system property e.g. -Dcdm.datasource 2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - --> 3. in ~/.cdmLibrary/cdmlib-remote.properties 2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - Stopping application ...
- For the second option add a data source bean to your
/home/user/.cdmLibrary/datasources.xml
(<- create file if it does not exist) as follows (do NOT confuse with @/home/user/cdmLibrary/writableResources/cdm.datasources.xml@):
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"> <bean id="cdmDB" lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="user" value="user"/> <property name="password" value="password"/> <property name="jdbcUrl" value="jdbc:mysql://localhost/cdmDB?autoReconnect=true&autoReconnectForPools=true&"/> </bean> </beans>
- In your "cdmlib-remote-webapp - run" launch configuration add to VM arguments:
-Dcdm.datasource=cdmDB
- To connect the data portal to your local CDM server add the following to
Home -> Administration -> Configuration -> CDM Dataportal
and choose your classification
http://localhost:8080/
Xdebug¶
install Xdebug:
pecl install xdebug
at the end of the install log, pecl shows something like:
Build process completed successfully Installing '/usr/lib/php/20151012/xdebug.so' install ok: channel://pecl.php.net/xdebug-2.6.0 configuration option "php_ini" is not set to php.ini location You should add "zend_extension=/usr/lib/php/20151012/xdebug.so" to php.ini
add xdebug to the php.ini: /etc/php/7.0/apache2/php.ini
Use the xdebug.so location from the pecl output.
zend_extension=/usr/lib/php/20151012/xdebug.so xdebug.idekey=PHPSTORM xdebug.remote_enable=1 xdebug.remote_port=9008
service apache2 reload
Setup of PhpStorm¶
Workspace setup¶
Create a Drupal project in phpStorm for the cdm_dataportal project folder:
The final Directory settings for the project should now look like:
Add Drupal code base to External libraries¶
open the external libraries configuration:
Setup the paths (this screenshot is only an example):
PhpStorm configuration to use Xdebug¶
- jetbrains: Zero-configuration Web Application Debugging with Xdebug and PhpStorm
- jetbrains: Browser Debugging Extensions
Add a remote debug configuration to the localhost
This is the server configuration. Do not configure pathmappings for localhost!
If you are having problems configuring your debugger, you can use the Web Server Debug Validation tool to solve common problems with your debug configuration. The tool can be started by selecting the Run | Web Server Debug Validation option from the menu.
install the Firefox extension Xdebug helper
make sure the extension is configured to use the api-key PHPSTORM
:
Project setup¶
Setup of the PDT project in eclipse¶
PDT is no longer recommended, use PhpStorm instead!
PDT launch configuration for Drupal projects¶
NOTE: Default debug port is 9000.
If the eclipse progress bar stops at 57% with the message "Waiting for the XDebug Session" check if xdebug.remote_enable=on
is set in your php.ini (or xdebug.ini)
To see where the ini files are located type
php --ini
You may also look here for other troubleshooting: https://stackoverflow.com/questions/9534302/waiting-for-the-xdebug-session-57-in-eclipse-pdt
Updated by Patrick Plitzner over 5 years ago · 75 revisions