3

I've just recently updated my phoenix application to 0.16.0. And I am following the docs related to deployment.

Everything has gone relatively smoothly until now. The phoenix docs tell you to setup a upstart script as such:

description "test phoenix app"

## Uncomment the following two lines to run the
## application as www-data:www-data
setuid phoenix
setgid phoenix

start on runlevel [2345]
stop on runlevel [016]

expect stop
respawn

env MIX_ENV=prod
export MIX_ENV

## Uncomment the following two lines if we configured
## our port with an environment variable.
#env PORT=8888
#export PORT

## Add app HOME directory.
env HOME="/home/phoenix"
export HOME


pre-start exec /bin/sh /test_app/bin/test_app start

post-stop exec /bin/sh /test_app/bin/test_app stop

This script succeeds in starting the application, but when I run initctl stop phoenix upstart tells me it has stopped phoenix, but after running a ps aux|grep phoenix I can see that the application is still very much running and the server is still returning 200 at localhost:4000.

I'm perplexed!

Raj
  • 22,346
  • 14
  • 99
  • 142
switchflip
  • 403
  • 1
  • 5
  • 13

1 Answers1

0

I don't have enough rep to comment, so I'm adding this as an answer.

I think the issue here is that the following line

pre-start exec /bin/sh /test_app/bin/test_app start

is spawning processes which are not under control of upstart. Instead, try the following line instead:

 pre-start exec /bin/sh /test_app/bin/test_app foreground

This should ensure that the spawned processes still belong to upstart. You should then be able to stop it normally.

Monty
  • 99
  • 6