Accessing the Rails console on PWS
- June 10, 2017
One of the common requests when running Rails apps on Pivotal Web services is how do I get a rails console to do some inspection of my app. In the past, there wasn’t a way to access the terminal, but that was changed with the addition of the ‘cf ssh’ command to the Cloud Foundry cf CLI tool. Theoretically, you would be able to access the rails console once you shelled in. However that’s not the case.
However, there is a work around, by typing the following:
$ cf ssh myapp -t -c “/tmp/lifecycle/launcher /home/vcap/app ‘rails c’ ””
Substitute myapp with the name of your app.
Now admittedly that is a workaround. So a more elegant solution is in the public backlog which is available in this Pivotal Tracker story. Cloud Foundry, find out what’s under the covers and better yet, make a contribution.