3
votes

I am building a Play2 Scala application which I run using typesafe activator tool. Currently I am trying to build generic dev environment using Vagrant and chef. The process goes well (environment is built and parameters are set) until the point where I need to run the activator script. The moment the server is up and app is started Vagrant stops my process, thus killing my app.

To try to explain this by giving more details: Once my environment is ready and I need to run activator 1) ...if I ssh into the box and run 'activator run' the app will start in the box and on my host machine I'll be able to hit xxx.xxx.xxx.xxx:9000 that I have defined in my Vagrantfile. App works just fine. The response I get in the virtual box command line is:

...
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)

2) ...if I run it from Vagrantfile (shell.inline = '/bin/bash /applications/activator-1.2.10-minimal/activator run') the same thing happens, with one change - my process is killed. The response is as follows:

...
==> default: --- (Running the application from SBT, auto-reloading is enabled) ---
==> default: [info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
==> default: (Server started, use Ctrl+D to stop and go back to the console...)
==> default: [success] Total time: 139 s, completed Sep 25, 2014 7:49:59 PM

In the background activator is running sbt...this is what gets executed:

exec java -Dactivator.home=/applications/activator-1.2.10-minimal -Xms1024m -Xmx1024m -XX:PermSize=64m -XX:MaxPermSize=256m -jar /applications/activator-1.2.10-minimal/activator-launch-1.2.10.jar run

I've tried to keep shell process alive, but that doesn't prevent Vagrant from closing my sbt process.

Does anyone have experience with a similar problem or an idea how to solve this issue?

Thanks,

1
just as a side note, checkout ansible (as a chef replacement), it's not that heavyweight - om-nom-nom
I have exactly the same issue. Tried the solution mentioned here but didn't work for me. Did you manage to find a workaround for this? - Jonathan
No, never in a satisfying way... I was able to find a workaround, but it was hacky and not what was useful enough. Sorry. - Nenad Samardzic

1 Answers

0
votes

I use gnu screen to run the activator script like this:

screen -h 10000 -d -m activator run