diff --git a/Gemfile b/Gemfile index aa10beb5c..0de267cfb 100644 --- a/Gemfile +++ b/Gemfile @@ -12,7 +12,7 @@ gem 'cancan', '~> 1.6.7' #gem 'bitmask_attributes' gem "haml-rails", '~> 0.3.4' -gem "compass", '~> 0.11.5' +# gem "compass", '~> 0.11.5' # update when it will be needed gem 'jammit' gem "yui-compressor", "0.9.5" # Higher versions depends on Platform gem which conflicts with Platform model gem 'rails3-jquery-autocomplete' @@ -33,7 +33,7 @@ gem 'delayed_job' # gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git' gem "rails-xmlrpc", '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git' -gem 'passenger', '~> 3.0.11' +# gem 'passenger', '~> 3.0.11' gem 'unicorn', '~> 4.1.1' group :production do diff --git a/Gemfile.lock b/Gemfile.lock index 88235f8bf..ee0589a47 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,13 +53,8 @@ GEM capistrano (>= 1.0.0) capistrano_colors (0.5.5) chronic (0.6.6) - chunky_png (1.2.5) cocaine (0.2.0) columnize (0.3.5) - compass (0.11.5) - chunky_png (~> 1.2) - fssm (>= 0.2.7) - sass (~> 3.1) daemon_controller (0.2.6) daemons (1.1.4) delayed_job (2.1.4) @@ -78,7 +73,6 @@ GEM factory_girl (~> 2.3.0) railties (>= 3.0.0) fastthread (1.0.7) - fssm (0.2.7) grit (2.4.1) diff-lcs (~> 1.1) mime-types (~> 1.15) @@ -190,7 +184,6 @@ GEM sexp_processor (~> 3.0) russian (0.6.0) i18n (>= 0.5.0) - sass (3.1.11) sexp_processor (3.0.8) silent-postgres (0.1.1) thor (0.14.6) @@ -221,7 +214,6 @@ DEPENDENCIES capistrano capistrano-ext capistrano_colors - compass (~> 0.11.5) delayed_job devise (~> 1.5.2) factory_girl_rails (~> 1.4.0) diff --git a/config/unicorn.rb b/config/unicorn.rb index 48f230a83..9ee6624a2 100644 --- a/config/unicorn.rb +++ b/config/unicorn.rb @@ -5,17 +5,16 @@ preload_app true working_directory File.expand_path(File.join(File.dirname(__FILE__), "..")) # available in 0.94.0+ -#listen '/tmp/rosa_build.sock', :backlog => 2048 -#listen "/tmp/.sock", :backlog => 64 +# listen '/tmp/rosa_build.sock', :backlog => 2048 +# listen "/tmp/.sock", :backlog => 64 listen 8080, :tcp_nopush => true -# -#nuke workers after 30 seconds instead of 60 seconds (the default) + +# nuke workers after 30 seconds instead of 60 seconds (the default) timeout 1200 -# -#feel free to point this anywhere accessible on the filesystem + +# feel free to point this anywhere accessible on the filesystem pid File.expand_path(File.join(File.dirname(__FILE__), "..")) + '/tmp/pids/unicorn.pid' -# # REE # http://www.rubyenterpriseedition.com/faq.html#adapt_apps_for_cow if GC.respond_to?(:copy_on_write_friendly=) diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP index f2dba85aa..558ca8b4f 100644 --- a/doc/README_FOR_APP +++ b/doc/README_FOR_APP @@ -1,5 +1,3 @@ === Basic bootstrap * rake db:drop db:setup == - -rvmsudo passenger-install-nginx-module --nginx-source-dir=/opt/src/nginx-1.0.10 --extra-configure-flags=--add-module=/opt/src/nginx_upload_module-2.2.0 diff --git a/doc/nginx_upload_module.md b/doc/nginx_upload_module.md new file mode 100644 index 000000000..134699d50 --- /dev/null +++ b/doc/nginx_upload_module.md @@ -0,0 +1,62 @@ +===================== Nginx compile + +rvmsudo passenger-install-nginx-module --nginx-source-dir=/opt/src/nginx-1.0.10 --extra-configure-flags=--add-module=/opt/src/nginx_upload_module-2.2.0 + +===================== Nginx config + +server { + listen 80; + server_name rosa-build.local www.rosa-build.local; + # server_name rosa-build.rosalab.ru; + # server_name npp-build.rosalab.ru; + + client_max_body_size 1G; + root /Users/pasha/Sites/rosa-build/public; + + # Match this location for the upload module + location ~* ^\/platforms\/([0-9]+)\/products/([0-9]+)$ { + error_page 405 = @rails; # fallback to rails + + # pass request body to rails + # upload_pass @rails; + upload_pass @upload; + + # Store files to this directory + # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist + # i.e. make sure to create /u/apps/bugle/shared/uploads_tmp/0 /u/apps/bugle/shared/uploads_tmp/1 etc. + # upload_store /u/apps/bugle/shared/uploads_tmp 1; + upload_store /tmp; # /srv/rosa_build/shared/tmp + + # set permissions on the uploaded files + upload_store_access user:rw group:rw all:r; + + # Set specified fields in request body this puts the original filename, new path+filename and content type in the requests params + upload_set_form_field $upload_field_name[name] "$upload_file_name"; + upload_set_form_field $upload_field_name[content_type] "$upload_content_type"; + upload_set_form_field $upload_field_name[path] "$upload_tmp_path"; + upload_aggregate_form_field $upload_field_name[size] "$upload_file_size"; + + upload_pass_form_field "^.+$"; # "^theme_id$|^blog_id$|^authenticity_token$|^format$" + upload_cleanup 400 404 499 500-505; + } + + location / { + try_files /system/maintenance.html $uri $uri/index.html $uri.html @rails; + } + + location @rails { + passenger_enabled on; + passenger_use_global_queue on; + # rails_env production; + # proxy_pass http://localhost:8080; + # proxy_pass http://unix:/tmp/rosa_build.sock; + # proxy_redirect http://localhost/ http://$host:$server_port/; + # proxy_read_timeout 1200; + } + + location @upload { + proxy_pass http://localhost:8080; + # proxy_pass http://unix:/tmp/rosa_build.sock; + # proxy_redirect http://localhost/ http://$host:$server_port/; + } +} diff --git a/lib/ext/paperclip.rb b/lib/ext/paperclip.rb index b41f9275a..665a8995e 100644 --- a/lib/ext/paperclip.rb +++ b/lib/ext/paperclip.rb @@ -1,28 +1,29 @@ -module Paperclip - class Attachment - class UploadedPath - attr_reader :original_filename, :content_type, :size, :path - def initialize(uploaded_file) - @original_filename = uploaded_file["name"].downcase - @content_type = uploaded_file["content_type"].to_s.strip - @file_size = uploaded_file["size"].to_i - @path = uploaded_file["path"] - end - - # TODO remove failed files - - def to_tempfile; self; end - - def size; @file_size; end - - def close; end - def closed?; true; end - end - - def assign_with_upload(uploaded_file) - uploaded_file = UploadedPath.new(uploaded_file) if uploaded_file.is_a?(Hash) - assign_without_upload(uploaded_file) - end - alias_method_chain :assign, :upload - end -end +# Patch to use paperclip with nginx upload module +# module Paperclip +# class Attachment +# class UploadedPath +# attr_reader :original_filename, :content_type, :size, :path +# def initialize(uploaded_file) +# @original_filename = uploaded_file["name"].downcase +# @content_type = uploaded_file["content_type"].to_s.strip +# @file_size = uploaded_file["size"].to_i +# @path = uploaded_file["path"] +# end +# +# # TODO remove failed files +# +# def to_tempfile; self; end +# +# def size; @file_size; end +# +# def close; end +# def closed?; true; end +# end +# +# def assign_with_upload(uploaded_file) +# uploaded_file = UploadedPath.new(uploaded_file) if uploaded_file.is_a?(Hash) +# assign_without_upload(uploaded_file) +# end +# alias_method_chain :assign, :upload +# end +# end diff --git a/lib/tasks/import.rake b/lib/tasks/import.rake index df7972a43..277428b8f 100644 --- a/lib/tasks/import.rake +++ b/lib/tasks/import.rake @@ -9,7 +9,7 @@ namespace :import do print "Import #{name}..." owner = User.find(1) # I am # owner = Group.find(1) # Core Team - p = Project.find_or_create_by_name_and_name(name, name) {|p| p.owner = owner} + p = Project.find_or_create_by_name(name) {|p| p.owner = owner} puts p.persisted? ? "Ok!" : "Fail!" end puts 'DONE' diff --git a/vendor/plugins/diff-display/tasks/deployment.rake b/vendor/plugins/diff-display/lib/tasks/deployment.rake similarity index 100% rename from vendor/plugins/diff-display/tasks/deployment.rake rename to vendor/plugins/diff-display/lib/tasks/deployment.rake diff --git a/vendor/plugins/diff-display/tasks/environment.rake b/vendor/plugins/diff-display/lib/tasks/environment.rake similarity index 100% rename from vendor/plugins/diff-display/tasks/environment.rake rename to vendor/plugins/diff-display/lib/tasks/environment.rake diff --git a/vendor/plugins/diff-display/tasks/website.rake b/vendor/plugins/diff-display/lib/tasks/website.rake similarity index 100% rename from vendor/plugins/diff-display/tasks/website.rake rename to vendor/plugins/diff-display/lib/tasks/website.rake