Commit 0675822e by wynksaiddestroy Committed by Tute Costa

Improve deployment instructions

Capistrano won't symlink the `public/system` folder by default anymore.
Capistrano needs to be configured accordingly.

See related issues:

* https://github.com/capistrano/capistrano/commit/033bf8ee492936787cd0744e69b3df8a5ad5b6e6#diff-348edd3e734eaeed0fe97af037f3c647
* https://github.com/capistrano/rails/issues/104
* https://github.com/capistrano/rails#symlinks

[fixes #2141]
[fixes #2166]
parent 3ef5f952
...@@ -53,6 +53,7 @@ https://github.com/thoughtbot/paperclip/releases ...@@ -53,6 +53,7 @@ https://github.com/thoughtbot/paperclip/releases
- [Dynamic Processors:](#dynamic-processors) - [Dynamic Processors:](#dynamic-processors)
- [Logging](#logging) - [Logging](#logging)
- [Deployment](#deployment) - [Deployment](#deployment)
- [Attachment Styles](#attachment-styles)
- [Testing](#testing) - [Testing](#testing)
- [Contributing](#contributing) - [Contributing](#contributing)
- [License](#license) - [License](#license)
...@@ -566,8 +567,8 @@ The files that are assigned as attachments are, by default, placed in the ...@@ -566,8 +567,8 @@ The files that are assigned as attachments are, by default, placed in the
directory specified by the `:path` option to `has_attached_file`. By default, this directory specified by the `:path` option to `has_attached_file`. By default, this
location is `:rails_root/public/system/:class/:attachment/:id_partition/:style/:filename`. location is `:rails_root/public/system/:class/:attachment/:id_partition/:style/:filename`.
This location was chosen because, on standard Capistrano deployments, the This location was chosen because, on standard Capistrano deployments, the
`public/system` directory is symlinked to the app's shared directory, meaning it `public/system` directory can be symlinked to the app's shared directory, meaning it
will survive between deployments. For example, using that `:path`, you may have a survives between deployments. For example, using that `:path`, you may have a
file at file at
/data/myapp/releases/20081229172410/public/system/users/avatar/000/000/013/small/my_pic.png /data/myapp/releases/20081229172410/public/system/users/avatar/000/000/013/small/my_pic.png
...@@ -829,6 +830,16 @@ More information in the [rdocs](http://www.rubydoc.info/github/thoughtbot/paperc ...@@ -829,6 +830,16 @@ More information in the [rdocs](http://www.rubydoc.info/github/thoughtbot/paperc
Deployment Deployment
---------- ----------
To make Capistrano symlink the `public/system` directory so that attachments
survive new deployments, set the `linked_dirs` option in your `config/deploy.rb`
file:
```ruby
set :linked_dirs, fetch(:linked_dirs, []).push('public/system')
```
### Attachment Styles
Paperclip is aware of new attachment styles you have added in previous deploys. The only thing you should do after each deployment is to call Paperclip is aware of new attachment styles you have added in previous deploys. The only thing you should do after each deployment is to call
`rake paperclip:refresh:missing_styles`. It will store current attachment styles in `RAILS_ROOT/public/system/paperclip_attachments.yml` `rake paperclip:refresh:missing_styles`. It will store current attachment styles in `RAILS_ROOT/public/system/paperclip_attachments.yml`
by default. You can change it by: by default. You can change it by:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment