Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

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.

/etc/hosts

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

Install xampp

Rather than worrying about installing apache, php, mysql, and so forth, you can simply install xampp.

Apache2 configuration

Out of the box, xampp's apache2 7.2.5 instance runs as user daemon:daemon; 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 daemon
Group daemon

... 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.

groupadd www
usermod -a YOURUSERNAME -G www,apache
groups YOURUSERNAME

Or, edit your /etc/group file directly:

YOURUSERNAME:x:1000:
apache:x:48:YOURUSERNAME
www:x:502:YOURUSERNAME

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.

Restart Apache2

/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

Phoenix content

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

cd /opt/lampp/htdocs
sudo chown YOURUSERNAME:www .
sudo chmod g+s .
git clone ssh://YOURECLIPSEUSERNAME@git.eclipse.org:29418/www.eclipse.org/eclipse.org-common.git

Repeat for any vhosts you've got set up, or use symlinks.

Web content

You can checkout the content from git 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 you web server is configured to follow symlinks.

If symlinking, make sure that the user running the webserver (apache:www) can read into the folders outside the web root!

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 git - can be updated running git pull in the htdocs folder. This can be run as a cronjob at some regular interval.

cd /opt/lampp/htdocs
sudo chown YOURUSERNAME:www .
sudo chmod g+s .
git clone ssh://YOURECLIPSEUSERNAME@git.eclipse.org:29418/www.eclipse.org/eclipse.org-common.git

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 git.

cd /opt/lampp/htdocs
sudo chown YOURUSERNAME:www .
sudo chmod g+s .
git clone ssh://YOURECLIPSEUSERNAME@git.eclipse.org:29418/www.eclipse.org/modeling.git

vi modeling/somefile.php

git commit -s -m "[bug#] some commit comment" modeling/somefile.php
git push

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

Back to the top