Skip to content

Commit

Permalink
Update rails.md
Browse files Browse the repository at this point in the history
It occupied me quite a while figuring out why this sample didn't have a restart policy. And why we where supposed to always properly stop the containers wheres you normally would simply hit `Ctrl+C`.

Turned out that this `pid` issue is a rails-specific issue. docker/compose#1393 (comment)

And of course there's already [a Gem for fixing that](https://github.com/lorenzosinisi/shutup) but having the one-liner in the `docker-compose.yml` keeps the logic where it belongs to (and now also is treated here in the sample).
  • Loading branch information
leymannx authored and Paige Hargrave committed Jan 2, 2019
1 parent e6edbdd commit 3238740
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion compose/rails.md
Expand Up @@ -47,11 +47,13 @@ to link them together and expose the web app's port.
services:
db:
image: postgres
restart: always
volumes:
- ./tmp/db:/var/lib/postgresql/data
web:
build: .
command: bundle exec rails s -p 3000 -b '0.0.0.0'
restart: always
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/myapp
ports:
Expand Down

0 comments on commit 3238740

Please sign in to comment.