문제

Wondering if anyone can help me setup locomotivecms with digital ocean. I am at the hosting point and the instructions are asking me to modify the production block in the carrierwave.rb file. Currently it is setup for AWS. What do I need to do to get digitalocean to work.

CarrierWave.configure do |config|

  config.cache_dir = File.join(Rails.root, 'tmp', 'uploads')

  case Rails.env.to_sym

  when :development
    config.storage = :file
    config.root = File.join(Rails.root, 'public')

  when :production
    # the following configuration works for Amazon S3
    config.storage          = :fog
    config.fog_credentials  = {
      provider:                 'AWS',
      aws_access_key_id:        ENV['S3_KEY_ID'],
      aws_secret_access_key:    ENV['S3_SECRET_KEY'],
      region:                   ENV['S3_BUCKET_REGION']
    }
    config.fog_directory    = ENV['S3_BUCKET']

  else
    # settings for the local filesystem
    config.storage = :file
    config.root = File.join(Rails.root, 'public')
  end

end
도움이 되었습니까?

해결책

It depends on where you want to store the files; you could just copy the configuration section from :development if you want to place uploaded files on your droplet, our LocomotiveCMS solution do just that and it works fine, however it wouldn't scale very well i.e. if you want multiple web servers to have access to uploaded files.

If you are using MongoDB with Carrierwave for Mongoid, then you could store your files in the database using the GridFS, however I don't have any experience with this myself. You can read more about it on Carrierwave Mongoid's GitHub page.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top