I was successfully able to deploy a phoenix application using the aws elastic beanstalk interface.
I then tried to deploy a processing application to a different aws elastic beanstalk interface.
The docker files are almost identical, except for the fact that for phoenix, I do a simple:
CMD MIX_ENV=prod mix phx.server
and all is fine.
For the processing application however, I tried doing:
CMD MIX_ENV=prod iex -S mix and this is not working.
I get a deployment error stating that the docker quitted unexpectingly. Checking
docker ps -a reveals that it exited with status 0, which indicates that for some reason or the other, docker thinks the container is finished running and exits accordingly. When I change the line to
CMD ['bash'] and then I enter the docker and manually run
MIX_ENV=prod iex -S mix it works just fine. The entire app works and runs as required.
I concluded that there must be some extra options required that phx.server provides. I also looked into how distillery seems to handle foreground persistence. I eventually did the following:
CMD MIX_ENV=prod iex --erl "-noshell -noinput +Bd" -S mix run
FOREGROUNDOPTIONS="-noshell -noinput +Bd"
Now the deployment works, the docker is up and running but my app is not working.
I do not need distillery for my project, so I would not like to add it in just for the sake of being able to run a release as foreground.