Skip to content

Commit

Permalink
make run and setup scripts easier for all to use
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Eichar committed Nov 23, 2012
1 parent eccfda8 commit 98fa558
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
28 changes: 28 additions & 0 deletions bin/clean.sh
@@ -0,0 +1,28 @@
#!/bin/sh
set -x
. config.sh
dropdb $DB

case $POSTGIS_INSTALL in
"POSTGIS 2 create")
createdb -O www-data $DB
psql -d $DB -c "CREATE EXTENSION postgis;"
psql -d $DB -c "CREATE EXTENSION postgis_topology;"
psql -d $DB -f $SQL_DIR/legacy.sql
;;
"template")
createdb -O www-data $DB -T template_postgis
;;
"POSTGIS 1 create")
createdb -O www-data $DB
createlang plpgsql $DB
psql -d $DB -f $SQL_DIR/postgis.sql
psql -d $DB -f $SQL_DIR/spatial_ref_sys.sql
;;
esac

rm -rf $DATA_DIR
mkdir -p $DATA_DIR/config/
cp -R $WEB_DIR/src/main/webapp/WEB-INF/data/config/codelist $DATA_DIR/config/
cp -R $WEB_DIR/src/main/webapp/WEB-INF/data/config/schema_plugins $DATA_DIR/config/

39 changes: 39 additions & 0 deletions bin/config.sh
@@ -0,0 +1,39 @@
#!/bin/sh

# resolve links - so that script can be called from any dir
PRG="$0"

while [ -h "$PRG" ]; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`/"$link"
fi
done

# Get standard environment variables
PRGDIR=`dirname "$PRG"`

WEB_DIR="$PRGDIR/../web"
JEEVES_DIR="$PRGDIR/../web"


#################################################
# The parameters below can be overridden in your personal
# configuration file if the default don't work
#################################################
DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"
OVERRIDES="-Dgeonetwork.jeeves.configuration.overrides.file=/WEB-INF/override-config-jeichar.xml"
MEMORY="-XX:MaxPermSize=256m -Xmx1024M -server"
DATA_DIR="$HOME/gc_data"
LOGGING="-Dfile.encoding=UTF8 -Dlog4j.debug=true -Dlog4j.configuration=file://$WEB_DIR/src/main/webapp/WEB-INF/log4j-jeichar.cfg"
DB="geocat2_trunk"
SQL_DIR="/usr/local/share/postgis/"
POSTGIS_INSTALL="template" # options are: "template" or "POSTGIS 2 create" or "POSTGIS 1 create"
export PG_PASSWORD="www-data"

# Load personal config file
CONFIG_FILE="config_`whoami`.sh"
. $CONFIG_FILE
3 changes: 3 additions & 0 deletions bin/config_fgravin.sh
@@ -0,0 +1,3 @@
DB=geocat2_trunk
SQL_DIR=/usr/lib/postgis/
POSTGIS_INSTALL="template"
3 changes: 3 additions & 0 deletions bin/config_fvanderbiest.sh
@@ -0,0 +1,3 @@
DB=geocat
SQL_DIR=/usr/local/share/postgis
POSTGIS_INSTALL="template"
3 changes: 3 additions & 0 deletions bin/config_jeichar.sh
@@ -0,0 +1,3 @@
DB=geocat2_trunk
SQL_DIR=/usr/local/share/postgis/
POSTGIS_INSTALL="POSTGIS 2 create"
23 changes: 23 additions & 0 deletions bin/start.sh
@@ -0,0 +1,23 @@
#!/bin/sh

set -x

. config.sh

if [ -z "$JREBEL_HOME" ] ; then
echo "you do not have JREBEL installed. If you want to use JREBEL install it and define JREBEL_HOME. It can be defined in the config.sh file in your profile"
else
JREBEL_OPTS="-noverify -javaagent:$JREBEL_HOME/jrebel.jar"
fi

export MAVEN_OPTS="$JREBEL_OPTS $DEBUG $OVERRIDES $MEMORY -Dgeonetwork.dir=$DATA_DIR "

cd $JEEVES_DIR
mvn install $@
if [ ! $? -eq 0 ]; then
echo "[FAILURE] [deploy] Failed to execute 'jeeves' correctly"
exit -1
fi

cd $WEB_DIR
mvn jetty:run -Penv-dev $@

0 comments on commit 98fa558

Please sign in to comment.