S3 Asset Sync

This gem provides a simple way of syncronizing your Rails 4 assets with an AWS S3 Bucket.

Installation

gem 's3_asset_sync'

Configuration

Run the following command to generate a configuration file in your Rails /config/initializers folder.

rake s3_asset_sync:setup

Edit that file and replace the default values with your own AWS details.

Usage

By default, assets will be syncronized automatically after precompilation:

rake assets:precompile

If this is not the desired behaviour then simply edit the configuration value as below:

Rails.application.config.s3_asset_sync.run_after_precompile = false

To manually syncronize assets run:

rake assets:sync_to_s3

Deleting Assets

Expired assets won’t be automatically removed from S3 as some nodes within a load balanced setup may temporarily require older assets. To delete expired assets from S3 run:

rake assets:purge_s3