Commit 1fe61284afc08796d09f1626a198a1c35f0a62aa
1 parent
25856a47
Exists in
master
and in
4 other branches
Replace unicorn with Puma
Showing
5 changed files
with
120 additions
and
9 deletions
Show diff stats
.gitignore
@@ -19,6 +19,7 @@ config/gitlab.yml | @@ -19,6 +19,7 @@ config/gitlab.yml | ||
19 | config/database.yml | 19 | config/database.yml |
20 | config/initializers/omniauth.rb | 20 | config/initializers/omniauth.rb |
21 | config/unicorn.rb | 21 | config/unicorn.rb |
22 | +config/puma.rb | ||
22 | config/resque.yml | 23 | config/resque.yml |
23 | config/aws.yml | 24 | config/aws.yml |
24 | db/data.yml | 25 | db/data.yml |
Gemfile
@@ -72,7 +72,7 @@ gem "redcarpet", "~> 2.2.2" | @@ -72,7 +72,7 @@ gem "redcarpet", "~> 2.2.2" | ||
72 | gem "github-markup", "~> 0.7.4", require: 'github/markup' | 72 | gem "github-markup", "~> 0.7.4", require: 'github/markup' |
73 | 73 | ||
74 | # Servers | 74 | # Servers |
75 | -gem "unicorn" | 75 | +gem "puma", '~> 2.0.0.b7' |
76 | 76 | ||
77 | # State machine | 77 | # State machine |
78 | gem "state_machine" | 78 | gem "state_machine" |
Gemfile.lock
@@ -244,7 +244,6 @@ GEM | @@ -244,7 +244,6 @@ GEM | ||
244 | kaminari (0.14.1) | 244 | kaminari (0.14.1) |
245 | actionpack (>= 3.0.0) | 245 | actionpack (>= 3.0.0) |
246 | activesupport (>= 3.0.0) | 246 | activesupport (>= 3.0.0) |
247 | - kgio (2.8.0) | ||
248 | launchy (2.1.2) | 247 | launchy (2.1.2) |
249 | addressable (~> 2.3) | 248 | addressable (~> 2.3) |
250 | letter_opener (1.0.0) | 249 | letter_opener (1.0.0) |
@@ -304,6 +303,8 @@ GEM | @@ -304,6 +303,8 @@ GEM | ||
304 | coderay (~> 1.0.5) | 303 | coderay (~> 1.0.5) |
305 | method_source (~> 0.8) | 304 | method_source (~> 0.8) |
306 | slop (~> 3.4) | 305 | slop (~> 3.4) |
306 | + puma (2.0.0.b7) | ||
307 | + rack (>= 1.1, < 2.0) | ||
307 | pygments.rb (0.4.2) | 308 | pygments.rb (0.4.2) |
308 | posix-spawn (~> 0.3.6) | 309 | posix-spawn (~> 0.3.6) |
309 | yajl-ruby (~> 1.1.0) | 310 | yajl-ruby (~> 1.1.0) |
@@ -351,7 +352,6 @@ GEM | @@ -351,7 +352,6 @@ GEM | ||
351 | rake (>= 0.8.7) | 352 | rake (>= 0.8.7) |
352 | rdoc (~> 3.4) | 353 | rdoc (~> 3.4) |
353 | thor (>= 0.14.6, < 2.0) | 354 | thor (>= 0.14.6, < 2.0) |
354 | - raindrops (0.10.0) | ||
355 | rake (10.0.4) | 355 | rake (10.0.4) |
356 | rb-fsevent (0.9.2) | 356 | rb-fsevent (0.9.2) |
357 | rb-inotify (0.8.8) | 357 | rb-inotify (0.8.8) |
@@ -480,10 +480,6 @@ GEM | @@ -480,10 +480,6 @@ GEM | ||
480 | uglifier (1.3.0) | 480 | uglifier (1.3.0) |
481 | execjs (>= 0.3.0) | 481 | execjs (>= 0.3.0) |
482 | multi_json (~> 1.0, >= 1.0.2) | 482 | multi_json (~> 1.0, >= 1.0.2) |
483 | - unicorn (4.6.2) | ||
484 | - kgio (~> 2.6) | ||
485 | - rack | ||
486 | - raindrops (~> 0.7) | ||
487 | useragent (0.4.16) | 483 | useragent (0.4.16) |
488 | virtus (0.5.4) | 484 | virtus (0.5.4) |
489 | backports (~> 2.6.1) | 485 | backports (~> 2.6.1) |
@@ -558,6 +554,7 @@ DEPENDENCIES | @@ -558,6 +554,7 @@ DEPENDENCIES | ||
558 | pg | 554 | pg |
559 | poltergeist (= 1.1.0) | 555 | poltergeist (= 1.1.0) |
560 | pry | 556 | pry |
557 | + puma (~> 2.0.0.b7) | ||
561 | quiet_assets (~> 1.0.1) | 558 | quiet_assets (~> 1.0.1) |
562 | rack-mini-profiler | 559 | rack-mini-profiler |
563 | rails (= 3.2.13) | 560 | rails (= 3.2.13) |
@@ -588,5 +585,4 @@ DEPENDENCIES | @@ -588,5 +585,4 @@ DEPENDENCIES | ||
588 | therubyracer | 585 | therubyracer |
589 | thin | 586 | thin |
590 | uglifier (~> 1.3.0) | 587 | uglifier (~> 1.3.0) |
591 | - unicorn | ||
592 | webmock | 588 | webmock |
Procfile
@@ -0,0 +1,114 @@ | @@ -0,0 +1,114 @@ | ||
1 | +#!/usr/bin/env puma | ||
2 | + | ||
3 | +# Start Puma with next command: | ||
4 | +# RAILS_ENV=production bundle exec puma -e production -C ./config/puma.rb | ||
5 | + | ||
6 | +application_path = '/home/git/gitlab' | ||
7 | + | ||
8 | +# The directory to operate out of. | ||
9 | +# | ||
10 | +# The default is the current directory. | ||
11 | +# | ||
12 | +directory application_path | ||
13 | + | ||
14 | +# Set the environment in which the rack's app will run. | ||
15 | +# | ||
16 | +# The default is “development”. | ||
17 | +# | ||
18 | +environment = :production | ||
19 | + | ||
20 | +# Daemonize the server into the background. Highly suggest that | ||
21 | +# this be combined with “pidfile” and “stdout_redirect”. | ||
22 | +# | ||
23 | +# The default is “false”. | ||
24 | +# | ||
25 | +daemonize true | ||
26 | + | ||
27 | +# Store the pid of the server in the file at “path”. | ||
28 | +# | ||
29 | +pidfile "#{application_path}/tmp/pids/puma.pid" | ||
30 | + | ||
31 | +# Use “path” as the file to store the server info state. This is | ||
32 | +# used by “pumactl” to query and control the server. | ||
33 | +# | ||
34 | +state_path "#{application_path}/tmp/pids/puma.state" | ||
35 | + | ||
36 | +# Redirect STDOUT and STDERR to files specified. The 3rd parameter | ||
37 | +# (“append”) specifies whether the output is appended, the default is | ||
38 | +# “false”. | ||
39 | +# | ||
40 | +stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log" | ||
41 | +# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true | ||
42 | + | ||
43 | +# Disable request logging. | ||
44 | +# | ||
45 | +# The default is “false”. | ||
46 | +# | ||
47 | +# quiet | ||
48 | + | ||
49 | +# Configure “min” to be the minimum number of threads to use to answer | ||
50 | +# requests and “max” the maximum. | ||
51 | +# | ||
52 | +# The default is “0, 16”. | ||
53 | +# | ||
54 | +# threads 0, 16 | ||
55 | + | ||
56 | +# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only | ||
57 | +# accepted protocols. | ||
58 | +# | ||
59 | +# The default is “tcp://0.0.0.0:9292”. | ||
60 | +# | ||
61 | +# bind 'tcp://0.0.0.0:9292' | ||
62 | +bind "unix://#{application_path}/tmp/sockets/gitlab.socket" | ||
63 | + | ||
64 | +# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you | ||
65 | +# can also use the “ssl_bind” option. | ||
66 | +# | ||
67 | +# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert } | ||
68 | + | ||
69 | +# Code to run before doing a restart. This code should | ||
70 | +# close log files, database connections, etc. | ||
71 | +# | ||
72 | +# This can be called multiple times to add code each time. | ||
73 | +# | ||
74 | +# on_restart do | ||
75 | +# puts 'On restart...' | ||
76 | +# end | ||
77 | + | ||
78 | +# Command to use to restart puma. This should be just how to | ||
79 | +# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments | ||
80 | +# to puma, as those are the same as the original process. | ||
81 | +# | ||
82 | +# restart_command '/u/app/lolcat/bin/restart_puma' | ||
83 | + | ||
84 | +# === Cluster mode === | ||
85 | + | ||
86 | +# How many worker processes to run. | ||
87 | +# | ||
88 | +# The default is “0”. | ||
89 | +# | ||
90 | +# workers 2 | ||
91 | + | ||
92 | +# Code to run when a worker boots to setup the process before booting | ||
93 | +# the app. | ||
94 | +# | ||
95 | +# This can be called multiple times to add hooks. | ||
96 | +# | ||
97 | +# on_worker_boot do | ||
98 | +# puts 'On worker boot...' | ||
99 | +# end | ||
100 | + | ||
101 | +# === Puma control rack application === | ||
102 | + | ||
103 | +# Start the puma control rack application on “url”. This application can | ||
104 | +# be communicated with to control the main server. Additionally, you can | ||
105 | +# provide an authentication token, so all requests to the control server | ||
106 | +# will need to include that token as a query parameter. This allows for | ||
107 | +# simple authentication. | ||
108 | +# | ||
109 | +# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb | ||
110 | +# to see what the app has available. | ||
111 | +# | ||
112 | +# activate_control_app 'unix:///var/run/pumactl.sock' | ||
113 | +# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' } | ||
114 | +# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true } |