* accounts:run_deletions: was added with 0.4.0.0 two years ago for one-time usage. * db:rebuild: db:reset does basically the same * db:integration:preprare: the integration environments are not used. * db:reset: there is a default db:reset, no need to write our own. * db:drop_integration: the integration environments are not used. * db:fix_diaspora_handle: really old migration from 2010 * db:move_private_key: also old migration from 2010 * maintenance:clear_carrierwave_temp_uploads: tmp/uploads doesn't exist anymore. And we have CleanCachedFiles as cronjob. * maintenance:install_logrotate_config: diaspora has built-in logrotate support now, and people who want to use logrotate instead can write their own configs with the values they want. * migrations:copy_hidden_share_visibilities_to_users: old migration from 2012 * migrations:invitations: legacy invitations were removed with #6976 * migrations:absolutify_image_references: old migration from 2010 * migrations:rewire_uppercase_hashtags: old migration from 2012 * migrations:remove_uppercase_hashtags: old migration from 2012
58 lines
2 KiB
Ruby
58 lines
2 KiB
Ruby
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
namespace :migrations do
|
|
task :upload_photos_to_s3 do
|
|
require File.join(File.dirname(__FILE__), '..', '..', 'config', 'environment')
|
|
puts AppConfig.environment.s3.key
|
|
|
|
connection = Aws::S3.new( AppConfig.environment.s3.key, AppConfig.environment.s3.secret)
|
|
bucket = connection.bucket(AppConfig.environment.s3.bucket)
|
|
dir_name = File.dirname(__FILE__) + "/../../public/uploads/images/"
|
|
|
|
count = Dir.foreach(dir_name).count
|
|
current = 0
|
|
|
|
Dir.foreach(dir_name){|file_name| puts file_name;
|
|
if file_name != '.' && file_name != '..';
|
|
begin
|
|
key = Aws::S3::Key.create(bucket, 'uploads/images/' + file_name);
|
|
key.put(File.open(dir_name+ '/' + file_name).read, 'public-read');
|
|
key.public_link();
|
|
puts "Uploaded #{current} of #{count}"
|
|
current += 1
|
|
rescue => e
|
|
puts "error #{e} on #{current} (#{file_name}), retrying"
|
|
retry
|
|
end
|
|
end
|
|
}
|
|
end
|
|
|
|
CURRENT_QUEUES = %w(urgent high medium low default).freeze
|
|
|
|
desc "Migrate sidekiq jobs, retries, scheduled and dead jobs from any legacy queue to "\
|
|
"the default queue (retries all dead jobs)"
|
|
task :legacy_queues do
|
|
# Push all retries, scheduled and dead jobs to their queues
|
|
Sidekiq::RetrySet.new.retry_all
|
|
Sidekiq::DeadSet.new.retry_all
|
|
Sidekiq::ScheduledSet.new.reject {|job| CURRENT_QUEUES.include? job.queue }.each(&:add_to_queue)
|
|
|
|
# Move all jobs from legacy queues to the default queue
|
|
Sidekiq::Queue.all.each do |queue|
|
|
next if CURRENT_QUEUES.include? queue.name
|
|
|
|
puts "Migrating #{queue.size} jobs from #{queue.name} to default..."
|
|
queue.each do |job|
|
|
job.item["queue"] = "default"
|
|
Sidekiq::Client.push(job.item)
|
|
job.delete
|
|
end
|
|
|
|
# Delete the queue
|
|
queue.clear
|
|
end
|
|
end
|
|
end
|