Skip to main content
Jump to: navigation, search

Eclipse Server Sandbox Setup

Revision as of 08:57, 4 July 2008 by (Talk | contribs) (fixed localhost address)

This page documents how to set up your local Linux system to spoof most of the ( and 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.


To make your local machine think it's add this line to /etc/hosts (or c:\windows\system32\drivers\etc\hosts):

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

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;

Install modules

If not already installed, you'll need apache2, php4 and php4-xslt in order to fully mirror what's installed on 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 *>
       DocumentRoot "/var/www/"
<VirtualHost *>
       DocumentRoot "/var/www/"

Create vhost directories

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

mkdir -p /var/www/; \
mkdir -p  /var/www/

Restart Apache2

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

Phoenix content

Extract from CVS and put it in the root of your webserver:

cd /var/www; \
cvs -d -Q ex -r HEAD -d org.eclipse.phoenix/

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

cd /var/www/; ln -s /var/www/; \
cd /var/www/; ln -s /var/www/; \

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 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/; \
cvs -d -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/; \
cvs -d -Q co -d emf www/emf

vi emf/somefile.php

cvs -d -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/; ln -s ~/workspace/emf

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

Vhost directory listings

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

# ls -lA /var/www/
lrwxrwxrwx 1 root root   27 2006-08-29 20:35 -> /var/www/
drwxr-xr-x 3 root root 4096 2006-08-29 20:33 tools
# ls -lA /var/www/
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 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. ;-)

Back to the top