Capistrano deploy file for Thin & NginX & SCM Git

지금 프로젝트에서 사용중인 Capistrano Deploy File.

잡다한 작업은 plugin에 맡기니 일이 확실히 줄어든다. Capistrano Bells Plugin 사용.

# pty setting
default_run_options[:pty] = true

# General configuration settiongs, required for all recipes!
set :application, "#{application_name}"
role :web, "#{webserver_domain}"
role :app, "#{appserver_domain}"
role :db, "#{dbserver_domain}", :primary => true

# User Setting
set :user, "production"

# Deployment Settings
set :repository, "#{repository_location}"
set :scm, :git
set :deploy_to, "#{deploy_location}"
set :deploy_via, :remote_cache
set :config_files, %w()

# Change this to :thin if you want to use Thin instead.
set :app_server, :thin

# =============================================================
# Application Server Settings (Thin or Mongrel)
# =============================================================
set :thin_servers, 3
set :thin_port, 7007
set :thin_environment, 'production'
set :thin_address, '127.0.0.1'
set :thin_conf, "#{shared_path}/config/thin.yml"

# =============================================================
# Nginx Settings
# =============================================================
set :nginx_sites_available, "/etc/nginx/sites-available"
set :nginx_sites_enabled, "/etc/nginx/sites-enabled"

after "deploy:update_code", "db:symlink"
after "db:symlink", "attachment:symlink"

namespace :db do
  desc "Make symlink for database yaml"
  task :symlink do
    run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  end
end

namespace :attachment do
  desc "Make symlink for attachment directory"
  task :symlink do
    run "ln -nfs #{shared_path}/attachments/article_images #{release_path}/public/images/article_images"
  end
end

Posted by Kenny Thu, 24 Apr 2008 08:41:00 GMT


Rails with NginX File Upload

Swfupload를 이용한 파일 업로드 시에 생겼던 문제.

사실 알고보면 단순한 문제인데, 원인 파악을 잘못해서 고생했었다.

413 에러가 계속 나는 문제였는데, 이 413에러를 Swfupload 쪽에서 보내는 걸로 착각한것. 서버에는 호출됐다는 로그가 안남고, swfupload 쪽에서는 계속 413에러를 내고, 해당 에러 메시지를 swfupload 쪽에서 찾아보면 UI_NO_CLASS_FOUND가 뜨고.. ;;; 대체 이게 뭔 에런지 거의 여덟시간을 헤멤.

결론은…. 너무나도 당연하게도 HTTP 413 메시지였다. ;;; Request entity too large. 맘 편하게 그냥 처음부터 HTTP 에러 메시지로 갔으면 쉬웠을 것을.. 괜히 swfupload랑 연결시켜서 생각하느라 시간낭비한 상황.

당연히, nginx의 vhost 설정에 clientmaxbody_size 50M 한줄 추가로 해결. ;;

좀 쉽게 가도 될 것을…

Posted by Kenny Thu, 24 Apr 2008 03:05:00 GMT