Import of new WMS/LB scripts from Di
authorRobert Harakaly <robert.harakaly@cern.ch>
Mon, 30 Apr 2007 09:09:01 +0000 (09:09 +0000)
committerRobert Harakaly <robert.harakaly@cern.ch>
Mon, 30 Apr 2007 09:09:01 +0000 (09:09 +0000)
org.glite.yaim.lb/config/functions/config_glite_lb
org.glite.yaim.lb/config/node-info.d/glite-lb

index 25a1a58..6378c8b 100644 (file)
-#      TODO:
-#              Patch 1027:
-#                      (Optional) Add expected LB server "superusers" X509 subjects (one per line)
-#                      into $GLITE_LOCATION/etc/LB-super-users 
+function config_glite_lb_check(){
+  requires MYSQL_PASSWORD
+}
 
+function config_glite_lb_setenv(){
+  gridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite
+  gridenv_set GLITE_LOCATION_VAR /var/glite
+  gridenv_set GLITE_USER ${GLITE_USER:-glite}
+  gridenv_set GLITE_WMS_QUERY_TIMEOUT 300
+  gridenv_set GLITE_HOST_CERT /home/glite/.certs/hostcert.pem
+  gridenv_set GLITE_HOST_KEY /home/glite/.certs/hostkey.pem
+  gridenv_set X509_CERT_DIR /etc/grid-security/certificates
+  gridenv_set X509_VOMS_DIR /etc/grid-security/vomsdir
+  gridpath_append LD_LIBRARY_PATH /opt/c-ares/lib
+}
 
+function config_glite_lb() {
 
-function config_glite_lb(){
-       #check if config_glite_init is loaded
-       source ${FUNCTIONS_DIR}/config_glite_init
-       config_glite_init
+  #############################################
+  #   Logging and Bookkeeping configuration   #
+  #############################################
        
-       #       Configure gLite LB
-       run_glite_command glite-lb-config.py --conf
-    #  Start gLite LB
-    run_glite_command glite-lb-config.py --start
-}
\ No newline at end of file
+  INSTALL_ROOT=${INSTALL_ROOT:-/opt}
+  HOSTNAME=`hostname -f`
+
+  # add option  --max_allowed_packet=17M
+  if [ ! -f /etc/my.cnf ]; then
+    echo "[mysqld]" >> /etc/my.cnf
+    echo "max_allowed_packet=17M" >> /etc/my.cnf
+  else
+    grep "^[mysqld]" /etc/my.cnf > /dev/null
+    if [ ! $? = 0 ]; then
+      echo "[mysqld]" >> /etc/my.cnf
+      echo "max_allowed_packet=17M" >> /etc/my.cnf
+    fi
+  fi
+
+  /sbin/chkconfig mysql on
+  ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1
+  if [ ! $? = 0 ] ; then
+    /etc/init.d/mysql start
+    sleep 1
+  fi 
+
+  ls /tmp/mysql.sock > /dev/null 2>&1
+  if [ ! $? = 0 ]; then
+    ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
+  fi
+  
+  # set mysql password
+  set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD
+
+  # Check if database exist
+  mysqlshow --password="$MYSQL_PASSWORD" | grep "lbserver20" > /dev/null 2>&1
+
+  if [ ! $? = 0 ]; then
+    mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE lbserver20"
+    mysql --password="$MYSQL_PASSWORD" lbserver20 < ${INSTALL_ROOT}/glite/etc/glite-lb-dbsetup.sql
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@localhost IDENTIFIED BY '' WITH GRANT OPTION;"
+  else
+    yaimlog "Database lbserver20 already exists"
+  fi
+
+  # do we need bkindex?
+
+  GLITE_USER=${GLITE_USER:-glite}
+  GLITE_USER_HOME=${GLITE_USER_HOME:-/home/glite}
+
+  if ( ! id $GLITE_USER > /dev/null 2>&1 ); then
+    useradd -p "*NP*"  -r -c "gLite User" -m $GLITE_USER
+    chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME
+  fi
+
+  GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite}
+  chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR
+  chmod 0755 $GLITE_LOCATION_VAR
+
+  mkdir -p $GLITE_USER_HOME/.certs
+  chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs
+  chmod 0755 $GLITE_USER_HOME/.certs
+  cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_USER_HOME/.certs/
+  if [ ! $? = 0 ] ; then
+    echo "Please copy host certificate and key into /etc/grid-security and"
+    echo "  $GLITE_USER_HOME/.certs/, change the owner of the ones in"
+    echo "  $GLITE_USER_HOME/.certs/ to $GLITE_USER"
+  fi
+  chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs/hostcert.pem $GLITE_USER_HOME/.certs/hostkey.pem
+  chmod 0644 $GLITE_USER_HOME/.certs/hostcert.pem
+  chmod 0400 $GLITE_USER_HOME/.certs/hostkey.pem
+
+  # Start services
+  if [ ! -f ${GLITE_LOCATION}/etc/gLiteservices ] ; then
+    touch ${GLITE_LOCATION}/etc/gLiteservices
+  fi
+
+  grep glite-lb-bkserverd ${GLITE_LOCATION}/etc/gLiteservices > /dev/null
+  if [ ! $? = 0 ] ; then
+    echo "${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd" >> ${GLITE_LOCATION}/etc/gLiteservices
+  fi
+
+  echo ". /opt/glite/yaim/etc/grid-env-funcs.sh" > /etc/profile.d/aaa.sh # I hate this
+  . /opt/glite/yaim/etc/grid-env-funcs.sh
+
+  . /opt/glite/etc/profile.d/grid-env.sh
+  ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd restart
+  rm -f /etc/profile.d/aaa.sh
+
+  return 0
+
+}
index dc8684d..346be6a 100644 (file)
@@ -1,8 +1,14 @@
-LB_FUNCTIONS="
+WMSLB_FUNCTIONS="
 config_crl
 config_host_certs
 config_edgusers
 config_users
 config_mkgridmap
 config_java
-config_glite_lb"
\ No newline at end of file
+config_rgma_client
+config_bdii
+config_gip_service
+config_globus
+config_glite_lb
+config_glite_locallogger
+config_add_pool_env"