Installing DSA for FIRST dataset on Ubuntu.

The instructions create the following directory structure.

/var/lib
        |
        +-- astrogrid
                |
                +-- deploy
                |     |
                |     +-- astrogrid-dsa-first.xml          (root) rw-r--r--
                |     +-- astrogrid-dsa-catalog-2008.2.war (root) rw-r--r--
                |
                +-- datasets
                        |
                        +-- dsa-first
                            |
                            +-- metadoc.xml        (root) rw-r--r--
                            +-- dataset.properties (root) rw-r--r--

The installation steps need to be run as root.

#
# Run as root.
sudo su -

These settings are used to configure the AstroGrid install directory.

#
# The AstroGrid install directory.
ASTROGRID_HOME=/var/lib/astrogrid

#
# Create the AstroGrid install directory.
if [ ! -e ${ASTROGRID_HOME} ]
then
    mkdir -p ${ASTROGRID_HOME}
fi

#
# Create the deployment directory.
if [ ! -e ${ASTROGRID_HOME}/deploy ]
then
    mkdir -p ${ASTROGRID_HOME}/deploy
fi

#
# Create the datasets directory.
if [ ! -e ${ASTROGRID_HOME}/datasets ]
then
    mkdir -p ${ASTROGRID_HOME}/datasets
fi

These settings are used to configure the Tomcat server.

#
# The Tomcat account name and password.
TOMCAT_USER=astrogrid
TOMCAT_PASS=jw8s0F4

#
# The Tomcat host name and port.
# Note this assumes that the system you are installing this on knows what its correct host name is.
# If not, then you will need set TOMCAT_HOST youself.
TOMCAT_HOST=`hostname -f`
TOMCAT_PORT=8080
TOMCAT_BASE=http://${TOMCAT_HOST}:${TOMCAT_PORT}

These settings are used to configure the MySQL database.

#
# MySQL admin account.
MYSQL_ROOT_PASS=esiu433p

#
# MySQL JDBC user account.
MYSQL_JDBC_USER=jdbc
MYSQL_JDBC_HOST=localhost
MYSQL_JDBC_PASS=vv43w25
MYSQL_JDBC_DATABASE=first

These settings are used to deploy the DSA web application.

#
# The webapp settings.
WEBAPP_NAME=dsa-first
WEBAPP_CONFIG=${ASTROGRID_HOME}/datasets/${WEBAPP_NAME}
WEBAPP_CONTEXT=astrogrid-${WEBAPP_NAME}
WEBAPP_ENDPOINT=${TOMCAT_BASE}/${WEBAPP_CONTEXT}

#
# The webapp download.
WEBAPP_WARFILE=astrogrid-dsa-catalog-2008.2.war

These settings are used to configure registry settings.

#
# The AstroGrid registry settings.
REGISTRY_AUTHORITY=org.astrogrid.test
REGISTRY_ENDPOINT=http://registry.metagrid.co.uk:8080/astrogrid-registry
REGISTRY_PUBLISH=${REGISTRY_ENDPOINT}
REGISTRY_PRIMARY=${REGISTRY_ENDPOINT}/services/RegistryQuery
REGISTRY_SECONDARY=${REGISTRY_ENDPOINT}/services/RegistryQuery

This prevents apt-get from prompting for additional settings during the install. (see http://ubuntuforums.org/showthread.php?t=1000358)

#
# Prevent apt-get from asking questions during the install.
export DEBIAN_FRONTEND=noninteractive

Update the package list.

#
# Update package list.
apt-get update

Install tools used during the install process.

#
# Install tools used in the install.
# Note : if you copy/paste these, then you need to do them one at a time.
apt-get -y install tar
apt-get -y install wget
apt-get -y install curl
apt-get -y install unzip
apt-get -y install patch
apt-get -y install tofrodos

Install Java.

#
# Install Java JRE and JDK.
# Note : if you copy/paste these, then you need to do them one at a time.
apt-get -y install openjdk-6-jre
apt-get -y install openjdk-6-jdk

#
# Select the OpenJDK Java implementations.
# Note : You need to do these one at a time.
update-alternatives --config java
update-alternatives --config javac

Install Tomcat server.

#
# Install Tomcat and default webapps.
# Note : if you copy/paste these, then you need to do them one at a time.
apt-get -y install tomcat5.5
apt-get -y install tomcat5.5-admin
apt-get -y install tomcat5.5-webapps

#
# Change the Tomcat port number
sed -i '
    s/Connector port="8180"/Connector port="'"${TOMCAT_PORT}"'"/
    ' /etc/tomcat5.5/server.xml 

#
# Disable Tomcat SecurityPolicy
sed -i '
    s/TOMCAT5_SECURITY=yes/TOMCAT5_SECURITY=no/
    ' /etc/init.d/tomcat5.5 

Add the AstroGrid Tomcat user role.

#
# Remove DOS characters (can cause patch to fail).
dos2unix /etc/tomcat5.5/tomcat-users.xml

#
# Add the astrogrid user account.
patch /etc/tomcat5.5/tomcat-users.xml << EOF
*** /old/tomcat5.5/tomcat-users.xml
--- /new/tomcat5.5/tomcat-users.xml
***************
*** 5,8 ****
--- 5,9 ----
    <user username="tomcat" password="tomcat" roles="tomcat"/>
    <user username="both" password="tomcat" roles="tomcat,role1"/>
+   <user username="${TOMCAT_USER}" password="${TOMCAT_PASS}" roles="manager,admin,dsaadmin"/>
    <user username="role1" password="tomcat" roles="role1"/>
    </tomcat-users>
EOF

#
# Restart the Tomcat service
/etc/init.d/tomcat5.5 restart

Install the MySQL server.

#
# MySQL install client.
apt-get -y install mysql-client

#
# MySQL install server.
apt-get -y install mysql-server

Install the MySQL JDBC driver.

#
# Install the MySQL JDBC driver.
apt-get install libmysql-java

#
# Add a symlink in the Tomcat common lib directory.
ln --symbolic /usr/share/java/mysql.jar /usr/share/tomcat5.5/common/lib/

#
# Restart the Tomcat service. 
/etc/init.d/tomcat5.5 restart

Configure the MySQL root password.

#
# Set the database root password
/usr/bin/mysqladmin -u root password ${MYSQL_ROOT_PASS}

Install the MySQL FIRST database from an archived data dump.

#
# Download and install the database dump file.
curl http://www.astrogrid.org/maven/datasets/mysql/first/first-database.sql | mysql --user=root --password=${MYSQL_ROOT_PASS}

#
# Grant access to the JDBC user account.
mysql --user=root --password=${MYSQL_ROOT_PASS} << EOF
    GRANT SELECT ON ${MYSQL_JDBC_DATABASE}.* TO '${MYSQL_JDBC_USER}'@'${MYSQL_JDBC_HOST}' IDENTIFIED BY '${MYSQL_JDBC_PASS}';
EOF

Download the the DSA war file.

#
# Download the war file.
if [ ! -e ${ASTROGRID_HOME}/deploy/${WEBAPP_WARFILE} ]
then
    pushd ${ASTROGRID_HOME}/deploy
        wget http://www.astrogrid.org/maven/org.astrogrid/wars/${WEBAPP_WARFILE}
    popd
fi

Create the DSA context file.

#
# Create context file.
cat > ${ASTROGRID_HOME}/deploy/${WEBAPP_CONTEXT}.xml << EOF
<?xml version='1.0' encoding='utf-8'?>
<Context
    displayName="AstroGrid FIRST dataset"
    >

    <!--+
        | The DSA properties file.
        +-->
    <Environment
        description="Configuration filename"
        name="org.astrogrid.config.filename"
        override="false"
        type="java.lang.String"
        value="${WEBAPP_CONFIG}/dataset.properties"
        />

</Context>
EOF

Download the configuration files.

#
# Create the config directory.
if [ ! -e ${WEBAPP_CONFIG} ]
then
    mkdir -p ${WEBAPP_CONFIG}
fi

#
# Download the dataset metadoc.
pushd ${WEBAPP_CONFIG}
    wget http://www.astrogrid.org/maven/datasets/mysql/first/metadoc.xml
popd

#
# Download the dataset properties.
pushd ${WEBAPP_CONFIG}
    wget http://www.astrogrid.org/maven/datasets/mysql/first/dataset.properties
popd

Edit the DSA configuration.

#
# Set the endpoint URL.
sed -i '
    s#^\(datacenter.url\)=.*#\1='"${WEBAPP_ENDPOINT}"'#
    ' ${WEBAPP_CONFIG}/dataset.properties

#
# Set the metadata location.
sed -i '
    s#^\(datacenter.metadoc.file\)=.*#\1='"${WEBAPP_CONFIG}"'/metadoc.xml#
    ' ${WEBAPP_CONFIG}/dataset.properties

#
# Set the JDBC user settings.
sed -i '
    s#^\(datacenter.plugin.jdbc.user\)=.*#\1='"${MYSQL_JDBC_USER}"'#
    s#^\(datacenter.plugin.jdbc.password\)=.*#\1='"${MYSQL_JDBC_PASS}"'#
    ' ${WEBAPP_CONFIG}/dataset.properties

#
# JDBC driver settings.
sed -i '
    s#^\(datacenter.plugin.jdbc.drivers=com.mysql.jdbc.Driver\)#\1#
    s#^\(datacenter.plugin.jdbc.url=jdbc:mysql:\).*#\1//'"${MYSQL_JDBC_HOST}"'/'"${MYSQL_JDBC_DATABASE}"'#
    ' ${WEBAPP_CONFIG}/dataset.properties

#
# Configure the registration identifier.
sed -i '
    s#^\(datacenter.authorityId\)=.*#\1='"${REGISTRY_AUTHORITY}"'#
    s#^\(datacenter.resourceKey\)=.*#\1='"${WEBAPP_NAME}"'#
    ' ${WEBAPP_CONFIG}/dataset.properties

#
# Configure the registry endpoints.
sed -i '
    s#^\(datacenter.publishing.registry\)=.*#\1='"${REGISTRY_PUBLISH}"'#
    s#^\(org.astrogrid.registry.query.endpoint\)=.*#\1='"${REGISTRY_PRIMARY}"'#
    s#^\(org.astrogrid.registry.query.altendpoint\)=.*#\1='"${REGISTRY_SECONDARY}"'#
    ' ${WEBAPP_CONFIG}/dataset.properties

Deploy the DSA webapp.

#
# Deploy the webapp.
curl --user ${TOMCAT_USER}:${TOMCAT_PASS} \
http://localhost:${TOMCAT_PORT}/manager/deploy\
?path=/${WEBAPP_CONTEXT}\
\&config=file:${ASTROGRID_HOME}/deploy/${WEBAPP_CONTEXT}.xml\
\&war=file:${ASTROGRID_HOME}/deploy/${WEBAPP_WARFILE}


Service registration .....


-- DaveMorris - 13 Jan 2009

Topic revision: r4 - 2009-06-02 - 16:32:50 - DaveMorris
 
AstroGrid Service Click here for the
AstroGrid Service Web
This is the AstroGrid
Development Wiki

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback