How can I auto-deploy Play Framework (2.4) application with Jenkins locally on the same server Jenkins is running? At some point we're going to set up a proper production environment separately and will probably implement test environment(s) in the same way but at this point I'd like to check out whether it is possible to set up a simple test environment to the same server Jenkins is running.
I have a Jenkins job running tests and it seems to work OK. Basically "Execute shell" running activator commands (that could be combined to one line).
./activator clean
./activator test
With Play 1 I've used play start
& play stop
for similar things. Trying activator start
on my dev env, I get the message:
The start command is deprecated, and will be removed in a future version of Play.
To run Play in production mode, run 'stage' instead, and then execute the generated start script in target/universal/stage/bin.
To test your application using production mode, run 'testProd' instead.
So I evaluated two (incomplete) alternatives with "Execute shell" & stage:
Stage & run with nohup:
./activator clean
./activator stage
nohup target/universal/stage/bin/my-app -Dplay.evolutions.db.default.autoApply=true
-> application started OK but the Jenkins task did not stop.
Stage & run with nohup on background:
./activator clean
./activator stage
nohup target/universal/stage/bin/my-app -Dplay.evolutions.db.default.autoApply=true &
-> application seems to have started to some point but did not keep on running?
What would be the preferred (or even only working) way here?
For the particular case I ended up using Docker:
and this seems to work pretty nicely so far.