Jump to: navigation, search

Difference between revisions of "Eclipse Server Sandbox Setup"

m (Synching)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 +
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.
 
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.
  
Line 7: Line 11:
 
=== /etc/hosts ===
 
=== /etc/hosts ===
  
To make your local machine think it's eclipse.org add this line to '''<code>/etc/hosts</code>''':
+
To make your local machine think it's eclipse.org add this line to '''<code>/etc/hosts</code>''' (or c:\windows\system32\drivers\etc\hosts):
  
  127.0.1.1    www.eclipse.org download.eclipse.org eclipse.org
+
  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:
 
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:
Line 23: Line 27:
 
  fi
 
  fi
  
=== Install modules ===
+
=== Install xampp ===
  
If not already installed, you'll need apache2, php4 and php4-xslt in order to fully mirror what's installed on eclipse.org servers.
+
Rather than worrying about installing apache, php, mysql, and so forth, you can simply install xampp.
  
apt-get install apache2 php4 php4-xslt php4-mysql
+
* http://www.apachefriends.org/en/xampp.html
 
+
Note that in future, this is changing to php5.
+
  
 
=== Apache2 configuration ===
 
=== Apache2 configuration ===
  
Add something like the following into your apache config file, '''<code>/etc/apache2/sites-available/default</code>''':
+
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 <code>/opt/lampp/etc/httpd.conf</code>, change this
  
  <VirtualHost *>
+
  # If you wish httpd to run as a different user or group, you must run
        ServerName www.eclipse.org
+
# httpd as root initially and it will switch.
        ServerAlias eclipse.org
+
# User/Group: The name (or #number) of the user/group to run httpd as.
        DocumentRoot "/var/www/www.eclipse.org/htdocs"
+
# It is usually good practice to create a dedicated user and group for
  </VirtualHost>
+
# running httpd, as with most system services.
 +
  User nobody
 +
Group nobody
  
<VirtualHost *>
+
... to this ...
        ServerName download.eclipse.org
+
        DocumentRoot "/var/www/download.eclipse.org/htdocs"
+
</VirtualHost>
+
  
=== Create vhost directories ===
+
User apache
 +
Group www
  
Create the directories from which you'll be serving the spoofed content:
+
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:
  
  mkdir -p /var/www/www.eclipse.org/htdocs; \
+
  nboldt:x:500:www
mkdir -p  /var/www/download.eclipse.org/htdocs
+
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]].
  
 
=== Restart Apache2 ===
 
=== Restart Apache2 ===
  
  apache2ctl restart
+
  /etc/init.d/httpd restart
 
   ''- or -''
 
   ''- or -''
  /etc/init.d/apache2 restart
+
  /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 ===
 
=== Phoenix content ===
Line 63: Line 76:
 
Extract eclipse.org-common from CVS and put it in the root of your webserver:
 
Extract eclipse.org-common from CVS and put it in the root of your webserver:
  
  cd /var/www; \
+
  cd /opt/lampp/htdocs; \
 
  cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/technology -Q ex -r HEAD -d eclipse.org-common org.eclipse.phoenix/eclipse.org-common
 
  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:
+
Repeat for any vhosts you've got set up, or use symlinks.
  
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 ===
 
=== 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.
+
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!'''
  
 
==== Checkout directly ====
 
==== Checkout directly ====
Line 79: Line 89:
 
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 <code>cvs update</code> in the htdocs folder. This can be run as a cronjob at some regular interval.
 
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 <code>cvs update</code> in the htdocs folder. This can be run as a cronjob at some regular interval.
  
  cd /var/www/www.eclipse.org/htdocs/; \
+
  cd /opt/lampp/htdocs/; \
  cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d emf www/emf
+
  cvs -d :pserver:anonymous@dev.eclipse.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.
 
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/; \
+
  cd /opt/lampp/htdocs/; \
  cvs -d :ext:''username''@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d emf www/emf
+
  cvs -d :ext:''username''@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d modeling www/modeling
 
   
 
   
  vi ''emf/somefile.php''
+
  vi ''modeling/somefile.php''
 
   
 
   
  cvs -d :ext:''username''@dev.eclipse.org:/cvsroot/org.eclipse -Q ci "''emf/somefile.php''" -m "[bug#] some commit comment"
+
  cvs -d :ext:''username''@dev.eclipse.org:/cvsroot/org.eclipse -Q ci "''modeling/somefile.php''" -m "[bug#] some commit comment"
  
 
==== Symlink workspace projects ====
 
==== Symlink workspace projects ====
Line 95: Line 105:
 
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.
 
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 /opt/lampp/htdocs/; ln -s ~/workspace/modeling
 
   
 
   
cd /var/www/download.eclipse.org/htdocs/; \
+
[[Category:Modeling]] [[Category:EMFT]] [[Category:Releng]]
  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:
+
* [http://wiki.eclipse.org/index.php/Webmaster_FAQ#How_do_I_become_an_Eclipse_mirror.3F Webmaster FAQ]
+
* [http://www.eclipse.org/downloads/mir_request.php Eclipse Mirror Request Form]
+
* [http://www.eclipse.org/downloads/eclipse.org-rsync.sh.txt Eclipse Mirror Rsync Script]
+
 
+
 
+
 
+
 
+
----
+
 
+
''This text's title tends toward a tame tongue twister.'' ;-)
+

Latest revision as of 15:42, 11 November 2008

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

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 CVS and put it in the root of your webserver:

cd /opt/lampp/htdocs; \
cvs -d :pserver:anonymous@dev.eclipse.org:/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.

Web content

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!

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 /opt/lampp/htdocs/; \
cvs -d :pserver:anonymous@dev.eclipse.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:username@dev.eclipse.org:/cvsroot/org.eclipse -Q co -d modeling www/modeling

vi modeling/somefile.php

cvs -d :ext:username@dev.eclipse.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