Jump to: navigation, search

Difference between revisions of "Babel / Server Tool Development Process"

(Setting up a Development Environment)
Line 13: Line 13:
 
== Setting up a Development Environment ==
 
== Setting up a Development Environment ==
  
The Babel server environment is a typical LAMP environment.  Apache 2.x, PHP 5.x, MySQL 5.x and a CVS client are likely the only prerequisites.
+
The Babel server environment is a typical LAMP environment.  Apache 2.x, PHP 5.x, MySQL 5.x, Java and a CVS and/or SVN client are likely the only prerequisites.
  
 
Steps to setting up a Babel Development Environment on Linux. For Windows users, please refer to the Running the server on Windows section.
 
Steps to setting up a Babel Development Environment on Linux. For Windows users, please refer to the Running the server on Windows section.
Line 19: Line 19:
 
===Install CVS, PHP, Apache, MySQL if needed===
 
===Install CVS, PHP, Apache, MySQL if needed===
 
On Fedora 9, for example (as root):
 
On Fedora 9, for example (as root):
     # yum install cvs mysql-server mysql php php-mysql httpd
+
     # yum install mysql-server mysql php php-mysql httpd
 +
You can choose to install cvs and/or svn depending on what repositories you will be working with:
 +
    # yum install cvs
 +
    # yum install svn
 
     # /etc/init.d/mysqld start
 
     # /etc/init.d/mysqld start
 
     # /etc/init.d/httpd start
 
     # /etc/init.d/httpd start
 +
 +
 +
===Install Java===
 +
Install your favorite Java distro, and pay particular attention to have the jar command to be accessible in the path, since it will be used by the background jobs to create the language packs.
  
 
===Create a directory alias in Apache===
 
===Create a directory alias in Apache===
Line 115: Line 122:
  
 
* Don't use the PHP crypt() function for authentication: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=242011 bug 242011]
 
* Don't use the PHP crypt() function for authentication: [https://bugs.eclipse.org/bugs/show_bug.cgi?id=242011 bug 242011]
 
 
  
 
== Submitting code patches ==
 
== Submitting code patches ==

Revision as of 11:03, 13 August 2008

Babel Team Development Strategy

Prioritizing Strategy

The Babel team's strategy to processing bugs and feature requests is (in order):

  1. Bugs that cause incorrect translations to be saved or prevent people from enter translations
  2. Finishing the version zero issues (deployment, documentation)
  3. Bugs preventing project teams from adding their projects to Babel
  4. Server performance issues
  5. Bugs preventing users from consuming the output of Babel
  6. New features


Setting up a Development Environment

The Babel server environment is a typical LAMP environment. Apache 2.x, PHP 5.x, MySQL 5.x, Java and a CVS and/or SVN client are likely the only prerequisites.

Steps to setting up a Babel Development Environment on Linux. For Windows users, please refer to the Running the server on Windows section.

Install CVS, PHP, Apache, MySQL if needed

On Fedora 9, for example (as root):

   # yum install mysql-server mysql php php-mysql httpd

You can choose to install cvs and/or svn depending on what repositories you will be working with:

   # yum install cvs
   # yum install svn
   # /etc/init.d/mysqld start
   # /etc/init.d/httpd start


Install Java

Install your favorite Java distro, and pay particular attention to have the jar command to be accessible in the path, since it will be used by the background jobs to create the language packs.

Create a directory alias in Apache

Edit (eg) /etc/httpd/conf/httpd.conf to add:

   Alias /babel "/var/www/babel/server/html/"
   <Directory "/var/www/babel/server/html/">
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>

Apache may need to be reloaded or restarted for the alias to take effect. (eg Fedora 9: /etc/init.d/httpd restart)

Obtain the code from CVS

   cd /var/www/babel/
   cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/technology co -d server/ org.eclipse.babel/server

Set up the MySQL database

Configure the classes/base.conf file with the MySQL database information.

   db_read_host=localhost
   db_read_user=babel
   db_read_pass=babelpassword
   db_read_name=babel
   context=dev

Using your favourite MySQL administration tool, create a database for Babel. It is also recommended to create a MySQL user for Babel.

   mysql -u root -p
   mysql> create database babel;
   mysql> grant SELECT, INSERT, UPDATE, DELETE on babel.* to babel@'localhost' identified by 'babelpassword';
   mysql> flush privileges;
   

Replace the usernames, hostname and password according to your specific environment. Load the babel tables and sample data (the root account is used here, as the 'babel' account doesn't have CREATE/DROP privileges):

   mysql -u root -p babel < /var/www/babel/server/babel-setup.sql

The first time you'll run the Babel setup script, you will get an error from occurring for a trigger that does not exist.

To avoid this error, install MySQL version >= 5.0.32 or version >= 5.1.14 to be able to use IF EXISTS clause for DROP TRIGGER statement and modify the Babel sql script:

Replace: DROP TRIGGER `ins_version`;

by: DROP TRIGGER IF EXISTS `ins_version`;

Requirements for PHP

PHP must have the ability to encode data in the JSON format. As of PHP 5.2 'json_encode' and 'json_decode' are included by default. If you are using an earlier version you will need to install the JSON PECL extension, find another json_encode library or write your own json_encode function. See this page to find out more information on JSON and PHP.

Install Phoenix

Currently, Eclipse Phoenix code is required for Babel Server to run. There are plans to fix this (bug 217488). The Phoenix code must be installed in html/ with a symbolic link to it in your Apache DocumentRoot.

Before checkout Eclipse Phoenix code, you should delete the CVS folder for eclipse.org-common located here /var/www/babel/server/html/eclipse.org-common/CVS as it corresponds to the Eclipse Babel code CVS configuration (eclipse.org-common and its subfolders are checkout during Eclipse Babel code checkout)

   cd /var/www/babel/server/html/
   rm -rf eclipse.org-common/CVS
   cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/org.eclipse co -d eclipse.org-common www/eclipse.org-common
   cd /var/www/html/  # or whatever your DocumentRoot is
   ln -s /var/www/babel/server/html/eclipse.org-common eclipse.org-common

Logging in, load strings from dev.eclipse.org CVS

Log into Babel at http://localhost/babel/login.php.

   username: babel@eclipse.org
   password: password

Launch the maps processor: http://localhost/babel/process_map_files.php

Creating (building) a language pack

To create a language pack, simply run php5 path/to/generate1.php from a command line (or from cron). This requires many Linux commands to be found in the PATH environment variable; notably, the jar command that is included with most JDKs.

Background jobs

The Babel server running at http://babel.eclipse.org runs a number of jobs. All jobs are run from a plain user account which is not the Apache user.


  • This job produces our Nightly build. It essentially calls 'php5 path/to/generate1.php', and uses rsync to upload the language packs to eclipse.org servers.
    • 34 4 * * 1-6 ~/publishPackFromLive.sh
  • Same job as above, but this is the weekly build. It is uploaded to download.eclipse.org
    • 34 4 * * 0 ~/publishPackFromLive.sh W
  • This job essentually calls php5 path/to/dbmaintenance_15min.php
    • */15 * * * * ~/dbmaintenance_15min.sh > /dev/null

Running the server on Windows

The core Babel team uses Linux, but we've had reports of the Babel server running in a Windows environment. Here are some notes:

  • Don't use the PHP crypt() function for authentication: bug 242011

Submitting code patches

Server code patches must be attached to Bugzilla bugs and enhancement requests. Please ensure patches are submitted against a recently updated HEAD stream. Look for org.eclipse.babel/server in:

  :pserver:anonymous@dev.eclipse.org:/cvsroot/technology


Submitting database changes

Database versioning is something we are working on for the next Milestone release (Milestone 1). Currently if you want to make changes to the live database you need to put the SQL queries for alter/insert/update/create into the schema_change.sql file. When the next tagged version of the code is released the web master will process the schema_change.sql file by hand and make the appropriate changes to the database and test files.


Release process

Babel Server code in CVS is published to http://babel.eclipse.org/staging automatically every minute. To deploy the code to the live site:

  1. Tag the CVS code with a release tag: R_x_YYYYMMDDHHMM, where x is the release number and YYYYMMDDHHMM is the local time of the tag.
  2. Send an email to babel-dev@eclipse.org to announce the request for a deployment, specifying the release tag.

The Designated Deployment Drone (currently Denis) then establishes an SSH connection to the Babel server, and as the deployment user 'genie', runs the ./deployBabelLive.sh <rtag> to deploy the release.


Data Bridges

The Babel server has two data bridges:

  • Eclipse Bugzilla: this bridge is used to maintain a mapping of the Bugzilla user accounts on the Babel server. A process on the Bugzilla server and on the Babel server monitors this URL for changes, triggering an export (and an import) of the data.
  • Eclipse Project/Version info: When the Bugzilla bridge is run, the Project/Version info is pulled from this URL.