1
0

deploy.rb 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # frozen_string_literal: true
  2. lock '3.17.2'
  3. set :repo_url, ENV.fetch('REPO', 'https://github.com/mastodon/mastodon.git')
  4. set :branch, ENV.fetch('BRANCH', 'main')
  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. SYSTEMD_SERVICES = %i[sidekiq streaming web].freeze
  12. SERVICE_ACTIONS = %i[reload restart status].freeze
  13. namespace :systemd do
  14. SYSTEMD_SERVICES.each do |service|
  15. SERVICE_ACTIONS.each do |action|
  16. desc "Perform a #{action} on #{service} service"
  17. task :"#{service}:#{action}" do
  18. on roles(:app) do
  19. # runs e.g. "sudo restart mastodon-sidekiq.service"
  20. sudo :systemctl, action, "#{fetch(:application)}-#{service}.service"
  21. end
  22. end
  23. end
  24. end
  25. end
  26. after 'deploy:publishing', 'systemd:web:reload'
  27. after 'deploy:publishing', 'systemd:sidekiq:restart'
  28. after 'deploy:publishing', 'systemd:streaming:restart'