deploy.rb 1007 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. lock '3.14.1'
  3. set :repo_url, ENV.fetch('REPO', 'https://github.com/tootsuite/mastodon.git')
  4. set :branch, ENV.fetch('BRANCH', 'master')
  5. set :application, 'mastodon'
  6. set :rbenv_type, :user
  7. set :rbenv_ruby, File.read('.ruby-version').strip
  8. set :migration_role, :app
  9. append :linked_files, '.env.production', 'public/robots.txt'
  10. append :linked_dirs, 'vendor/bundle', 'node_modules', 'public/system'
  11. namespace :systemd do
  12. %i[sidekiq streaming web].each do |service|
  13. %i[reload restart status].each do |action|
  14. desc "Perform a #{action} on #{service} service"
  15. task "#{service}:#{action}".to_sym do
  16. on roles(:app) do
  17. # runs e.g. "sudo restart mastodon-sidekiq.service"
  18. sudo :systemctl, action, "#{fetch(:application)}-#{service}.service"
  19. end
  20. end
  21. end
  22. end
  23. end
  24. after 'deploy:publishing', 'systemd:web:reload'
  25. after 'deploy:publishing', 'systemd:sidekiq:restart'
  26. after 'deploy:publishing', 'systemd:streaming:restart'