Rake command after deploy on Dokku

时间:2015-07-28 23:42:49

标签: ruby-on-rails deployment dokku

I'm running a RoR application with dokku on production.

What is the simplest way to automate and run a Optional<Integer> o = Optional.empty(); final List<Integer> list = o.stream().collect(Collectors.toList()); System.out.println(list); to clear my cache after every deploy?

2 个答案:

答案 0 :(得分:2)

现在我解决了使用Dokku的部署钩子插件:https://github.com/mlomnicki/dokku-deploy-hooks

使用已安装的插件,在app的根目录中创建名为“deploy / post-deploy”的文件。在这个文件里面只使用之前创建的rake。

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

部署后文件:

# deploy/post-deploy

rake cache:clear

现在每次部署都会执行rake:

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

答案 1 :(得分:0)

Simplest would be run the command provided below

add