Ruby on Rails Saturday, November 8, 2014

 

I'm having the problem when i am using amazon s3 services

the error is

Excon::Errors::SocketError in PhotosController#create   getaddrinfo: Name or service not known (SocketError)}

This error occur when i try to save the image.

config/initializers/carrierwave.rb

CarrierWave.configure do |config|  config.fog_credentials = {  :provider               => 'AWS',                          :aws_access_key_id      => 'XXXXX',                          :aws_secret_access_key  => 'YYYYY',                          :region                 => 'us-east-1',                    :host                   => 's3.example.com',               :endpoint               => 'https://s3.example.com:8080' 

}

config.fog_directory  = 'My_bucket_name'                         config.fog_public     = false                              config.fog_attributes = {'Cache-Control'=>"max-age=#{365.day.to_i}"} 

end

i am using figaro.gem

config/application.yml

SECRET_KEY_BASE: aaaaaa   AWS_ACCES_KEY_ID: XXXXXX  AWS_SECRET_ACCESS_KEY: YYYYYY  AWS_BUCKET: "My_bucket_name"

Gemfile

gem 'rails', '4.1.4'  gem 'mysql2'  gem 'carrierwave'  gem 'fog'  gem 'aws-sdk'  gem "figaro"

app/uploaders/picture_uploader.rb

class PictureUploader < CarrierWave::Uploader::Base    storage :fog      def store_dir  'uploads/data'  end      end

i followed this site               http://blog.thefirehoseproject.com/posts/switching-carrierwave-to-use-s3-with-heroku-and-localhost/                 and didn't made any changes other configurations.

i have deployed my application to heroku. i want to upload images/videos to that application. can anyone help or suggest me to how to upload images/videos to heroku with using carrierwave.

Thanks advance

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1b4a6c03-c7b0-483b-90bb-426a3bb6a095%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment