osu-cascades / tracing-resilience

A clearing house of childhood youth resilience measures for TRACES and United Way.
MIT License
0 stars 0 forks source link

Production: set up paperclip with S3 bucket #18

Closed nathanstruhs closed 6 years ago

nathanstruhs commented 6 years ago

@ybakos are we going use the same s3 bucket as BDA?

ybakos commented 6 years ago

Same auth keys but I need to create the bucket paths; it's on my list and will be done before Tuesday. Thanks for your patience.

ybakos commented 6 years ago

@nathanstruhs You're all set with the folders. Bucket: osucascades (use the existing auth tokens you have, let me know if you need them / I'll document in basecamp). folder: tracingresilience subfolders: staging, production and development (if necessary).

You can mimic the server env vars and paperclip config from ecotone.

ybakos commented 6 years ago

config/production.rb:

  config.paperclip_defaults = {
    storage: :s3,
    s3_region: ENV.fetch('AWS_REGION'),
    url: ":s3_domain_url",
    path: "/#{Rails.application.class.parent_name.downcase}/#{ENV.fetch('AWS_S3_ENV')}/:class/:attachment/:id/:style/:basename.:extension",
    s3_credentials: {
      bucket: ENV.fetch('AWS_S3_BUCKET'),
      access_key_id: ENV.fetch('AWS_S3_KEY'),
      secret_access_key: ENV.fetch('AWS_S3_SECRET'),
    }
  }
end