Jump to: navigation, search

Eclipse Server Sandbox Setup

Revision as of 22:27, 10 September 2006 by Codeslave.ca.ibm.com (Talk | contribs)

This page documents how to set up your local Linux system to spoof most of the Eclipse.org (www.eclipse.org and download.eclipse.org) infrastructure in order to test - in a sandbox - changes to your web and downloads content.

Thanks to Neil Skypuch for the initial setup work.

You will need to be root for most of the steps below.

/etc/hosts

To make your local machine think it's eclipse.org add this line to /etc/hosts:

127.0.1.1    www.eclipse.org download.eclipse.org eclipse.org

Note that in order for your machine to browse to the REAL eclipse.org servers, you will need to remove this line. You could set up a simple toggle script like this:

#!/bin/sh
if [ ! -f /etc/hosts.spoof ]; then # create a copy of the current hosts file
  cp  /etc/hosts /etc/hosts.spoof; 
else # switch hosts and hosts.spoof
  # assume that hosts and hosts.spoof are different, otherwise this is a meaningless exercise
  mv /etc/hosts /etc/hosts.1;
  mv /etc/hosts.spoof /etc/hosts;
  mv /etc/hosts.1 /etc/hosts.spoof;
fi

Install modules

If not already installed, you'll need apache2, php4 and php4-xslt in order to fully mirror what's installed on eclipse.org servers.

apt-get install apache2 php4 php4-xslt php4-mysql

Note that in future, this is changing to php5.

Apache2 configuration

Add something like the following into your apache config file, /etc/apache2/sites-available/default:

<VirtualHost *>
       ServerName www.eclipse.org
       ServerAlias eclipse.org
       DocumentRoot "/var/www/www.eclipse.org/htdocs"
</VirtualHost>
<VirtualHost *>
       ServerName download.eclipse.org
       DocumentRoot "/var/www/download.eclipse.org/htdocs"
</VirtualHost>

Create vhost directories

Create the directories from which you'll be serving the spoofed content:

mkdir -p /var/www/www.eclipse.org/htdocs; \
mkdir -p  /var/www/download.eclipse.org/htdocs

Restart Apache2

apache2ctl restart
  - or -
/etc/init.d/apache2 restart

Phoenix content

Extract eclipse.org-common from CVS and put it in the root of your webserver:

cd /var/www; \
cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/technology -Q ex -r HEAD -d eclipse.org-common org.eclipse.phoenix/eclipse.org-common

Now, symlink the Phoenix content from within your vhost htdocs folders:

cd /var/www/www.eclipse.org/htdocs/; ln -s /var/www/eclipse.org-common; \
cd /var/www/download.eclipse.org/htdocs/; ln -s /var/www/eclipse.org-common; \

Web content

You can checkout the content from CVS and put it into the htdocs folders, or you can check out the content in Eclipse and symlink your checked out projects from the htdocs folder.

Checkout directly

This is handy for maintaining a mirror server (eg., an internal build server which contains the same files as on download.eclipse.org). Changes you make to code - once committed back to CVS - can be updated running cvs update in the htdocs folder. This can be run as a cronjob at some regular interval.

cd /var/www/www.eclipse.org/htdocs/; \
cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d emf www/emf

This is also useful for editing code on a machine which does not have an X server running or on which you don't have Eclipse installed. After making changes to code, simply check it back in to cvs.

cd /var/www/www.eclipse.org/htdocs/; \
cvs -d :ext:username@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d emf www/emf

vi emf/somefile.php

cvs -d :ext:username@dev.eclipse.org:/cvsroot/org.eclipse -Q ci "emf/somefile.php" -m "[bug#] some commit comment"

Symlink workspace projects

This is handy for sandbox testing of code changes on your local workstation. Every change you make in Eclipse to your code will immediately be reflected on your local webserver.

cd /var/www/www.eclipse.org/htdocs/; ln -s ~/workspace/emf

cd /var/www/download.eclipse.org/htdocs/; \
  mkdir -p tools/emf; cd tools/emf; \
  ln -s ~/workspace/emf-home/scripts; \
  ln -s ~/workspace/emf-home/_projectCommon.php

Vhost directory listings

www.eclipse.org

# ls -lA /var/www/www.eclipse.org/htdocs
lrwxrwxrwx 1 root root 28 2006-08-29 20:37 eclipse.org-common -> /var/www/eclipse.org-common/
lrwxrwxrwx 1 root root 25 2006-08-29 20:29 emf -> /home/nickb/workspace/emf

download.eclipse.org

# ls -lA /var/www/download.eclipse.org/htdocs
lrwxrwxrwx 1 root root   27 2006-08-29 20:35 eclipse.org-common -> /var/www/eclipse.org-common
drwxr-xr-x 3 root root 4096 2006-08-29 20:33 tools
# ls -lA /var/www/download.eclipse.org/htdocs/tools/emf
lrwxrwxrwx 1 root root 49 2006-08-29 20:34 _projectCommon.php -> /home/nickb/workspace/emf-home/_projectCommon.php
lrwxrwxrwx 1 root root 38 2006-08-29 20:33 scripts -> /home/nickb/workspace/emf-home/scripts

Synching

Synching your local copy with a remote server can be done with rsync or ssh/scp and a crontab entry to control the frequency of the updates. See rsync, ssh, scp, cron and crontab manpages for more information, syntax and examples.

See also:




This text's title tends toward a tame tongue twister. ;-)