Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Typesafe Console/Atmos to monitor actor system/scala app. Running from IntelliJ IDEA or any other IDE

Writing a program in Scala with actor system.

Need to monitor it with Atmos (Typesafe console)

Found documentation to this using sbt or Eclipse, problem is im looking for a way to :

  1. Restart/start typesafe console on each run from my IDE
  2. Run the app with the needed java opt
  3. Open the console on each run
  4. Do this automatically

any link to a nice wiki / doc for this issue ?

thanks

like image 748
Nimrod007 Avatar asked Jan 12 '14 10:01

Nimrod007


1 Answers

This is how i solved this issue in the end (my dev machine is Ubuntu 12.04) :

  • Download typesafe console from : http://downloads.typesafe.com/typesafe-console-developer/1.3.1/typesafe-console-developer-1.3.1.zip

  • Extract it to (were using the path /opt/ ) and give permissions to read/write from that folder

  • Fix your projects dependency (http://resources.typesafe.com/docs/console/manual/getting-started.html)

  • Create a runnable script to restart the console (put the script in /usr/bin/runAtmos.sh)

script example :

#this will restart atmos 
FILE=`find /opt -name typesafe-console | head -1`
BASEDIR=$(dirname $FILE)
echo "Starting Atmos (this may take a few seconds)"
kill -9 `ps aux | grep atmos | grep -v grep |  awk '{print $2}'`
kill -9 `ps aux | grep typesafe-console | grep -v grep |  awk '{print $2}'`
rm -f $BASEDIR/../var/RUNNING_PID
nohup $FILE atmos > /var/log/typesafe-console/console.log &
sleep 5
nohup $FILE ui > /var/log/typesafe-console/ui.log &
sleep 4
firefox "http://localhost:9900"
exit
  • Go to IntelliJ, to your app, run configuration and add the VM options :
-javaagent:/opt/typesafe-console-developer-1.3.1/lib/weaver/aspectjweaver.jar
-Dorg.aspectj.tracing.factory=default
-Djava.library.path=/opt/typesafe-console-developer-1.3.1/lib/sigar

screen shot :

enter image description here

  • Add "Before lunch -> "external tool" -> "run external tool"

screen shot :

External tool

External tool 2

  • In your application.conf file add :


akka {
    loggers = ["com.typesafe.atmos.trace.Slf4jTraceContextLogger"]
    loglevel = "INFO"
}

atmos { trace { enabled = true traceable { "*" = on }

sampling { "*" = 1 } }}
  • Now you can run your app from the IDE and get it working with typesafe console

Hope this helps!

like image 177
Nimrod007 Avatar answered Nov 14 '22 21:11

Nimrod007