Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Eclipse Server Sandbox Setup"

m (Synching)
(Web content)
 
(18 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 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 <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 daemon
 +
Group daemon
  
<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.
  
  mkdir -p /var/www/www.eclipse.org/htdocs; \
+
  groupadd www
  mkdir -p /var/www/download.eclipse.org/htdocs
+
  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 ===
 
=== 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 ===
  
Extract eclipse.org-common from CVS and put it in the root of your webserver:
+
Extract eclipse.org-common from git 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
+
sudo chown ''YOURUSERNAME'':www .
 +
  sudo chmod g+s .
 +
git clone ssh://''YOURECLIPSEUSERNAME''@git.eclipse.org:29418/www.eclipse.org/eclipse.org-common.git
  
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 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 ====
 
==== 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 <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 git - can be updated running <code>git pull</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
+
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 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 git.
  
  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
+
sudo chown ''YOURUSERNAME'':www .
 +
sudo chmod g+s .
 +
  git clone ssh://''YOURECLIPSEUSERNAME''@git.eclipse.org:29418/www.eclipse.org/modeling.git
 
   
 
   
  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"
+
  git commit -s -m "[bug#] some commit comment" ''modeling/somefile.php''
 +
git push
  
 
==== Symlink workspace projects ====
 
==== Symlink workspace projects ====
Line 95: Line 120:
 
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.
+
 
+
 
+
 
+
 
+
----
+
 
+
''This text's title tends toward a tame tongue twister.'' ;-)
+

Latest revision as of 21:10, 27 May 2018

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