Skip to content

Instantly share code, notes, and snippets.

@ilyakava
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyakava/f8c3c93f51dbec08f021 to your computer and use it in GitHub Desktop.
Save ilyakava/f8c3c93f51dbec08f021 to your computer and use it in GitHub Desktop.

Setup for heroku for snowplow scala apps

  1. obfuscate access keys in conf as: ${AWS_ACCESS_KEY_ID}
    • if you get a error like adf, make sure resolve() the config file like: ConfigFactory.parseFile(new File("conf/application.conf")).resolve()
  2. add addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.8.0-M1") to project/plugins.sbt and .settings(com.typesafe.sbt.SbtNativePackager.packageArchetype.java_application: _*) to wherever val project is defined (project/ScalaCollectorBuild.scala)
    • this provides the sbt stage task that heroku runs to compile
    • be careful to skip every other line in plugins.sbt
  3. add java.runtime.version=1.7 to system.properties in repo root
  4. add worker: ./target/universal/stage/bin/name-of-my-app --config myconf.conf to Procfile in repo root, check name of executable after sbt compile stage
    • don't use sh here, heroku runs Ubuntu with dash not bash

Setup for heroku for snowplow java apps

  1. obfuscate access keys in conf as: ${AWS_ACCESS_KEY_ID}
  2. add java.runtime.version=1.7 to system.properties in repo root
  3. ensure that the jar compiles with mvn clean package, include maven-shade-plugin like so otherwise
  4. add worker: java $JAVA_OPTS -jar ./target/kinesis-redshift-sink-0.0.1.jar to Procfile in repo root, check name of executable jar after mvn clean package
  5. delete gpg signing plugin option in mvn pom.xml if it exists

Deployment on heroku

  • push to heroku
  • heroku config:set AWS_ACCESS_KEY_ID=... and the same for AWS_SECRET_ACCESS_KEY
  • heroku ps:scale worker=1 to run the "worker" process defined in Procfile. In the case of the collector app which binds and listens on a port, run the web process
  • heroku logs -t to verify
@joeyAghion
Copy link

Maybe this should go in the README.

@ilyakava
Copy link
Author

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