rishimaharaj
rishimaharaj

Reputation: 1706

How to start Play using Bamboo without having the deployment continue forever?

We have created a Play application in Java and are deploying it to a dev-environment virtual machine using Atlassian Bamboo's SSH task: cd path/to/application/directory && start "" play run. This goes to the proper location, launches a new console, and starts play: the server is started successfully and we can access the site with no issues.

The problem is that the deployment task in Bamboo never stops because it is still monitoring the console where play run was called -- in the Bamboo status, we are seeing things like Deploying for 7,565 minutes. We thought adding the start "" would fix that issue, but in Bamboo it is the same as just doing the play run. Also, when we need to redeploy, we must first stop the deployment in process, and manually relaunch it.

Two questions:

  1. How can we start the server from Bamboo in such a way that the deployment plan finishes?
  2. How can we stop/kill the previous server from Bamboo at the beginning of the next deployment?

Upvotes: 1

Views: 1691

Answers (4)

Demel
Demel

Reputation: 307

For Windows: make task with type "Script" and interperter "Windows PowerShell". In script body type "Start-Process ". It works 100%.

Upvotes: 1

For Windows you can run background tasks using Groovy script. Groovy can execute an external program as an process:

"/bin/application.exe".execute()

And then you can check that application is running:

println "tasklist /fi \"imagename eq application.exe\"".execute().text

Upvotes: 1

Avner
Avner

Reputation: 4556

not at all familiar with WAMP stack or the play cli, but try running it as a powershell command, which should run in and exit immediately

powershell -command "& <your command here>"

or failing that

powershell -command "& start-job { <your command here>} "

Upvotes: 1

i.am.michiel
i.am.michiel

Reputation: 10404

Bamboo is pretty bad for background tasks. Had a similar problem, eventually, we wrote a bash script that was run in background.

start.sh &1> /dev/null &2 > /dev/null &

Upvotes: 1

Related Questions