mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Address feedback
This commit is contained in:
parent
d8215854fb
commit
4fb007cd60
1 changed files with 7 additions and 5 deletions
|
@ -10,7 +10,7 @@ Many of these tasks probably require [Capistrano::Rails](https://github.com/capi
|
||||||
From [Capistrano/Rails PR #209](https://github.com/capistrano/rails/pull/209)
|
From [Capistrano/Rails PR #209](https://github.com/capistrano/rails/pull/209)
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
namespace :ruby do
|
namespace :deploy do
|
||||||
desc 'Runs any rake task, cap deploy:rake task=db:rollback'
|
desc 'Runs any rake task, cap deploy:rake task=db:rollback'
|
||||||
task rake: [:set_rails_env] do
|
task rake: [:set_rails_env] do
|
||||||
on release_roles([:db]) do
|
on release_roles([:db]) do
|
||||||
|
@ -26,6 +26,10 @@ end
|
||||||
|
|
||||||
Passes in the rake task to be run via an environment variable. Also a simple example of running a rake task on the server.
|
Passes in the rake task to be run via an environment variable. Also a simple example of running a rake task on the server.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bundle exec cap production deploy:rake task=db:seed
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Conditional migrations
|
### Conditional migrations
|
||||||
|
|
||||||
|
@ -34,13 +38,11 @@ Arising from [Capistrano/Rails issue #199](https://github.com/capistrano/rails/i
|
||||||
A frequent issue on deploy are slow migrations which involve downtime. In this case, you often want to run the migrations conditionally, where the main deploy doesn't run them, but you can do so manually at a better point. To do so, you could put the following in your `Capfile`:
|
A frequent issue on deploy are slow migrations which involve downtime. In this case, you often want to run the migrations conditionally, where the main deploy doesn't run them, but you can do so manually at a better point. To do so, you could put the following in your `Capfile`:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
if ENV['RUN_MIGRATIONS'].present?
|
require 'capistrano/rails/migrations' if ENV['RUN_MIGRATIONS']
|
||||||
require 'capistrano/rails/migrations'
|
|
||||||
end
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Now the migrations do not run by default, but they will run with the following command:
|
Now the migrations do not run by default, but they will run with the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
RUN_MIGRATIONS=true bundle exec cap production deploy:migrate
|
RUN_MIGRATIONS=1 bundle exec cap production deploy:migrate
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue