无法在生产中上传回形针图像(AWS)

时间:2013-10-02 19:44:22

标签: ruby-on-rails paperclip capistrano

我的回形针上传产品似乎有问题。我已经与Capistrano一起部署到AWS。以下是我尝试为用户上传图片时收到的错误。

Started GET "/" for 127.0.0.1 at 2013-10-02 19:40:48 +0000
Processing by PagesController#home as */*
  Rendered pages/home.html.erb within layouts/application (1.1ms)
Completed 200 OK in 6ms (Views: 6.0ms | ActiveRecord: 0.0ms | Solr: 0.0ms)
Started PUT "/users/19" for 98.198.30.70 at 2013-10-02 19:41:09 +0000
Processing by UsersController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"0cCRXGjztCv0vs3sxdEcv98aEKTzGcNOXumh6hYPVMU=", "user"=>{"username"=>"chicken", "email"=>"cc@cc.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "avatar"=>#<ActionDispatch::Http::UploadedFile:0x00000006f95f00 @original_filename="download.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"user[avatar]\"; filename=\"download.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20131002-766-swwl63>>}, "commit"=>"Update Profile", "id"=>"19"}
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: convert '/tmp/download20131002-766-1bap7m5.jpg[0]' -auto-orient -resize "150x150>" '/tmp/download20131002-766-1bap7m520131002-766-12kdsu8'
Command :: file -b --mime '/tmp/download20131002-766-1bap7m520131002-766-12kdsu8'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: convert '/tmp/download20131002-766-1bap7m5.jpg[0]' -auto-orient -resize "300x300>" '/tmp/download20131002-766-1bap7m520131002-766-d8rgc4'
Command :: file -b --mime '/tmp/download20131002-766-1bap7m520131002-766-d8rgc4'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: convert '/tmp/download20131002-766-1bap7m5.jpg[0]' -auto-orient -resize "100x100>" '/tmp/download20131002-766-1bap7m520131002-766-138s58z'
Command :: file -b --mime '/tmp/download20131002-766-1bap7m520131002-766-138s58z'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: identify -format %m '/tmp/download20131002-766-1bap7m5.jpg[0]'
Command :: convert '/tmp/download20131002-766-1bap7m5.jpg[0]' -auto-orient -resize "50x50>" '/tmp/download20131002-766-1bap7m520131002-766-wyvzz0'
Command :: file -b --mime '/tmp/download20131002-766-1bap7m520131002-766-wyvzz0'
Completed 500 Internal Server Error in 3695ms

Errno::EEXIST (File exists - /home/app/xxx.com/current/public/system):
  app/controllers/users_controller.rb:94:in `update'

这是视图生成的图像链接:

<img alt="10-m" src="/system/styles/dimages/000/000/519/original/10-m.jpg?1379454321">

然而,当我尝试浏览我的应用程序中的这个目录时,我不能。也许这是一个权限问题? 系统的文件夹名称显示为红色

app@mothership:~/xxx.com/current/public$ ls
403.html  404.html  422.html  500.html  assets  favicon.ico  robots.txt  system
app@mothership:~/xxx.com/current/public$ cd system
-bash: cd: system: No such file or directory

1 个答案:

答案 0 :(得分:3)

Paperclip正在尝试创建/home/app/xxx.com/current/public/system目录,但它已经存在了。这可能是由于Capistrano部署中的符号链接无效。

检查文件并使用ls -l查看,看看它是否是指向正确位置的符号链接。如果没有,请通过创建目标或更改位置来更新符号链接。