ydkn--capistrano-rails-console/README.md

87 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2013-11-09 14:49:28 +00:00
# Capistrano::Rails::Console
2016-09-16 18:44:22 +00:00
Remote rails console and dbconsole for capistrano.
2013-11-09 14:49:28 +00:00
## Installation
Add this line to your application's Gemfile:
2015-02-10 20:00:25 +00:00
```ruby
gem 'capistrano-rails-console', require: false
2015-02-10 20:00:25 +00:00
```
2013-11-09 14:49:28 +00:00
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-rails-console
2013-11-09 14:49:28 +00:00
## Usage
You should ensure there is a `rails` binstub in the `current/bin` directory on the server otherwise
this gem won't work (because rails itself won't work).
If you experience any problems please verify that manually running `rails console` on the server does work.
2018-06-09 16:15:22 +00:00
If it doesn't you are deploying your rails application wrong (check [#18](https://gitlab.com/ydkn/capistrano-rails-console/issues/18) or [#26](https://gitlab.com/ydkn/capistrano-rails-console/issues/26) for details)!
2013-11-09 14:49:28 +00:00
Require in `Capfile` to use the default task:
2015-02-10 20:00:25 +00:00
```ruby
require 'capistrano/rails/console'
```
2013-11-09 14:49:28 +00:00
2016-09-16 18:44:22 +00:00
Run a remote rails console with:
2013-11-09 14:49:28 +00:00
$ cap production rails:console
$ cap production rails:c
2013-11-09 14:49:28 +00:00
You can also start a sandbox session:
$ cap production rails:console sandbox=1
2016-09-16 18:44:22 +00:00
Or run a dbconsole:
$ cap production rails:dbconsole
2017-07-17 13:26:50 +00:00
$ cap production rails:db
2016-09-16 18:44:22 +00:00
2016-09-15 22:39:27 +00:00
## Options
### Rails environment
```ruby
2016-09-16 15:14:03 +00:00
set :console_env, :production # use different environment than deployment environment (rails_env)
2016-09-15 22:39:27 +00:00
```
### User
```ruby
2016-09-16 15:14:03 +00:00
set :console_user, :appuser # run rails console as appuser through sudo
set :console_user, nil # explicitly disable switching user through sudo
2016-09-15 22:39:27 +00:00
```
2018-02-03 21:06:01 +00:00
### Role
```ruby
set :console_role, :app # start remote console on primary server for this role
```
2018-02-03 22:12:13 +00:00
### Shell
```ruby
set :console_shell, '/bin/bash' # select shell to be used on server in case you experience problems (see #31)
```
2013-11-09 14:49:28 +00:00
## Contributing
2018-06-09 16:15:22 +00:00
Bug reports and pull requests are welcome on GitLab at https://gitlab.com/ydkn/capistrano-rails-console.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).