- Add a new file
stop_rails.sh
in the root of your RoR application with this content
#!/bin/sh
rails_pid=$(cat tmp/pids/server.pid)
kill "$rails_pid"
echo "Rails stopped with PID $rails_pid"
-
Add execution permission for that file
chown +x stop_rails.sh
-
Open RubyMine "Run / Debug Configurations" popup and add a new "shell script"
-
Name it "Stop Rails" and choose Execute: Script Text
-
Paste this script into the Script Text text field:
docker exec -it my-rails-container-name ./stop_rails.sh
Please change my-rails-container-name with your rails docker container name -
Open the existing Rails developmemt configuration, change "docker-compose" mode to "exec"
-
Into before launch section click on the (+) button and choose "Run another configuration" from the list and select "Stop Rails"
Now you can restart rails without need to restart its (and its linked) containers in just a couple of seconds, without the need to wait a full container restart.