-1

Yesterday i tried to deploy my rails app to my own server. For deploy, i have followed gorails tutorial -> https://gorails.com/deploy/ubuntu/14.04. After deployed, finally my rails app has running live. But i have a problem when i try to create room module with image, i get error like this

We're sorry, but something went wrong.

If i create room without image, it success. I'm sure that i can't upload image.

gem 'paperclip'

room.rb

has_attached_file :image, :styles => { :for_index => "336x227>", :thumb => "150x150>" }, :default_url => "/images/:style/missing.png"

validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/

deploy.rb

lock '3.1.0'

set :application, 'hotelxxxxx'
set :repo_url, 'git@bitbucket.org:xxxxxx/hotelxxxxx.git'

set :deploy_to, '/home/xxxxxx/hotelxxxxx'

set :linked_files, %w{config/database.yml}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing, 'deploy:restart'
  after :finishing, 'deploy:cleanup'
end

How to fix that?

Sakti
  • 31
  • 10

2 Answers2

0

The first step to troubleshoot this issue would be to look at the Rails log on your server. It should be in the log/production.log file. Having the actual error message in the log would make it a lot easier to help you figure this out.

monfresh
  • 7,974
  • 1
  • 25
  • 22
  • i have log on into my server and my folder rails app. Open log/production.log but it's empty – Sakti Jan 20 '16 at 06:06
0

Finally image uploaded !! I see error from nginx error.log => 'Paperclip::Errors::NotIdentifiedByImageMagick'. After that i try to re-install imagemagick from https://www.enovate.co.uk/web-design-blog/2015/02/25/how-to-install-imagemagick-from-source-on-ubuntu-14.04/

Imagemagick re-install succeed and open config/application.rb in my rails app

config/application.rb

# add line
Paperclip.options[:command_path] = "/usr/local/bin/identify"

Deploy again

Sakti
  • 31
  • 10