Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
mthenw committed Mar 6, 2014
0 parents commit d8f75df
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Heroku buildpack: Vert.x

This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for [Vert.X](http://vertx.io/) apps.

Currently it uses following versions:

* JDK **1.7**
* vert.x **2.0.2-final**

## Usage

This buildpack assumes that there are at least two files in repository:

* ```mod.json``` - used to determine if this is vert.x project
* ```server.js``` - by default file that will be launched (of course this can be overrided by Procfile)

Example usage:

$ ls
mod.json server.js

$ heroku create --stack cedar --buildpack https://github.com/mthenw/heroku-buildpack-vertx.git

$ git push heroku master

-----> Heroku receiving push
-----> Fetching custom build pack... done
-----> Vert.x app detected
-----> Installing Vert.x..... done

This buildpack is based on [tomaslin/heroku-buildpack-vertx-jdk7](https://github.com/tomaslin/heroku-buildpack-vertx-jdk7).

## License

MIT
70 changes: 70 additions & 0 deletions bin/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>

# fail fast
set -e

OPENJDK7_URL="https://s3.amazonaws.com/heroku-jvm-langpack-java/openjdk7-u2-heroku-temaki.tar.gz"
VERTX_URL="http://dl.bintray.com/vertx/downloads/vert.x-2.0.2-final.tar.gz"

BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2

#create the cache dir if it doesn't exist
mkdir -p $CACHE_DIR

cd $BUILD_DIR
if [ -d "$CACHE_DIR/.jdk7" ]; then
echo -n "Copying JDK to app directory"
cp -r "$CACHE_DIR/.jdk7" $BUILD_DIR
echo "done"
fi

if [ ! -d "$BUILD_DIR/.jdk7" ]; then
echo -n "-----> Installing OpenJDK7u2 build (to .jdk7)....."
mkdir "$BUILD_DIR/.jdk7"
cd "$BUILD_DIR/.jdk7"
curl --max-time 180 --location $OPENJDK7_URL | tar xz
cd $BUILD_DIR
cp -r .jdk7 $CACHE_DIR/.jdk7
echo " done"
fi

if [ -d "$CACHE_DIR/.vertx" ]; then
echo -n "Copying Vert.x to app direcotry"
cp -r "$CACHE_DIR/.vertx" $BUILD_DIR
echo " done"
fi

if [ ! -d "$BUILD_DIR/.vertx" ]; then
echo -n "-----> Installing Vert.x build (to .vertx)....."
curl --max-time 320 --location $VERTX_URL | tar xz
mv vert* .vertx
rm '.vertx/bin/vertx.bat'
cd $BUILD_DIR
cp -r .vertx $CACHE_DIR/.vertx
echo " done"
fi

cd $BUILD_DIR

export JAVA_HOME="$BUILD_DIR/.jdk7"
export VERTX_HOME="$BUILD_DIR/.vertx"
export PATH=$PATH:$JAVA_HOME/bin:$VERTX_HOME/bin

echo "Path is set to"
echo $PATH

if [ -f compile.sh ]; then
echo 'compile.sh file found, executing...'
chmod 700 compile.sh
./compile.sh
fi

# Warn if no Procfile is present
if [ ! -f Procfile ]; then
echo "-----> No Procfile found. Will use the following default process: "
echo " vertx run server.js"
fi
8 changes: 8 additions & 0 deletions bin/detect
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# bin/use <build-dir>

if [ -f $1/mod.json ]; then
echo "Vert.x" && exit 0
else
echo "no" && exit 1
fi
20 changes: 20 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
# bin/release <build-dir>

BUILD_DIR=$1

cat <<EOF
---
config_vars:
PATH: .jdk7/bin:.vertx/bin:.tools:/usr/local/bin:/usr/bin:/bin
JAVA_OPTS: -Xmx384m
addons:
shared-database:5mb
EOF

if [ ! -f $BUILD_DIR/Procfile ]; then
cat <<EOF
default_process_types:
web: vertx run server.js
EOF
fi

0 comments on commit d8f75df

Please sign in to comment.