Jump to: navigation, search

Modeling Project Releng/Component Creation/Build Server Setup

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.