Added YAIM configuration (initial version).
authorJiří Filipovič <fila@ics.muni.cz>
Fri, 11 Apr 2008 14:37:12 +0000 (14:37 +0000)
committerJiří Filipovič <fila@ics.muni.cz>
Fri, 11 Apr 2008 14:37:12 +0000 (14:37 +0000)
org.glite.jp.primary/Makefile
org.glite.jp.primary/config/defaults/glite-jpps.pre [new file with mode: 0644]
org.glite.jp.primary/config/functions/config_glite_jpps [new file with mode: 0644]
org.glite.jp.primary/config/node-info.d/glite-jpps [new file with mode: 0644]

index b55915b..a070b93 100644 (file)
@@ -169,7 +169,12 @@ install:
        for i in ${sample_jobs}; do \
                ${INSTALL} -m 644 ${top_srcdir}/examples/$$i  ${PREFIX}/examples/glite-jp-primary-$$i.lb; \
        done
-
+       @mkdir -p $(prefix)/yaim/functions/
+       @mkdir -p $(prefix)/yaim/node-info.d
+       @mkdir -p $(prefix)/yaim/defaults
+       @install -m 0644 config/functions/config* $(prefix)/yaim/functions
+       @install -m 0644 config/node-info.d/glite* $(prefix)/yaim/node-info.d
+       @install -m 0644 config/defaults/glite* $(prefix)/yaim/defaults
 clean:
 
 simple_server.o soap_ops.o jpps-test.o: ${ps_prefix}H.h
diff --git a/org.glite.jp.primary/config/defaults/glite-jpps.pre b/org.glite.jp.primary/config/defaults/glite-jpps.pre
new file mode 100644 (file)
index 0000000..fe17ac7
--- /dev/null
@@ -0,0 +1,2 @@
+### Default values to some glite-JPPS variables
+GLITE_USER=glite
diff --git a/org.glite.jp.primary/config/functions/config_glite_jpps b/org.glite.jp.primary/config/functions/config_glite_jpps
new file mode 100644 (file)
index 0000000..f3eca20
--- /dev/null
@@ -0,0 +1,116 @@
+function config_glite_jpps_check(){
+  requires MYSQL_PASSWORD
+}
+
+function config_glite_jpps_setenv(){
+
+  yaimgridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite
+  yaimgridenv_set GLITE_LOCATION_VAR /var/glite
+  yaimgridenv_set GLITE_USER ${GLITE_USER:-glite}
+  yaimgridenv_set GLITE_HOST_CERT ${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem
+  yaimgridenv_set GLITE_HOST_KEY ${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem
+  yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates
+  yaimgridenv_set GLITE_JP_PRIMARY_PEERS ${GLITE_USER_HOME:-/home/glite}/jpps/jp.peers
+  yaimgridenv_set GLITE_JP_PRIMARY_FTP_PORT 8911
+  yaimgridenv_set GLITE_JP_PRIMARY_INTERNAL ${GLITE_USER_HOME:-/home/glite}/jpps
+  yaimgridenv_set GLITE_JP_PRIMARY_EXTERNAL gsiftp://`hostname -f`:8911${GLITE_USER_HOME:-/home/glite}/jpps
+
+  yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/glite/lib  
+  yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/globus/lib  
+  yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/c-ares/lib
+}
+
+function config_glite_jpps() {
+
+  ####################################################
+  #   Job Provenance Primary Storage configuration   #
+  ####################################################
+       
+  HOSTNAME=`hostname -f`
+
+  chmod og+rx /var/lib/mysql/ 
+  chown mysql:mysql /var/run/mysqld/
+
+  # 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 mysqld on
+  ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1
+  if [ ! $? = 0 ] ; then
+    /etc/init.d/mysqld 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 "jpps" > /dev/null 2>&1
+
+  if [ ! $? = 0 ]; then
+    mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE jpps"
+    mysql --password="$MYSQL_PASSWORD" jpps < ${INSTALL_ROOT}/glite/etc/glite-jp-primary-dbsetup.sql
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps@localhost IDENTIFIED BY '' WITH GRANT OPTION;"
+  else
+    yaimlog "Database jpps already exists"
+  fi
+
+  GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite}
+  mkdir -p $GLITE_LOCATION_VAR   # Needed to store PID of JPPS 
+
+  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-jp-primary ${GLITE_LOCATION}/etc/gLiteservices > /dev/null
+  if [ ! $? = 0 ] ; then
+    echo "${GLITE_LOCATION}/etc/init.d/glite-jp-primary" >> ${GLITE_LOCATION}/etc/gLiteservices
+  fi
+
+  touch ${GLITE_LOCATION}/etc/JPPS-peers
+
+  . /opt/glite/etc/profile.d/grid-env.sh
+  ${GLITE_LOCATION}/etc/init.d/glite-jp-primary stop
+  bash -x ${GLITE_LOCATION}/etc/init.d/glite-jp-primary start
+
+  if [ ! $? = 0 ] ; then
+    yaimlog ABORT "Service glite-jp-primary failed to start!"
+    return 1
+  fi
+
+  return 0
+
+}
diff --git a/org.glite.jp.primary/config/node-info.d/glite-jpps b/org.glite.jp.primary/config/node-info.d/glite-jpps
new file mode 100644 (file)
index 0000000..6b707d4
--- /dev/null
@@ -0,0 +1,6 @@
+JPPS_FUNCTIONS="
+config_host_certs
+config_edgusers
+config_globus_clients
+config_glite_jpps
+config_glite_initd"