The YAIM autoconfiguration - initial version.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 11 Apr 2008 09:13:56 +0000 (09:13 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Fri, 11 Apr 2008 09:13:56 +0000 (09:13 +0000)
org.glite.jp.index/Makefile
org.glite.jp.index/config/defaults/glite-jpis.pre [new file with mode: 0644]
org.glite.jp.index/config/functions/config_glite_jpis [new file with mode: 0644]
org.glite.jp.index/config/node-info.d/glite-jpis [new file with mode: 0644]

index 4c7a124..a467cb0 100644 (file)
@@ -125,6 +125,12 @@ install:
                ${INSTALL} -m 644 ../examples/query-tests/$$i ${PREFIX}/examples/query-tests; \
        done
        ${INSTALL} -m 644 ${top_srcdir}/interface/JobProvenanceISClient.xsd ${PREFIX}/interface
+       -mkdir -p ${PREFIX}/yaim/functions/
+       -mkdir -p ${PREFIX}/yaim/node-info.d
+       -mkdir -p ${PREFIX}/yaim/defaults
+       ${INSTALL} -m 0644 ${top_srcdir}/config/functions/config* ${PREFIX}/yaim/functions
+       ${INSTALL} -m 0644 ${top_srcdir}/config/node-info.d/glite* ${PREFIX}/yaim/node-info.d
+       ${INSTALL} -m 0644 ${top_srcdir}/config/defaults/glite* ${PREFIX}/yaim/defaults
 
 clean:
        rm -rvf *.c *.h *.ch *.xh *.xml *.nsmap *.o *.lo .libs glite-jp*
diff --git a/org.glite.jp.index/config/defaults/glite-jpis.pre b/org.glite.jp.index/config/defaults/glite-jpis.pre
new file mode 100644 (file)
index 0000000..5a57019
--- /dev/null
@@ -0,0 +1,2 @@
+### Default values to some glite-LB variables
+GLITE_USER=glite
diff --git a/org.glite.jp.index/config/functions/config_glite_jpis b/org.glite.jp.index/config/functions/config_glite_jpis
new file mode 100644 (file)
index 0000000..1ea0021
--- /dev/null
@@ -0,0 +1,110 @@
+function config_glite_jpis_check(){
+  requires MYSQL_PASSWORD
+}
+
+function config_glite_jpis_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
+
+  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_jpis() {
+
+  #############################################
+  #   Logging and Bookkeeping 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 "jpis" > /dev/null 2>&1
+
+  if [ ! $? = 0 ]; then
+    mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE jpis"
+    mysql --password="$MYSQL_PASSWORD" jpis < ${INSTALL_ROOT}/glite/etc/glite-jp-index-dbsetup.sql
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;"
+    mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis@localhost IDENTIFIED BY '' WITH GRANT OPTION;"
+  else
+    yaimlog "Database jpis already exists"
+  fi
+
+  GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite}
+  mkdir -p $GLITE_LOCATION_VAR   # Needed to store PID of LB server 
+
+  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-indexd ${GLITE_LOCATION}/etc/gLiteservices > /dev/null
+  if [ ! $? = 0 ] ; then
+    echo "${GLITE_LOCATION}/etc/init.d/glite-jp-indexd" >> ${GLITE_LOCATION}/etc/gLiteservices
+  fi
+
+  . /opt/glite/etc/profile.d/grid-env.sh
+  ${GLITE_LOCATION}/etc/init.d/glite-jp-indexd stop
+  ${GLITE_LOCATION}/etc/init.d/glite-jp-indexd start
+
+  if [ ! $? = 0 ] ; then
+    yaimlog ABORT "Service glite-jp-indexd failed to start!"
+    return 1
+  fi
+
+  return 0
+
+}
diff --git a/org.glite.jp.index/config/node-info.d/glite-jpis b/org.glite.jp.index/config/node-info.d/glite-jpis
new file mode 100644 (file)
index 0000000..46e4052
--- /dev/null
@@ -0,0 +1,8 @@
+JPIS_FUNCTIONS="
+config_add_pool_env
+config_crl
+config_host_certs
+config_edgusers
+config_globus_clients
+config_glite_jpis
+config_glite_initd"