Skip to content

Instantly share code, notes, and snippets.

@jesperfj
Created September 15, 2011 17:45
Show Gist options
  • Save jesperfj/1219936 to your computer and use it in GitHub Desktop.
Save jesperfj/1219936 to your computer and use it in GitHub Desktop.
Grails LP
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
# fail fast
set -e
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2
if [ ! -d $CACHE_DIR ] ; then
mkdir $CACHE_DIR
fi
cd $CACHE_DIR
# install grails
GRAILS_URL="http://lang-pack-grails.s3.amazonaws.com/grails-1.3.7.tar.gz"
if [ ! -d .grails ]; then
echo -n "-----> Installing Grails 1.3.7....."
# curl --silent --max-time 60 --location $GRAILS_URL | tar xz
curl --silent --location $GRAILS_URL | tar xz
mv grails-1.3.7 .grails
echo " done"
fi
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk
export GRAILS_HOME=$CACHE_DIR/.grails
export PATH=$GRAILS_HOME/bin:$PATH
cd $BUILD_DIR
# build app
BUILDCMD="grails war"
echo "-----> executing $BUILDCMD"
$BUILDCMD 2>&1 | sed -u 's/^/ /'
if [ "${PIPESTATUS[*]}" != "0 0" ]; then
echo " ! Failed to build app"
exit 1
fi
if [ ! -d server ] ; then
echo "-----> No server directory found. Adding jetty-runner 7.5.0.v20110901 automatically."
echo " To use your own server, read http://devcenter.heroku.com/articles/grails-custom-server."
mkdir server
cp $GRAILS_HOME/jetty-runner-7.5.0.v20110901.jar server/jetty-runner.jar
fi
#!/usr/bin/env bash
# bin/use <build-dir>
if [ -d $1/grails-app ]; then
echo "Grails" && exit 0
else
echo "no" && exit 1
fi
#!/usr/bin/env bash
# bin/release <build-dir>
BUILD_DIR=$1
cat <<EOF
---
config_vars:
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
addons:
shared-database:5mb
default_process_types:
web: java \$JAVA_OPTS -jar server/jetty-runner.jar --port \$PORT target/*.war
EOF
@jsimone
Copy link

jsimone commented Sep 15, 2011

Jetty runner 7.5.1.v20110908 is out. I wonder if this is something that we should copy down in a more generic way so that we can update the version without an LP deploy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment