diff --git a/Gemfile b/Gemfile index 0150ffb94ea6a5230040e602843a1f7e2a82dd8d..089646e110cd9eb842ddbef06ce6052281c06a62 100644 --- a/Gemfile +++ b/Gemfile @@ -59,8 +59,9 @@ gem "haml-rails" # Files attachments gem "carrierwave" + # for aws storage -# gem "fog", "~> 1.3.1" +gem "fog", "~> 1.3.1", group: :aws # Authorization gem "six" @@ -76,7 +77,8 @@ gem "github-markup", "~> 0.7.4", require: 'github/markup' gem "asciidoctor" # Servers -gem "puma", '~> 2.0.1' +gem "puma", '~> 2.3.1', group: :puma +gem "unicorn", '~> 4.6.3', group: :unicorn # State machine gem "state_machine" diff --git a/Gemfile.lock b/Gemfile.lock index 313d2ffbca56596f468d3e88706f4c6687963e30..d26f4d8a28fb256d6eb0381ce2b49c8bc7393327 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -116,6 +116,7 @@ GEM erubis (2.7.0) escape_utils (0.2.4) eventmachine (1.0.3) + excon (0.13.4) execjs (1.4.0) multi_json (~> 1.0) factory_girl (4.2.0) @@ -131,6 +132,16 @@ GEM eventmachine (>= 0.12.0) ffaker (1.16.0) ffi (1.8.1) + fog (1.3.1) + builder + excon (~> 0.13.0) + formatador (~> 0.2.0) + mime-types + multi_json (~> 1.0) + net-scp (~> 1.0.4) + net-ssh (>= 2.1.3) + nokogiri (~> 1.5.0) + ruby-hmac font-awesome-rails (3.1.1.3) railties (>= 3.2, < 5.0) foreman (0.63.0) @@ -243,6 +254,7 @@ GEM kaminari (0.14.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) + kgio (2.8.0) launchy (2.2.0) addressable (~> 2.3) letter_opener (1.1.0) @@ -267,6 +279,9 @@ GEM multipart-post (1.2.0) mysql2 (0.3.11) net-ldap (0.3.1) + net-scp (1.0.4) + net-ssh (>= 1.99.1) + net-ssh (2.6.8) nokogiri (1.5.9) oauth (0.4.7) oauth2 (0.8.1) @@ -305,7 +320,7 @@ GEM coderay (~> 1.0.5) method_source (~> 0.8) slop (~> 3.4) - puma (2.0.1) + puma (2.3.1) rack (>= 1.1, < 2.0) pygments.rb (0.4.2) posix-spawn (~> 0.3.6) @@ -354,6 +369,7 @@ GEM rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) + raindrops (0.11.0) rake (10.0.4) rb-fsevent (0.9.3) rb-inotify (0.9.0) @@ -400,6 +416,7 @@ GEM rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) rspec-mocks (~> 2.13.0) + ruby-hmac (0.4.0) ruby-progressbar (1.0.2) rubyntlm (0.1.1) rubyzip (0.9.9) @@ -499,6 +516,10 @@ GEM execjs (>= 0.3.0) multi_json (~> 1.0, >= 1.0.2) underscore-rails (1.4.4) + unicorn (4.6.3) + kgio (~> 2.6) + rack + raindrops (~> 0.7) virtus (0.5.4) backports (~> 2.6.1) descendants_tracker (~> 0.0.1) @@ -536,6 +557,7 @@ DEPENDENCIES enumerize factory_girl_rails ffaker + fog (~> 1.3.1) font-awesome-rails (~> 3.1.1) foreman gemoji (~> 1.2.1) @@ -574,7 +596,7 @@ DEPENDENCIES pg poltergeist (~> 1.3.0) pry - puma (~> 2.0.1) + puma (~> 2.3.1) quiet_assets (~> 1.0.1) rack-mini-profiler rails (= 3.2.13) @@ -608,4 +630,5 @@ DEPENDENCIES turbolinks uglifier underscore-rails (~> 1.4.4) + unicorn (~> 4.6.3) webmock diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example new file mode 100644 index 0000000000000000000000000000000000000000..00c509dd829aa2d23b27c181ea2a827ddd01ee82 --- /dev/null +++ b/config/unicorn.rb.example @@ -0,0 +1,102 @@ +# Sample verbose configuration file for Unicorn (not Rack) +# +# This configuration file documents many features of Unicorn +# that may not be needed for some applications. See +# http://unicorn.bogomips.org/examples/unicorn.conf.minimal.rb +# for a much simpler configuration file. +# +# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete +# documentation. + +# Use at least one worker per core if you're on a dedicated server, +# more will usually help for _short_ waits on databases/caches. +worker_processes 2 + +# Since Unicorn is never exposed to outside clients, it does not need to +# run on the standard HTTP port (80), there is no reason to start Unicorn +# as root unless it's from system init scripts. +# If running the master process as root and the workers as an unprivileged +# user, do this to switch euid/egid in the workers (also chowns logs): +# user "unprivileged_user", "unprivileged_group" + +# Help ensure your application will always spawn in the symlinked +# "current" directory that Capistrano sets up. +working_directory "/home/git/gitlab/current" # available in 0.94.0+ + +# listen on both a Unix domain socket and a TCP port, +# we use a shorter backlog for quicker failover when busy +listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 64 +listen 8080, :tcp_nopush => true + +# nuke workers after 30 seconds instead of 60 seconds (the default) +timeout 30 + +# feel free to point this anywhere accessible on the filesystem +pid "/home/git/gitlab/tmp/pids/unicorn.pid" + +# By default, the Unicorn logger will write to stderr. +# Additionally, ome applications/frameworks log to stderr or stdout, +# so prevent them from going to /dev/null when daemonized here: +stderr_path "/home/git/gitlab/log/unicorn.stderr.log" +stdout_path "/home/git/gitlab/log/unicorn.stdout.log" + +# combine Ruby 2.0.0dev or REE with "preload_app true" for memory savings +# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow +preload_app true +GC.respond_to?(:copy_on_write_friendly=) and + GC.copy_on_write_friendly = true + +# Enable this flag to have unicorn test client connections by writing the +# beginning of the HTTP headers before calling the application. This +# prevents calling the application for connections that have disconnected +# while queued. This is only guaranteed to detect clients on the same +# host unicorn runs on, and unlikely to detect disconnects even on a +# fast LAN. +check_client_connection false + +before_fork do |server, worker| + # the following is highly recomended for Rails + "preload_app true" + # as there's no need for the master process to hold a connection + defined?(ActiveRecord::Base) and + ActiveRecord::Base.connection.disconnect! + + # The following is only recommended for memory/DB-constrained + # installations. It is not needed if your system can house + # twice as many worker_processes as you have configured. + # + # # This allows a new master process to incrementally + # # phase out the old master process with SIGTTOU to avoid a + # # thundering herd (especially in the "preload_app false" case) + # # when doing a transparent upgrade. The last worker spawned + # # will then kill off the old master process with a SIGQUIT. + # old_pid = "#{server.config[:pid]}.oldbin" + # if old_pid != server.pid + # begin + # sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU + # Process.kill(sig, File.read(old_pid).to_i) + # rescue Errno::ENOENT, Errno::ESRCH + # end + # end + # + # Throttle the master from forking too quickly by sleeping. Due + # to the implementation of standard Unix signal handlers, this + # helps (but does not completely) prevent identical, repeated signals + # from being lost when the receiving process is busy. + # sleep 1 +end + +after_fork do |server, worker| + # per-process listener ports for debugging/admin/migrations + # addr = "127.0.0.1:#{9293 + worker.nr}" + # server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true) + + # the following is *required* for Rails + "preload_app true", + defined?(ActiveRecord::Base) and + ActiveRecord::Base.establish_connection + + # if preload_app is true, then you may also want to check and + # restart any other shared sockets/descriptors such as Memcached, + # and Redis. TokyoCabinet file handles are safe to reuse + # between any number of forked children (assuming your kernel + # correctly implements pread()/pwrite() system calls) +end diff --git a/doc/install/installation.md b/doc/install/installation.md index 146f45f7cd600392a0048c85272aab07873ebff4..800e06fdfdf4e1994ecf133d8e25a4378907b57d 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -226,10 +226,10 @@ Make sure to edit both `gitlab.yml` and `puma.rb` to match your setup. sudo gem install charlock_holmes --version '0.6.9.4' # For MySQL (note, the option says "without ... postgres") - sudo -u git -H bundle install --deployment --without development test postgres + sudo -u git -H bundle install --deployment --without development test postgres unicorn aws # Or for PostgreSQL (note, the option says "without ... mysql") - sudo -u git -H bundle install --deployment --without development test mysql + sudo -u git -H bundle install --deployment --without development test mysql unicorn aws ## Initialize Database and Activate Advanced Features