Eclipse Server Sandbox Setup
This page replaces its predecessor, Eclipse Server Sandbox Setup (Archived).
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.
To make your local machine think it's eclipse.org add this line to
/etc/hosts (or c:\windows\system32\drivers\etc\hosts):
127.0.0.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
Rather than worrying about installing apache, php, mysql, and so forth, you can simply install xampp.
Out of the box, xampp's apache2 instance runs as user nobody:nobody; you may want to run as apache:www so that you can share your workspace files w/ the webserver. In
/opt/lampp/etc/httpd.conf, change this
# If you wish httpd to run as a different user or group, you must run # httpd as root initially and it will switch. # User/Group: The name (or #number) of the user/group to run httpd as. # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. User nobody Group nobody
... to this ...
User apache Group www
Next, make sure this user and group exist. You can use adduser or useradd and addgroup or groupadd to add them. Then make sure that you and the web user are both in the www group. Edit your /etc/group file:
nboldt:x:500:www apache:x:48:www www:x:502:
If you want to spoof different web content for download.eclipse.org, www.eclipse.org, emft.eclipse.org, etc., you'll need vhost directories so that each server has a different server root. See Eclipse_Server_Sandbox_Setup_(Archived)#Apache2_configuration.
/etc/init.d/httpd restart - or - /opt/lampp/lampp restart
If you already have an /etc/init.d/http for apache2, not for lampp, you can replace it with this:
#!/bin/bash # start up xampp /opt/lampp/lampp $1 exit $RETVAL
Extract eclipse.org-common from CVS and put it in the root of your webserver:
cd /opt/lampp/htdocs; \ cvs -d :pserver:email@example.com:/cvsroot/technology -Q ex -r HEAD -d eclipse.org-common org.eclipse.phoenix/eclipse.org-common
Repeat for any vhosts you've got set up, or use symlinks.
You can checkout the content from CVS and put it into the htdocs folder(s), or you can check out the content in Eclipse and symlink your checked out projects from the htdocs folder. If symlinking, make sure that the user running the webserver (apache:www) can read into your home dir & workspace folder!
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 /opt/lampp/htdocs/; \ cvs -d :pserver:firstname.lastname@example.org:/cvsroot/org.eclipse -Q co -d modeling www/modeling
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 /opt/lampp/htdocs/; \ cvs -d :ext:email@example.com:/cvsroot/org.eclipse -Q co -d modeling www/modeling vi modeling/somefile.php cvs -d :ext:firstname.lastname@example.org:/cvsroot/org.eclipse -Q ci "modeling/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 /opt/lampp/htdocs/; ln -s ~/workspace/modeling