Accessing the rails console on Kamal?
The Rails console is a powerful tool for debugging, testing, and managing your Rails application. You can use it to interact with your application’s models, run queries, etc.
A common use case would be to check some data related to users, products or specific scenarios like users with specific attributes, etc.
With Kamal 2.0
With the introduction of aliases in Kamal 2.0 it’s easier to run the Rails console.
You can define aliases
in the deploy.yml
file:
aliases:
console: app exec --reuse -i "bin/rails console"
and then run the Rails console using the following command:
kamal console
With Kamal 1.x
With Kamal 1.x, you can run the Rails console using the following command:
kamal app exec -i --reuse "bin/rails console"