codebuddies / dungeonbuddies

Multi User Dungeon Coded by codebuddies slack members
MIT License
6 stars 3 forks source link

Local server.pid file prevents docker container from starting back up #13

Closed angelocordon closed 5 years ago

angelocordon commented 5 years ago

In some instances, when starting the container back up after stopping, a log error pops up:

web_1  | A server is already running. Check /dungeonbuddies/tmp/pids/server.pid.

Running docker-compose ps to list container status returns:

     Name                      Command               State     Ports  
-------------------------------------------------------------------------
dungeonbuddies_db_1    docker-entrypoint.sh postgres    Up       5432/tcp
dungeonbuddies_web_1   bundle exec rails s -p 300 ...   Exit 1            

A quick and dirty solution is to remove the server.pid file in the above directory:

rm ./tmp/pids/server.pid

Also see: https://stackoverflow.com/questions/35022428/rails-server-is-still-running-in-a-new-opened-docker-container

However, logging this as an issue to keep track of how frequent this is happening and that we should look for ways around it so that restarting a container back up is more predictable.

stain88 commented 5 years ago

https://github.com/docker/compose/issues/1393

Some more discussion and workarounds.

angelocordon commented 5 years ago

Yeah, I like this comment here: https://github.com/docker/compose/issues/1393#issuecomment-100301533

angelocordon commented 5 years ago

24 fixes this issue with

https://github.com/codebuddies/dungeonbuddies/blob/0de8add75db7a3fbe95ff211e2f0cba3272c1372/docker-compose.yml#L19-L20

From https://auth0.com/blog/ruby-on-rails-killer-workflow-with-docker-part-1/

The second volume masks the tmp folder in the host OS so that all other project folders are available for the container except the tmp. When you run docker-compose down, this tmp folder within the container is wiped out.

angelocordon commented 5 years ago

Marking as closed in favor of #24