Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8977555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:23:53+00:00 2026-06-15T19:23:53+00:00

I am trying to use Fog with Carrierwave and am getting this error in

  • 0

I am trying to use Fog with Carrierwave and am getting this error in the Unicorn log. I have fog in my gemfile and my NodeImageUploader calls

storage :fog

Gemfile

source 'http://rubygems.org'

gem 'rails', '3.2.8'
gem 'bcrypt-ruby', '3.0.1'
gem 'jquery-rails'
gem 'fog', '1.8.0'
gem 'bootstrap-sass', '~> 2.2.1.1'
gem 'devise'
gem 'omniauth-facebook'
gem 'rails-backbone'
gem 'simple_form'
# gem 'newrelic_rpm'
# gem 'client_side_validations'
gem 'inherited_resources'
gem 'friendly_id', '~> 4.0.1'
gem 'carrierwave'
gem 'activeadmin'
gem 'meta_search', '>= 1.1.0.pre'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'faker', '1.0.1'
gem 'rack-contrib'
gem 'soulmate', :git => "git://github.com/allotrop/soulmate.git", :require => 'soulmate/server'
gem 'httparty'
gem 'mini_magick'
gem 'mime-types'
gem 'redis'
gem 'pg', '0.12.2'
gem 'nokogiri', '1.5.5'
# gem "rmagick"

group :development, :test  do 
  gem 'rspec-rails', '2.11.0'
  gem 'guard-rspec', '0.5.5'
end

group :development do
  gem 'annotate', ">=2.5.0"
  #gem 'open-uri'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  # gem 'therubyracer', :platform => :ruby
  gem 'uglifier', '>= 1.0.3'
end

group :test do
  gem 'capybara', '1.1.2'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
  gem 'factory_girl_rails', '1.4.0'
  gem 'rb-inotify', '0.8.8'
  gem 'libnotify', '0.5.9'
  gem 'database_cleaner', '0.7.0'
  gem 'email_spec'
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
gem 'unicorn'

# Deploy with Capistrano
gem 'capistrano'

# To use debugger
 gem 'debugger', group: [:development, :test]
# gem 'rubber'
# gem 'open4'

config/carrierwave.rb

CarrierWave.configure do |config|
config.fog_credentials = {

 :aws_access_key_id => 'xxxx'
 :aws_secret_access_key => 'yyyy'
 :provider => 'AWS'
}
config.fog_directory = 'example-uploads'
config.fog_public = true
end

Doing bundle show fog gives me
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/fog-1.3.1

Also, I am able to use Carrierwave’s remote_image_url method in a rake task on production to successfully save images to S3. But, when I try to get any page of my app, I get this error.

unicorn.log

 E, [2012-12-11T20:49:28.872957 #23518] ERROR -- : You don't have the 'fog' gem installed (RuntimeError)
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `eval'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/storage/fog.rb:3:in `<top (required)>'
 (eval):1:in `storage'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `eval'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/carrierwave-0.7.1/lib/carrierwave/uploader/configuration.rb:73:in `storage'
/home/deployer/apps/allotrop/releases/20121211204621/app/uploaders/node_image_uploader.rb:24:in `<class:NodeImageUploader>'
/home/deployer/apps/allotrop/releases/20121211204621/app/uploaders/node_image_uploader.rb:5:in `<top (required)>'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in requi>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependenc>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:359:in `require_or_loa>
/home/deployer/apps/allotrop/shared/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:502:in `load_mis

The application works fine if I switch the uploader to storage :file and even when I use storage :fog in development. Where am I going wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:23:55+00:00Added an answer on June 15, 2026 at 7:23 pm

    After trying to fix this problem for the better part of the day, I fixed it by following the steps from Ryan Bates’ Railscasts episode on zero downtime deployment. The changes mentioned by him are to add preload_app in your unicorn template and use a USR2 signal for unicorn restart.

    unicorn.rb.erb

    # Load rails+github.git into the master before forking workers
    # for super-fast worker spawn times
    preload_app true
    
    before_fork do |server, worker|
    
      # Disconnect since the database connection will not carry over
      if defined? ActiveRecord::Base
        ActiveRecord::Base.connection.disconnect!
      end
    
      ##
      # When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
      # immediately start loading up a new version of itself (loaded with a new
      # version of our app). When this new Unicorn is completely loaded
      # it will begin spawning workers. The first worker spawned will check to
      # see if an .oldbin pidfile exists. If so, this means we've just booted up
      # a new Unicorn and need to tell the old one that it can now die. To do so
      # we send it a QUIT.
      #
      # Using this method we get 0 downtime deploys.
    
      old_pid = "#{server.config[:pid]}.oldbin"
      if File.exists?(old_pid) && server.pid != old_pid
        begin
          Process.kill("QUIT", File.read(old_pid).to_i)
        rescue Errno::ENOENT, Errno::ESRCH
          # someone else did our job for us
        end
      end
    end
    
    after_fork do |server, worker|
      ##
      # Unicorn master loads the app then forks off workers - because of the way
      # Unix forking works, we need to make sure we aren't using any of the parent's
      # sockets, e.g. db connection
      # Start up the database connection again in the worker
    
      if defined?(ActiveRecord::Base)
        ActiveRecord::Base.establish_connection
      end
    
      # Redis and Memcached would go here but their connections are established
      # on demand, so the master never opens a socket
    end
    

    unicorn_init.erb

    restart|reload)
      sig USR2 && echo reloaded OK && exit 0
      echo >&2 "Couldn't reload, starting '$CMD' instead"
      run "$CMD"
      ;;
    

    Then you need to run cap:unicorn:setup unicorn:stop unicorn:start. If anyone is facing this issue, I highly recommend seeing the Railscasts on Capistrano recipes and zero downtime deployment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When i'm trying to run my application, i'm getting the following error: config/initializers/carrierwave.rb:4: undefined
I am trying use gem tire to search in my application. I have tables
Hi I'm trying use a datepicker on a field I have. I'm trying to
I am need paint my image. I'm trying use JQuery in here this link:
trying to use hibernate with my web app and getting following exception: Initial SessionFactory
I have been trying use the edit_post_link() function to contain an image. All of
I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
I'm trying use to selenium with firefox on CentOS from command line like this:
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
i'm trying use webview to load a image from sdcard i use this path

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.