Created
October 23, 2018 23:20
-
-
Save knoxjeffrey/bc75057e800cac4b88075a6b22de4cda to your computer and use it in GitHub Desktop.
Pull media from specified staging to production
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rake media:staging_to_production | |
# eg. rake media:staging_to_production | |
namespace :media do | |
desc 'Pull media from specified staging to production' | |
task :staging_to_production do | |
ssh_staging = Rails.application.credentials[:staging][:ssh] | |
ssh_staging_port = Rails.application.credentials[:staging][:ssh_port] | |
media_staging_remote = Rails.application.credentials[:staging][:media_remote] | |
media_production_remote = Rails.application.credentials[:production][:media_remote] | |
puts 'Copying media from staging to production...' | |
system "ssh #{ssh_staging} -t -p #{ssh_staging_port} sudo cp -rp #{media_staging_remote}/current/public/uploads/store/. #{media_production_remote}/current/public/uploads/store" | |
puts 'Done!' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment