I used the bash library in lambacd to invoke my deployment script.
(defn deploy [args ctx]
(shell/bash ctx (:cwd args) "./deploy.sh"))
I put a very simple deploy.sh with certain code snippet like this:
cd ~/backend && nohup java -Dconf=~/backend/config.edn -jar ~/backend/clj-crm.jar &
exit 0
It looked normal to me, but in practice, the deploy never finished. When I took a look from pstree. I saw something like
--- deploy.sh --- java ...
It looked like deploy.sh was blocked by my service. However, I have used nohup command and &.
I changed my code snippet to something like:
tmux new-session -d -s backend 'cd ~/backend && java -Dconf=~/backend/config.edn -jar ~/backend/clj-crm.jar'
exit 0
This time, the deploy could successfully finish, was not blocked by java service anymore. However, I still do not understand why.