Last active
January 1, 2016 14:49
-
-
Save crhan/8159771 to your computer and use it in GitHub Desktop.
deploy rails app to remote server, which has a limited internet access.
This file contains hidden or 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
# config/deploy.rb | |
namespace :deploy do | |
desc "check local vendor/cache" | |
task :bundled_package do | |
run_locally do | |
unless test "[[ -d #{File.expand_path("../../vendor/cache", __FILE__)} ]]" | |
error "please `bundle package --all` first!" | |
raise StandardError | |
end | |
end | |
end | |
desc "upload vendor/cache for local gem install" | |
task :upload_vendor_cache do | |
on roles(:app) do | |
upload! File.expand_path("../../vendor/cache", __FILE__), | |
"#{shared_path}/vendor", | |
recursive: true | |
end | |
end | |
end |
This file contains hidden or 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
# config/deploy/production.rb | |
# link vendor/cache | |
set :linked_dirs, fetch(:linked_dirs, []).push("vendor/cache") | |
# check local vendor/cache first | |
before "deploy:starting", "deploy:bundled_package" | |
# upload cache to remote | |
before "bundler:install", "deploy:upload_vendor_cache" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment