Commit 6f5f5e7ee32bbd693796571fa6fcb8575accc08a

Authored by Dmitriy Zaporozhets
1 parent cefd8fe2

Add suppoort of unicorn and fog gems

@@ -59,8 +59,9 @@ gem "haml-rails" @@ -59,8 +59,9 @@ gem "haml-rails"
59 59
60 # Files attachments 60 # Files attachments
61 gem "carrierwave" 61 gem "carrierwave"
  62 +
62 # for aws storage 63 # for aws storage
63 -# gem "fog", "~> 1.3.1" 64 +gem "fog", "~> 1.3.1", group: :aws
64 65
65 # Authorization 66 # Authorization
66 gem "six" 67 gem "six"
@@ -76,7 +77,8 @@ gem "github-markup", "~> 0.7.4", require: 'github/markup' @@ -76,7 +77,8 @@ gem "github-markup", "~> 0.7.4", require: 'github/markup'
76 gem "asciidoctor" 77 gem "asciidoctor"
77 78
78 # Servers 79 # Servers
79 -gem "puma", '~> 2.0.1' 80 +gem "puma", '~> 2.3.1', group: :puma
  81 +gem "unicorn", '~> 4.6.3', group: :unicorn
80 82
81 # State machine 83 # State machine
82 gem "state_machine" 84 gem "state_machine"
@@ -116,6 +116,7 @@ GEM @@ -116,6 +116,7 @@ GEM
116 erubis (2.7.0) 116 erubis (2.7.0)
117 escape_utils (0.2.4) 117 escape_utils (0.2.4)
118 eventmachine (1.0.3) 118 eventmachine (1.0.3)
  119 + excon (0.13.4)
119 execjs (1.4.0) 120 execjs (1.4.0)
120 multi_json (~> 1.0) 121 multi_json (~> 1.0)
121 factory_girl (4.2.0) 122 factory_girl (4.2.0)
@@ -131,6 +132,16 @@ GEM @@ -131,6 +132,16 @@ GEM
131 eventmachine (>= 0.12.0) 132 eventmachine (>= 0.12.0)
132 ffaker (1.16.0) 133 ffaker (1.16.0)
133 ffi (1.8.1) 134 ffi (1.8.1)
  135 + fog (1.3.1)
  136 + builder
  137 + excon (~> 0.13.0)
  138 + formatador (~> 0.2.0)
  139 + mime-types
  140 + multi_json (~> 1.0)
  141 + net-scp (~> 1.0.4)
  142 + net-ssh (>= 2.1.3)
  143 + nokogiri (~> 1.5.0)
  144 + ruby-hmac
134 font-awesome-rails (3.1.1.3) 145 font-awesome-rails (3.1.1.3)
135 railties (>= 3.2, < 5.0) 146 railties (>= 3.2, < 5.0)
136 foreman (0.63.0) 147 foreman (0.63.0)
@@ -243,6 +254,7 @@ GEM @@ -243,6 +254,7 @@ GEM
243 kaminari (0.14.1) 254 kaminari (0.14.1)
244 actionpack (>= 3.0.0) 255 actionpack (>= 3.0.0)
245 activesupport (>= 3.0.0) 256 activesupport (>= 3.0.0)
  257 + kgio (2.8.0)
246 launchy (2.2.0) 258 launchy (2.2.0)
247 addressable (~> 2.3) 259 addressable (~> 2.3)
248 letter_opener (1.1.0) 260 letter_opener (1.1.0)
@@ -267,6 +279,9 @@ GEM @@ -267,6 +279,9 @@ GEM
267 multipart-post (1.2.0) 279 multipart-post (1.2.0)
268 mysql2 (0.3.11) 280 mysql2 (0.3.11)
269 net-ldap (0.3.1) 281 net-ldap (0.3.1)
  282 + net-scp (1.0.4)
  283 + net-ssh (>= 1.99.1)
  284 + net-ssh (2.6.8)
270 nokogiri (1.5.9) 285 nokogiri (1.5.9)
271 oauth (0.4.7) 286 oauth (0.4.7)
272 oauth2 (0.8.1) 287 oauth2 (0.8.1)
@@ -305,7 +320,7 @@ GEM @@ -305,7 +320,7 @@ GEM
305 coderay (~> 1.0.5) 320 coderay (~> 1.0.5)
306 method_source (~> 0.8) 321 method_source (~> 0.8)
307 slop (~> 3.4) 322 slop (~> 3.4)
308 - puma (2.0.1) 323 + puma (2.3.1)
309 rack (>= 1.1, < 2.0) 324 rack (>= 1.1, < 2.0)
310 pygments.rb (0.4.2) 325 pygments.rb (0.4.2)
311 posix-spawn (~> 0.3.6) 326 posix-spawn (~> 0.3.6)
@@ -354,6 +369,7 @@ GEM @@ -354,6 +369,7 @@ GEM
354 rake (>= 0.8.7) 369 rake (>= 0.8.7)
355 rdoc (~> 3.4) 370 rdoc (~> 3.4)
356 thor (>= 0.14.6, < 2.0) 371 thor (>= 0.14.6, < 2.0)
  372 + raindrops (0.11.0)
357 rake (10.0.4) 373 rake (10.0.4)
358 rb-fsevent (0.9.3) 374 rb-fsevent (0.9.3)
359 rb-inotify (0.9.0) 375 rb-inotify (0.9.0)
@@ -400,6 +416,7 @@ GEM @@ -400,6 +416,7 @@ GEM
400 rspec-core (~> 2.13.0) 416 rspec-core (~> 2.13.0)
401 rspec-expectations (~> 2.13.0) 417 rspec-expectations (~> 2.13.0)
402 rspec-mocks (~> 2.13.0) 418 rspec-mocks (~> 2.13.0)
  419 + ruby-hmac (0.4.0)
403 ruby-progressbar (1.0.2) 420 ruby-progressbar (1.0.2)
404 rubyntlm (0.1.1) 421 rubyntlm (0.1.1)
405 rubyzip (0.9.9) 422 rubyzip (0.9.9)
@@ -499,6 +516,10 @@ GEM @@ -499,6 +516,10 @@ GEM
499 execjs (>= 0.3.0) 516 execjs (>= 0.3.0)
500 multi_json (~> 1.0, >= 1.0.2) 517 multi_json (~> 1.0, >= 1.0.2)
501 underscore-rails (1.4.4) 518 underscore-rails (1.4.4)
  519 + unicorn (4.6.3)
  520 + kgio (~> 2.6)
  521 + rack
  522 + raindrops (~> 0.7)
502 virtus (0.5.4) 523 virtus (0.5.4)
503 backports (~> 2.6.1) 524 backports (~> 2.6.1)
504 descendants_tracker (~> 0.0.1) 525 descendants_tracker (~> 0.0.1)
@@ -536,6 +557,7 @@ DEPENDENCIES @@ -536,6 +557,7 @@ DEPENDENCIES
536 enumerize 557 enumerize
537 factory_girl_rails 558 factory_girl_rails
538 ffaker 559 ffaker
  560 + fog (~> 1.3.1)
539 font-awesome-rails (~> 3.1.1) 561 font-awesome-rails (~> 3.1.1)
540 foreman 562 foreman
541 gemoji (~> 1.2.1) 563 gemoji (~> 1.2.1)
@@ -574,7 +596,7 @@ DEPENDENCIES @@ -574,7 +596,7 @@ DEPENDENCIES
574 pg 596 pg
575 poltergeist (~> 1.3.0) 597 poltergeist (~> 1.3.0)
576 pry 598 pry
577 - puma (~> 2.0.1) 599 + puma (~> 2.3.1)
578 quiet_assets (~> 1.0.1) 600 quiet_assets (~> 1.0.1)
579 rack-mini-profiler 601 rack-mini-profiler
580 rails (= 3.2.13) 602 rails (= 3.2.13)
@@ -608,4 +630,5 @@ DEPENDENCIES @@ -608,4 +630,5 @@ DEPENDENCIES
608 turbolinks 630 turbolinks
609 uglifier 631 uglifier
610 underscore-rails (~> 1.4.4) 632 underscore-rails (~> 1.4.4)
  633 + unicorn (~> 4.6.3)
611 webmock 634 webmock
config/unicorn.rb.example 0 → 100644
@@ -0,0 +1,102 @@ @@ -0,0 +1,102 @@
  1 +# Sample verbose configuration file for Unicorn (not Rack)
  2 +#
  3 +# This configuration file documents many features of Unicorn
  4 +# that may not be needed for some applications. See
  5 +# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb
  6 +# for a much simpler configuration file.
  7 +#
  8 +# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
  9 +# documentation.
  10 +
  11 +# Use at least one worker per core if you're on a dedicated server,
  12 +# more will usually help for _short_ waits on databases/caches.
  13 +worker_processes 2
  14 +
  15 +# Since Unicorn is never exposed to outside clients, it does not need to
  16 +# run on the standard HTTP port (80), there is no reason to start Unicorn
  17 +# as root unless it's from system init scripts.
  18 +# If running the master process as root and the workers as an unprivileged
  19 +# user, do this to switch euid/egid in the workers (also chowns logs):
  20 +# user "unprivileged_user", "unprivileged_group"
  21 +
  22 +# Help ensure your application will always spawn in the symlinked
  23 +# "current" directory that Capistrano sets up.
  24 +working_directory "/home/git/gitlab/current" # available in 0.94.0+
  25 +
  26 +# listen on both a Unix domain socket and a TCP port,
  27 +# we use a shorter backlog for quicker failover when busy
  28 +listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64
  29 +listen 8080, :tcp_nopush => true
  30 +
  31 +# nuke workers after 30 seconds instead of 60 seconds (the default)
  32 +timeout 30
  33 +
  34 +# feel free to point this anywhere accessible on the filesystem
  35 +pid "/home/git/gitlab/tmp/pids/unicorn.pid"
  36 +
  37 +# By default, the Unicorn logger will write to stderr.
  38 +# Additionally, ome applications/frameworks log to stderr or stdout,
  39 +# so prevent them from going to /dev/null when daemonized here:
  40 +stderr_path "/home/git/gitlab/log/unicorn.stderr.log"
  41 +stdout_path "/home/git/gitlab/log/unicorn.stdout.log"
  42 +
  43 +# combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings
  44 +# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
  45 +preload_app true
  46 +GC.respond_to?(:copy_on_write_friendly=) and
  47 + GC.copy_on_write_friendly = true
  48 +
  49 +# Enable this flag to have unicorn test client connections by writing the
  50 +# beginning of the HTTP headers before calling the application. This
  51 +# prevents calling the application for connections that have disconnected
  52 +# while queued. This is only guaranteed to detect clients on the same
  53 +# host unicorn runs on, and unlikely to detect disconnects even on a
  54 +# fast LAN.
  55 +check_client_connection false
  56 +
  57 +before_fork do |server, worker|
  58 + # the following is highly recomended for Rails + "preload_app true"
  59 + # as there's no need for the master process to hold a connection
  60 + defined?(ActiveRecord::Base) and
  61 + ActiveRecord::Base.connection.disconnect!
  62 +
  63 + # The following is only recommended for memory/DB-constrained
  64 + # installations. It is not needed if your system can house
  65 + # twice as many worker_processes as you have configured.
  66 + #
  67 + # # This allows a new master process to incrementally
  68 + # # phase out the old master process with SIGTTOU to avoid a
  69 + # # thundering herd (especially in the "preload_app false" case)
  70 + # # when doing a transparent upgrade. The last worker spawned
  71 + # # will then kill off the old master process with a SIGQUIT.
  72 + # old_pid = "#{server.config[:pid]}.oldbin"
  73 + # if old_pid != server.pid
  74 + # begin
  75 + # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
  76 + # Process.kill(sig, File.read(old_pid).to_i)
  77 + # rescue Errno::ENOENT, Errno::ESRCH
  78 + # end
  79 + # end
  80 + #
  81 + # Throttle the master from forking too quickly by sleeping. Due
  82 + # to the implementation of standard Unix signal handlers, this
  83 + # helps (but does not completely) prevent identical, repeated signals
  84 + # from being lost when the receiving process is busy.
  85 + # sleep 1
  86 +end
  87 +
  88 +after_fork do |server, worker|
  89 + # per-process listener ports for debugging/admin/migrations
  90 + # addr = "127.0.0.1:#{9293 + worker.nr}"
  91 + # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
  92 +
  93 + # the following is *required* for Rails + "preload_app true",
  94 + defined?(ActiveRecord::Base) and
  95 + ActiveRecord::Base.establish_connection
  96 +
  97 + # if preload_app is true, then you may also want to check and
  98 + # restart any other shared sockets/descriptors such as Memcached,
  99 + # and Redis. TokyoCabinet file handles are safe to reuse
  100 + # between any number of forked children (assuming your kernel
  101 + # correctly implements pread()/pwrite() system calls)
  102 +end
doc/install/installation.md
@@ -226,10 +226,10 @@ Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup. @@ -226,10 +226,10 @@ Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup.
226 sudo gem install charlock_holmes --version '0.6.9.4' 226 sudo gem install charlock_holmes --version '0.6.9.4'
227 227
228 # For MySQL (note, the option says "without ... postgres") 228 # For MySQL (note, the option says "without ... postgres")
229 - sudo -u git -H bundle install --deployment --without development test postgres 229 + sudo -u git -H bundle install --deployment --without development test postgres unicorn aws
230 230
231 # Or for PostgreSQL (note, the option says "without ... mysql") 231 # Or for PostgreSQL (note, the option says "without ... mysql")
232 - sudo -u git -H bundle install --deployment --without development test mysql 232 + sudo -u git -H bundle install --deployment --without development test mysql unicorn aws
233 233
234 234
235 ## Initialize Database and Activate Advanced Features 235 ## Initialize Database and Activate Advanced Features