I'm running a RoR application with dokku on production.
What is the simplest way to automate and run a rake to clear my cache after every deploy?
For now I solved using a deploy hook plugin for Dokku: https://github.com/mlomnicki/dokku-deploy-hooks
With the installed plugin, create a file named "deploy/post-deploy" in the root of app. Inside this file just use the rake previously created.
rake file:
# lib/tasks/clear-cache.rake
namespace :cache do
desc 'Clear all Cache'
task clear: :environment do
Rails.cache.clear
puts "=========== > ALL CACHES WERE GONE!"
end
end
post-deploy file:
# deploy/post-deploy
rake cache:clear
Now on every deploy the rake will be executed:
web| [12] * Preloading application
worker| Cache clear: flushing all keys
worker| Dalli::Server#connect
worker| =========== > ALL CACHES WERE GONE!
web| [12] * Listening on tcp://0.0.0.0:5000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With