Skip to content

Instantly share code, notes, and snippets.

@seanhandley
Last active October 12, 2015 13:45
Show Gist options
  • Save seanhandley/f2ae2a4c855d04dcf96c to your computer and use it in GitHub Desktop.
Save seanhandley/f2ae2a4c855d04dcf96c to your computer and use it in GitHub Desktop.
Separate Assets Host
# Use rsync during your deployment process to sync
rake assets:precompile
rsync -avzhe ssh /home/rails/my_app/public/* user@assets.example.com:/public_html/
# Now your Rails app will fetch assets from the assets server
# Set Rails to use your new assets host
Rails.application.configure do
# ...
# Generate digests for assets URLs.
config.assets.digest = true
config.action_controller.asset_host = "//assets.example.com"
config.action_mailer.asset_host = config.action_controller.asset_host
# ...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment