env :PATH, '/root/.rbenv/shims:/root/.rbenv/bin:/usr/local/bin:/usr/bin:/bin'

set :path, '/var/www/btrc-hub/backend'
set :environment, 'production'
set :output, standard: '/var/log/btrc_hub_nico_sync.log',
             error:    '/var/log/btrc_hub_nico_sync_err.log'

job_type :rake,
         'cd :path && set -a && . /etc/btrc-hub/backend.env && set +a && ' \
         ':environment_variable=:environment bundle exec rake :task --silent :output'

every 1.day, at: '11:00 am' do
  rake 'nico:sync', environment: 'production'
end

every 1.day, at: '0:00 am' do
  rake 'post_similarity:calc', environment: 'production'
  rake 'tag_similarity:calc', environment: 'production'
end

every 1.day, at: '7:50 am' do
  rake 'nico:export', environment: 'production'
end

every :hour do
  rake 'post:sync', environment: 'production'
end
