forked from mthenw/heroku-buildpack-vertx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d8f75df
Showing
4 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |