Jump to: navigation, search

Difference between revisions of "Modeling Project Releng/Component Creation/Build Server Setup"

m
(Add new component)
Line 12: Line 12:
 
== Add new component ==
 
== Add new component ==
  
As root:
+
As root or apache:
  
 
<table><tr><td>
 
<table><tr><td>
  for newcomponent in ''newcomponent'' ''anothercomponent''; do \
+
 
   cd /home/www-data/build/modeling/emft; mkdir $newcomponent; \
+
#!/bin/bash
   chown apache:apache *; chmod g+w *; \
+
   cd /var/www/html/modeling/emft/; cvs up -Pd $newcomponent; \
+
if <nowiki>[[ $# -lt 2 ]]</nowiki>; then
   cd $newcomponent; \
+
  echo "Usage: $0 projectName newcomponent1 [newcomponent2] [newcomponent3] ...";
   chown -R www * .*; chmod -R g+w * .*; \
+
  echo "Example: $0 emft ecoretools servus mint";
  cd /var/www/html/modeling/emft/$newcomponent/build/; \
+
  exit;
  cd /var/www/html/modeling/emft/cdo/build/.htaccess .; \
+
else
  chmod 664 .htaccess; \
+
  projectName=$1; shift 1;
  cd /var/www/html/modeling/emft/$newcomponent; \
+
fi
  ln -s /home/www-data/build/modeling/emft/$newcomponent/downloads/; \
+
 +
  for newcomponent in $*; do # for all commandline args
 +
 +
  # create build folder
 +
  echo "Create /home/www-data/build/modeling/$projectName/$newcomponent/downloads/drops/ ...";
 +
   cd /home/www-data/build/modeling/$projectName;
 +
  mkdir -p $newcomponent/downloads/drops/;
 +
   chown -R apache:apache $newcomponent; chmod -R g+w $newcomponent;
 +
 +
  # checkout web content
 +
  echo "Check out web content into /var/www/html/modeling/$projectName/$newcomponent/ ...";
 +
   cd /var/www/html/modeling/$projectName/;
 +
  cvs -q up -Pd $newcomponent;
 +
   if <nowiki>[[ ! -d /var/www/html/modeling/$projectName/$newcomponent ]]</nowiki>; then
 +
    echo "!! NO CVS FOLDER /var/www/html/modeling/$projectName/$newcomponent/ !!";
 +
   else
 +
    # fix perms
 +
    echo "Fix permissions in /var/www/html/modeling/$projectName/$newcomponent/ ...";
 +
    cd /var/www/html/modeling/$projectName/$newcomponent;
 +
    chown -R nickb:www * .*; chmod -R g+w * .*;
 +
 +
    # add .htaccess
 +
    echo "Set .htaccess protection for /var/www/html/modeling/$projectName/$newcomponent/build/ ...";
 +
    cd /var/www/html/modeling/$projectName/$newcomponent/build/;
 +
    cp /var/www/html/modeling/$projectName/build/.htaccess .;
 +
    chmod 664 .htaccess;
 +
 +
    # add symlink to downloads
 +
    echo "Symlink /var/www/html/modeling/$projectName/$newcomponent/downloads/ ...";
 +
    cd /var/www/html/modeling/$projectName/$newcomponent;
 +
    ln -s /home/www-data/build/modeling/$projectName/$newcomponent/downloads/;
 +
  fi
 
  done
 
  done
 +
 +
 
</td></tr></table>
 
</td></tr></table>
  

Revision as of 15:26, 14 November 2007

Add new user

As root:

for newuser in newuser anotheruser; do \
  /usr/sbin/adduser $newuser; \
  /usr/sbin/usermod -G www -p ${newuser}1 $newuser; \
done

Add new component

As root or apache:

#!/bin/bash

if [[ $# -lt 2 ]]; then
  echo "Usage: $0 projectName newcomponent1 [newcomponent2] [newcomponent3] ...";
  echo "Example: $0 emft ecoretools servus mint";
  exit;
else
  projectName=$1; shift 1;
fi

for newcomponent in $*; do # for all commandline args

  # create build folder
  echo "Create /home/www-data/build/modeling/$projectName/$newcomponent/downloads/drops/ ...";
  cd /home/www-data/build/modeling/$projectName;
  mkdir -p $newcomponent/downloads/drops/;
  chown -R apache:apache $newcomponent; chmod -R g+w $newcomponent;

  # checkout web content
  echo "Check out web content into /var/www/html/modeling/$projectName/$newcomponent/ ...";
  cd /var/www/html/modeling/$projectName/;
  cvs -q up -Pd $newcomponent;
  if [[ ! -d /var/www/html/modeling/$projectName/$newcomponent ]]; then
    echo "!! NO CVS FOLDER /var/www/html/modeling/$projectName/$newcomponent/ !!";
  else
    # fix perms
    echo "Fix permissions in /var/www/html/modeling/$projectName/$newcomponent/ ...";
    cd /var/www/html/modeling/$projectName/$newcomponent;
    chown -R nickb:www * .*; chmod -R g+w * .*;

    # add .htaccess
    echo "Set .htaccess protection for /var/www/html/modeling/$projectName/$newcomponent/build/ ...";
    cd /var/www/html/modeling/$projectName/$newcomponent/build/;
    cp /var/www/html/modeling/$projectName/build/.htaccess .;
    chmod 664 .htaccess;

    # add symlink to downloads
    echo "Symlink /var/www/html/modeling/$projectName/$newcomponent/downloads/ ...";
    cd /var/www/html/modeling/$projectName/$newcomponent;
    ln -s /home/www-data/build/modeling/$projectName/$newcomponent/downloads/;
  fi
done


Edit firewall

As root, add a line such as this to the firewall, then reload it.

/sbin/iptables -I INPUT -p tcp -s newhost_or_IP --dport 22 -j ACCEPT # newuser (newcomponent)

Announcement

Finally, send the user an email or IM with his new .htaccess and ssh usernames/passwords.