Coder Social home page Coder Social logo

bcms_s3's Introduction

A BrowserCMS module to allow storage of images and files on the Amazon S3 storage facility

Using S3 for file storage

To enable S3 file storage set Cms::S3.enabled in config/initializers/browsercms.rb (create this if it does not exist) to true. Ensure that you as provide a s3.yml file that contains your credentials and bucket. This should be in the following format

access_key_id: your AWS access key
secret_access_key: your AWS secret access key
bucket: your unique bucket name

Using this module with Heroku

If using this module in conjunction with deployment on heroku you should probably turning heroku caching on by setting Cms::S3.heroku_caching in config/initializers/browsercms.rb to true.

In order to avoid putting your secret AWS key in the s3.yml file, you can take advantage of heroku's config vars. Use ERB to read the values from the environment. This way you can safely commit your s3.yml file to the repository without revealing your amazon credentials.

access_key_id: <%= ENV['s3_access_key_id'] %>
secret_access_key: <%= ENV['s3_secret_access_key'] %>
bucket: <%= ENV['s3_bucket'] %>

For developing on your local machine, export the s3 variables to your environment.

export s3_access_key_id='your AWS access key'
export s3_secret_access_key='your AWS secret access key'
export s3_bucket='your unique bucket name'

Set the config vars on heroku to get it working there as well.

heroku config:add s3_access_key_id='your AWS access key'
heroku config:add s3_secret_access_key='your AWS secret access key'
heroku config:add s3_bucket='your unique bucket name'

www prefix for non cms urls

If your non cms domain is www.myapp.com rather than app.com this can be enabled by setting Cms::S3.www_domain_prefix in config/initializers/browsercms.rb to true.

Important things to note

  1. The s3.yml should be excluded from public repositories (e.g github) since it contains your secret AWS key which should never be revealed to the public.
  2. Changing from local storage to S3 storage will require you to re-upload all your files (or copy the tree to s3)
  3. This module requires the RightAWS gem from RightScale (sudo gem install right_aws)
Based on original work on S3 storage for BrowserCMS by Neil Middleton

bcms_s3's People

Contributors

antunderwood avatar austinmoore avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.