lagom-scala-sbt-standalone
A basic example of building a Lagom project (in Scala) to run outside of the Lightbend Production Suite (aka ConductR).
This was initially created from the lagom-scala
template (sbt new lagom/lagom-scala.g8
), with the following changes:
- Set
lagomKafkaEnabled
&lagomCassandraEnabled
tofalse
. - Added a static service location to hello-impl for cas_native (the Cassandra server).
- Added a static service location to hello-stream-impl for Kafka service (unnamed).
To test this:
- Open a terminal and clone the repository to your workstation (
git clone https://github.com/knoldus/lagom-scala-sbt-standalone.git
) cd lagom-scala-sbt-standalone
sbt
to enter the sbt consoleproject knol-impl
to selectknol-impl
module.dist
(from the sbt prompt) to create distribution package.- Press control-C to exit
sbt
console. - Start Cassandra Server - https://www.datastax.com/2012/01/getting-started-with-cassandra
- Start Kafka Server - https://kafka.apache.org/quickstart#quickstart_download
cd lagom-scala-sbt-standalone/knol-impl/target/universal
unzip knol-impl-0.1.0-SNAPSHOT.zip
- Set the following environment varaibles:
export APP_LIB=knol-impl-0.1.0-SNAPSHOT/lib
export APP_CLASSPATH=$APP_LIB/*
export JAVA_OPTS=""
export JMX_CONFIG=""
export PLAY_SECRET=none
export CONFIG_FILE=/path/to/lagom-scala-sbt-standalone/knol-impl/src/main/resources/application.conf
export CONFIG="-Dplay.crypto.secret=$PLAY_SECRET -Dlagom.cluster.join-self=off -Dorg.xerial.snappy.use.systemlib=true -Dconfig.file=$CONFIG_FILE"
export PLAY_SERVER_START="play.core.server.ProdServerStart"
- At last run the Lagom service -
java -cp "$APP_CLASSPATH" $JAVA_OPTS $JMX_CONFIG $CONFIG $PLAY_SERVER_START
This runs each of the services as single-node clusters.
You can press control-C to exit the services.