This commit is contained in:
Andrea Manzi 2013-09-25 10:30:43 +00:00
parent 50dd9cfd05
commit 55393a1110
13 changed files with 530 additions and 0 deletions

17
.project Normal file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>smartgears-distribution</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
#Wed Sep 25 11:08:37 CEST 2013
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

6
distro/LICENSE Normal file
View File

@ -0,0 +1,6 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

1
distro/MAINTAINERS Normal file
View File

@ -0,0 +1 @@
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy

38
distro/README Normal file
View File

@ -0,0 +1,38 @@
The gCube System - ${name}
----------------------
This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), D4Science (FP7-INFRA-2007-1.2.2),
D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil).
Authors
-------
* Fabio Simeoni (fabio.simeoni@fao.org), FAO of the UN, Italy.
Version and Release Date
------------------------
${version}
Description
-----------
${description}
Download information
--------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from:
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php/....
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

5
distro/changelog.xml Normal file
View File

@ -0,0 +1,5 @@
<ReleaseNotes>
<Changeset component="${build.finalName}" date="">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

188
distro/contents/install Executable file
View File

@ -0,0 +1,188 @@
#set distro to script's parent directory
distro=$(cd ${0%/*} && echo $PWD/${0##*/})
distro=$(dirname $distro)
echo "distro:$distro"
distrolibs=$distro/libs
distroapps=$distro/apps
distroscripts=$distro/scripts
liblist=smartgears.list
function showhelp {
echo -e "\nusage: install [-d <distro directory>] -s tomcat|<lib directory> -a [app directory] [-g gHN directory] [-x|-h] \n"
echo " <distro directory> = the directory with the distribution of SmartGears ${project.version}."
echo " By default, this is the parent directory of this script."
echo " <lib directory> = the directory with libraries shared by all applications in the target container."
echo " <app directory> = the directory with all the applications in the target container."
echo " <gHN directory> = the directory with logs and files related to the gCube Hosting Node."
echo " By default, this is value of the GHN_HOME env var."
echo " tomcat = Sets <lib directory> and <app directory> for a target Tomcat container."
echo " x = dry run."
echo -e " h = shows this help.\n"
}
while getopts ":d:s:g:a:xh" opt; do
case $opt in
d) distro=$OPTARG;;
s) shared=$OPTARG;;
g) ghnhome=$OPTARG;;
a) apps=$OPTARG;;
x) dryrun="true";;
h) showhelp
exit 0 ;;
:) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
showhelp;
echo -e "\naborting.\n"
exit 1;;
\?) echo -e "\nERROR:invalid option: -$OPTARG";
showhelp;
echo -e "\naborting.\n"
exit 1 >&2 ;;
esac
done
if [ -z "$ghnhome" ]; then
if [ -z "$GHN_HOME" ]; then
echo -e "\nERROR:please specify the gHN directory (-g) or define the GHN_HOME env var." >&2
showhelp
echo -e "\naborting.\n"
exit 1
else
ghnhome=$GHN_HOME
fi
fi
if [ ! -d "$ghnhome" ]; then
if [ -z "$dryrun" ]; then
mkdir $ghnhome
fi
fi
#tomcat target
if [ "$shared" = "tomcat" ]; then
if [ -z "$CATALINA_HOME" ]; then
echo -e "\nERROR: env var CATALINA_HOME is undefined." >&2
showhelp
echo -e "\naborting.\n"
exit 1
fi
shared=$CATALINA_HOME/lib
apps=$CATALINA_HOME/webapps
fi
#shared is set
if [ -z "$shared" ]; then
echo -e "\nERROR: shared directory is undefined (-s)." >&2
showhelp
echo -e "\naborting.\n"
exit 1
fi
#shared exists and is a directory
if [ ! -d "$shared" ]; then
echo -e "\nERROR: $shared does not exist or is not a directory, aborting." >&2
exit 1;
fi
#shared exists and is a directory
if [ ! -d "$apps" ]; then
echo -e "\nERROR: $apps does not exist or is not a directory, aborting." >&2
exit 1;
fi
#distrolibs exists and is a directory
if [ ! -d "$distrolibs" ]; then
echo -e "\nERROR: $distrolibs does not exist or is not a directory, aborting."
exit 1;
fi
#distroapps exists and is a directory
if [ ! -d "$distroapps" ]; then
echo -e "\nERROR: $distroapps does not exist or is not a directory, aborting."
exit 1;
fi
echo -e "\nInstalling SmartGears ${project.version}\n"
echo -e " target gHN directory = $(cd $(dirname $ghnhome); pwd)/$(basename $ghnhome)"
echo -e " target shared directory = $(cd $(dirname $shared); pwd)/$(basename $shared)"
echo -e " target app directory = $(cd $(dirname $apps); pwd)/$(basename $apps)"
shopt -s nullglob
#uninstall libraries
if [ -f $shared/$liblist ]; then
echo -e "\nuninstalling existing components \c"
while read line; do
if [ -z "$dryrun" ]; then
rm $shared/$line
fi
echo -n "."
sleep .01
done < $shared/$liblist
if [ -z "$dryrun" ]; then
rm $shared/$liblist
fi
fi
#install libraries
echo -e "\ninstalling components \c"
for f in $distrolibs/*.*;
do
if [ -z "$dryrun" ]; then
cp $f $shared/
basename $f >> $shared/$liblist
fi
echo -n "."
sleep .01
done
#install apps
echo -e "\ninstalling applications \c"
for f in $distroapps/*;
do
if [ -z "$dryrun" ]; then
cp $f $apps/
fi
echo -n "."
sleep .01
done
#install scripts
echo -e "\ninstalling scripts \c"
if [ ! -d "$ghnhome/scripts" ]; then
if [ -z "$dryrun" ]; then
mkdir $ghnhome/scripts
fi
fi
for f in $distroscripts/*;
do
if [ -z "$dryrun" ]; then
cp $f $ghnhome/scripts/
fi
echo -n "."
sleep .01
done
#install config
echo -e "\ninstalling configuration \c"
if [ ! -d "$ghnhome/container.xml" ]; then
if [ -z "$dryrun" ]; then
cp $distro/container.xml $ghnhome/
fi
echo -n "."
sleep .01
fi
if [ -z "$dryrun" ]; then
cat $distro/logback.xml | sed "s|\${LOGFILE}|$ghnhome|" > $shared/logback.xml
echo -n "."
sleep .01
fi
echo -e "\ndone.\n"

View File

@ -0,0 +1,19 @@
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${LOGFILE}/ghn.log</file>
<append>true</append>
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}: %msg%n</pattern>
</encoder>
</appender>
<logger name="org.gcube" level="INFO" />
<logger name="org.gcube.smartgears" level="TRACE" />
<logger name="org.gcube.common.events" level="TRACE" />
<root level="WARN">
<appender-ref ref="FILE" />
</root>
</configuration>

View File

@ -0,0 +1,22 @@
<container mode='offline'>
<hostname>localhost</hostname>
<port>8080</port>
<infrastructure>gcube</infrastructure>
<vo>devsec</vo>
<site>
<country>it</country>
<location>rome</location>
<latitude>41.9000</latitude>
<longitude>12.5000</longitude>
</site>
<!--
<property name='prop1' value='val1' />
<property name='prop2' value='val2' />
-->
<publication-frequency>60</publication-frequency>
</container>

View File

@ -0,0 +1,63 @@
group=org.gcube.core
artifact=common-smartgears
repo=gcube-releases
function showhelp {
echo -e "\nusage: download [-v <version>] [-s|-h] \n"
echo " <version> = the version to download."
echo " = By default, this is the latest known version."
echo " s = download a snapshot version."
echo " x = dry run."
echo -e " h = shows this help.\n"
}
while getopts ":v:sh" opt; do
case $opt in
v) version=$OPTARG;;
s) repo=gcube-snapshots;;
h) showhelp
exit 0 ;;
:) echo -e "\nERROR:option -$OPTARG requires an argument." >&2 ;
showhelp;
echo -e "\naborting.\n"
exit 1;;
\?) echo -e "\nERROR:invalid option: -$OPTARG";
showhelp;
echo -e "\naborting.\n"
exit 1 >&2 ;;
esac
done
#######find latest version in target repo. could use LATEST but would not know how to reflect version in file name
version_regexp=".*<baseVersion>\(.*\)</baseVersion>.*"
if [ -z "$version" ]; then
version=`curl -silent -L "maven.research-infrastructures.eu/nexus/service/local/artifact/maven/resolve?r=$repo&g=$group&a=$artifact&v=LATEST&e=tar.gz&c=distro" \
| grep "$version_regexp" | sed "s|$version_regexp|\1|"` #(first extract matching line, then extract matching group)
if [ -z "$version" ]; then
echo -e "\nERROR: cannot find a version to download in $repo." >&2
echo -e "\naborting.\n"
exit 1
fi
fi
echo -e "\ndownloading common-smartgears-$version.tar.gz...\c"
http_code=`curl -s -o "common-smartgears-$version.tar.gz" -w "%{http_code}" -L "maven.research-infrastructures.eu/nexus/service/local/artifact/maven/redirect?r=$repo&g=$group&a=$artifact&v=$version&e=tar.gz&c=distro"`
if [ ! "$http_code" = "200" ]; then
echo -e "\n\nERROR: cannot download version $version from $repo." >&2
echo -e "\naborting.\n"
rm "common-smartgears-$version.tar.gz"
exit 1
fi
echo -e "done.\n"

52
distro/standalone.xml Normal file
View File

@ -0,0 +1,52 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>distro</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>${artifact.artifactId}-${project.version}</baseDirectory>
<fileSets>
<fileSet>
<outputDirectory>scripts</outputDirectory>
<directory>${distroDirectory}/contents/scripts</directory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>download</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>${distroDirectory}/contents</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>install</include>
<include>logback.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>libs</directory>
<outputDirectory>libs</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
<fileSet>
<directory>war</directory>
<outputDirectory>apps</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/contents/samplecontainer.xml</source>
<destName>container.xml</destName>
<filtered>true</filtered>
</file>
</files>
</assembly>

1
distro/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}

113
pom.xml Normal file
View File

@ -0,0 +1,113 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
</parent>
<groupId>org.gcube.distribution</groupId>
<artifactId>smartgears-distribution</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>A distribution for the Smartgears Framework</name>
<properties>
<distroDirectory>distro</distroDirectory>
</properties>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}</connection>
<developerConnection>scm:svn:https://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/distributions/${project.artifactId}</url>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-smartgears-bom</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>probe</classifier>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/libs</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeTypes>war</excludeTypes>
<stripVersion>true</stripVersion>
</configuration>
</execution>
<execution>
<id>copy-probe</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/war</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeTypes>war</includeTypes>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>standalone</id>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${distroDirectory}/standalone.xml</descriptor>
</descriptors>
</configuration>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>