summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-04 23:19:24 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-04-04 23:19:24 +0300
commit1fe61284afc08796d09f1626a198a1c35f0a62aa (patch)
tree0fba1be3cfb010f2c0c1be0acc387cc8abd99bc7
parent25856a47e5a757e88a33218cc51367f6171db1c4 (diff)
downloadgitlab-ce-1fe61284afc08796d09f1626a198a1c35f0a62aa.tar.gz
Replace unicorn with Puma
-rw-r--r--.gitignore1
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock10
-rw-r--r--Procfile2
-rw-r--r--config/puma.rb.example114
5 files changed, 120 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 7e621d260fc..2a7e605a350 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,7 @@ config/gitlab.yml
config/database.yml
config/initializers/omniauth.rb
config/unicorn.rb
+config/puma.rb
config/resque.yml
config/aws.yml
db/data.yml
diff --git a/Gemfile b/Gemfile
index 17b92d56bd0..791af6422d7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -72,7 +72,7 @@ gem "redcarpet", "~> 2.2.2"
gem "github-markup", "~> 0.7.4", require: 'github/markup'
# Servers
-gem "unicorn"
+gem "puma", '~> 2.0.0.b7'
# State machine
gem "state_machine"
diff --git a/Gemfile.lock b/Gemfile.lock
index 586b7bda61b..ac217c2e2da 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -244,7 +244,6 @@ GEM
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
- kgio (2.8.0)
launchy (2.1.2)
addressable (~> 2.3)
letter_opener (1.0.0)
@@ -304,6 +303,8 @@ GEM
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
+ puma (2.0.0.b7)
+ rack (>= 1.1, < 2.0)
pygments.rb (0.4.2)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
@@ -351,7 +352,6 @@ GEM
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
- raindrops (0.10.0)
rake (10.0.4)
rb-fsevent (0.9.2)
rb-inotify (0.8.8)
@@ -480,10 +480,6 @@ GEM
uglifier (1.3.0)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
- unicorn (4.6.2)
- kgio (~> 2.6)
- rack
- raindrops (~> 0.7)
useragent (0.4.16)
virtus (0.5.4)
backports (~> 2.6.1)
@@ -558,6 +554,7 @@ DEPENDENCIES
pg
poltergeist (= 1.1.0)
pry
+ puma (~> 2.0.0.b7)
quiet_assets (~> 1.0.1)
rack-mini-profiler
rails (= 3.2.13)
@@ -588,5 +585,4 @@ DEPENDENCIES
therubyracer
thin
uglifier (~> 1.3.0)
- unicorn
webmock
diff --git a/Procfile b/Procfile
index 66ca562f131..fade88bd3a3 100644
--- a/Procfile
+++ b/Procfile
@@ -1,2 +1,2 @@
-web: bundle exec unicorn_rails -p $PORT
+web: bundle exec puma -p $PORT
worker: bundle exec sidekiq -q post_receive,mailer,system_hook,project_web_hook,common,default,gitlab_shell
diff --git a/config/puma.rb.example b/config/puma.rb.example
new file mode 100644
index 00000000000..e166992b8c2
--- /dev/null
+++ b/config/puma.rb.example
@@ -0,0 +1,114 @@
+#!/usr/bin/env puma
+
+# Start Puma with next command:
+# RAILS_ENV=production bundle exec puma -e production -C ./config/puma.rb
+
+application_path = '/home/git/gitlab'
+
+# The directory to operate out of.
+#
+# The default is the current directory.
+#
+directory application_path
+
+# Set the environment in which the rack's app will run.
+#
+# The default is “development”.
+#
+environment = :production
+
+# Daemonize the server into the background. Highly suggest that
+# this be combined with “pidfile” and “stdout_redirect”.
+#
+# The default is “false”.
+#
+daemonize true
+
+# Store the pid of the server in the file at “path”.
+#
+pidfile "#{application_path}/tmp/pids/puma.pid"
+
+# Use “path” as the file to store the server info state. This is
+# used by “pumactl” to query and control the server.
+#
+state_path "#{application_path}/tmp/pids/puma.state"
+
+# Redirect STDOUT and STDERR to files specified. The 3rd parameter
+# (“append”) specifies whether the output is appended, the default is
+# “false”.
+#
+stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
+# stdout_redirect '/u/apps/lolcat/log/stdout', '/u/apps/lolcat/log/stderr', true
+
+# Disable request logging.
+#
+# The default is “false”.
+#
+# quiet
+
+# Configure “min” to be the minimum number of threads to use to answer
+# requests and “max” the maximum.
+#
+# The default is “0, 16”.
+#
+# threads 0, 16
+
+# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
+# accepted protocols.
+#
+# The default is “tcp://0.0.0.0:9292”.
+#
+# bind 'tcp://0.0.0.0:9292'
+bind "unix://#{application_path}/tmp/sockets/gitlab.socket"
+
+# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
+# can also use the “ssl_bind” option.
+#
+# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
+
+# Code to run before doing a restart. This code should
+# close log files, database connections, etc.
+#
+# This can be called multiple times to add code each time.
+#
+# on_restart do
+# puts 'On restart...'
+# end
+
+# Command to use to restart puma. This should be just how to
+# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
+# to puma, as those are the same as the original process.
+#
+# restart_command '/u/app/lolcat/bin/restart_puma'
+
+# === Cluster mode ===
+
+# How many worker processes to run.
+#
+# The default is “0”.
+#
+# workers 2
+
+# Code to run when a worker boots to setup the process before booting
+# the app.
+#
+# This can be called multiple times to add hooks.
+#
+# on_worker_boot do
+# puts 'On worker boot...'
+# end
+
+# === Puma control rack application ===
+
+# Start the puma control rack application on “url”. This application can
+# be communicated with to control the main server. Additionally, you can
+# provide an authentication token, so all requests to the control server
+# will need to include that token as a query parameter. This allows for
+# simple authentication.
+#
+# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
+# to see what the app has available.
+#
+# activate_control_app 'unix:///var/run/pumactl.sock'
+# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
+# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }