Repository URL to install this package:
|
Version:
0.0.2 ▾
|
capistrano-public-cache
/
README.md
|
|---|
Cache dynamic pages into your public folder on deploy.
Add this line to your application's Gemfile:
gem 'capistrano', '~> 3.1.0' gem 'capistrano-public-cache'
And then execute:
$ bundle
Or install it yourself as:
$ gem install capistrano-public-cache
Require in Capfile to use the default task:
require 'capistrano/public-cache'
The task will run after deploy:published as part of Capistrano's default deploy, or can be run in isolation with cap public_cache:build
Configurable options:
set :public_cache_roles, :web # this is default set :public_cache_base_url, '' # this is default set :public_cache_curl_flags, '-sS' # this is default set :public_cache_files, {} # this is default
Some notes about configuration:
:public_cache_base_url and :public_cache_files as their default values will result in nothing happening when the task is run.:public_cache_base_url should be set to the base URL of your application, e.g. http://youapp.com, http://localhost:5000, etc.:public_cache_files should be a hash where the keys are the source path of the content you want to cache and the values are the file path (relative to your deployment's public directory) where you want it cached.:public_cache_curl_flags can be a string of flags to pass through to curl. We like to use -sS --retry 5, which keeps curl silent except when failure occurs and also retries up to five times in case our application is taking its time starting up.We like to manage our application's error pages within Rails, but it's a good idea to have static versions available for the web server to use too. As such, our configuration usually looks like this:
set :public_cache_files, '/errors/404' => '404.html', '/errors/422' => '422.html', '/errors/500' => '500.html',
git checkout -b my-new-feature)git commit -am 'Add some feature')git push origin my-new-feature)