Skip to content

Commit

Permalink
Merge pull request #181 from tomjadams/tom/heroku_deploy_fix
Browse files Browse the repository at this point in the history
Fix heroku deployments for template project
  • Loading branch information
capotej committed Jan 7, 2015
2 parents 60e72d8 + d4f3bc7 commit ad0cb53
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 23 deletions.
13 changes: 5 additions & 8 deletions script/finatra/libexec/finatra-new
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ echo " creating build.sbt"
cp $_FINATRA_ROOT/share/build.sbt $root_path/$project_name/
echo " creating build.properties"
cp $_FINATRA_ROOT/share/build.properties $root_path/$project_name/project
echo " creating project/assembly.sbt"
cp $_FINATRA_ROOT/share/assembly_plugin.sbt $root_path/$project_name/project
echo " creating assembly.sbt"
cp $_FINATRA_ROOT/share/assembly.sbt $root_path/$project_name/
echo " creating project/plugins.sbt"
cp $_FINATRA_ROOT/share/plugins.sbt $root_path/$project_name/project
echo " creating .env"
cp $_FINATRA_ROOT/share/dot-env $root_path/$project_name/.env
echo " creating README"
cp $_FINATRA_ROOT/share/README.markdown $root_path/$project_name/
echo " creating Procfile"
Expand Down Expand Up @@ -115,6 +115,7 @@ sed -ie "s/###PROJECT_NAME###/$project_name/g" $root_path/$project_name/bower.js

# edit Procfile
sed -ie "s/###PACKAGE_NAME###/$package_name/g" $root_path/$project_name/Procfile
sed -ie "s/###PROJECT_NAME###/$project_name/g" $root_path/$project_name/Procfile

# replace the spec with the latest example spec
replace_with_example_spec $_FINATRA_ROOT/share/AppSpec.scala $test_path/AppSpec.scala
Expand All @@ -134,9 +135,6 @@ sed -ie "s/###PROJECT_NAME###/$project_name/g" $root_path/$project_name/README.m
#edit build.sbt
sed -ie "s/###PROJECT_NAME###/$project_name/g" $root_path/$project_name/build.sbt

#edit assembly.sbt
sed -ie "s/###PROJECT_NAME###/$project_name/g" $root_path/$project_name/assembly.sbt

if [ $snapshot_version ]; then
sed -ie "s/###VERSION###/$snapshot_version/g" $root_path/$project_name/pom.xml
else
Expand All @@ -154,7 +152,6 @@ rm -rf $root_path/$project_name/pom.xmle
rm -rf $root_path/$project_name/README.markdowne
rm -rf $root_path/$project_name/build.sbte
rm -rf $root_path/$project_name/bower.jsone
rm -rf $root_path/$project_name/assembly.sbte
rm -rf $dest_path/App.scalae
rm -rf $root_path/$project_name/Procfilee
rm -rf $test_path/AppSpec.scalae
Expand Down
2 changes: 1 addition & 1 deletion script/finatra/share/Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: java -Dcom.twitter.finatra.config.env=production -Dcom.twitter.finatra.config.adminPort='' -Dcom.twitter.finatra.config.port=:$PORT -cp target/classes:target/dependency/* ###PACKAGE_NAME###.App
web: target/universal/stage/bin/###PROJECT_NAME### -Dcom.twitter.finatra.config.env=$ENV -Dcom.twitter.finatra.config.adminPort=$ADMIN_PORT -Dcom.twitter.finatra.config.port=:$PORT
29 changes: 23 additions & 6 deletions script/finatra/share/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Finatra requires either [maven](http://maven.apache.org/) or [sbt](http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html) to build and run your app.

The `.env` file is used to configure Heroku environment variables locally. See [heroku's docs](https://devcenter.heroku.com/articles/config-vars) for more information. *Do not check it into source control!*.


## SBT Instructions

### Runs your app on port 7070
Expand All @@ -12,10 +15,9 @@ Finatra requires either [maven](http://maven.apache.org/) or [sbt](http://www.sc

sbt test

### Packaging (fatjar)

sbt assembly
### Packaging

sbt stage

## Maven Instructions

Expand All @@ -31,14 +33,29 @@ Finatra requires either [maven](http://maven.apache.org/) or [sbt](http://www.sc

mvn package


## Heroku

Install [heroku toolbelt](https://toolbelt.heroku.com/).

You may also need to install foreman:

gem install foreman

### To put on heroku

heroku create
heroku login
git init
heroku create --buildpack https://github.com/heroku/heroku-buildpack-scala.git
heroku config:set ENV=production
git add .
git commit -am "Initial commit"
git push heroku master

### To run locally like it does on heroku

foreman start web

### To run anywhere else

java -jar target/*-0.0.1-SNAPSHOT-jar-with-dependencies.jar
./target/universal/stage/bin/<appname>

5 changes: 0 additions & 5 deletions script/finatra/share/assembly.sbt

This file was deleted.

1 change: 0 additions & 1 deletion script/finatra/share/assembly_plugin.sbt

This file was deleted.

2 changes: 1 addition & 1 deletion script/finatra/share/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.0
sbt.version=0.13.5
6 changes: 5 additions & 1 deletion script/finatra/share/build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import NativePackagerKeys._

packageArchetype.java_application

name := "###PROJECT_NAME###"

version := "0.0.1-SNAPSHOT"

scalaVersion := "2.10.3"
scalaVersion := "2.10.4"

libraryDependencies ++= Seq(
"com.twitter" %% "finatra" % "###VERSION###"
Expand Down
3 changes: 3 additions & 0 deletions script/finatra/share/dot-env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PORT=7070
ADMIN_PORT=:9990
ENV=development
1 change: 1 addition & 0 deletions script/finatra/share/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-RC1")

0 comments on commit ad0cb53

Please sign in to comment.