diff options
author | Julian Pawlowski <julian.pawlowski@gmail.com> | 2013-01-16 21:06:15 +0100 |
---|---|---|
committer | Julian Pawlowski <julian.pawlowski@gmail.com> | 2013-01-16 21:06:15 +0100 |
commit | ea70e08534319dd3f15c34859c498771fa7d9b32 (patch) | |
tree | 8566e9295c5875528221df6d5bfaf1be14a99a01 | |
parent | 0d5fd7ba5092b4d00826f3572448bb54ac2ec983 (diff) |
add configuration for unicorn server
-rw-r--r-- | config/unicorn.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/config/unicorn.rb b/config/unicorn.rb new file mode 100644 index 0000000..d379569 --- /dev/null +++ b/config/unicorn.rb @@ -0,0 +1,35 @@ +worker_processes 2 +working_directory "/opt/GS5/" + +# This loads the application in the master process before forking +# worker processes +# Read more about it here: +# http://unicorn.bogomips.org/Unicorn/Configurator.html +preload_app true + +timeout 30 + +# This is where we specify the socket. +# We will point the upstream Nginx module to this socket later on +listen "/opt/GS5/tmp/sockets/unicorn.sock", :backlog => 64 + +pid "/opt/GS5/tmp/pids/unicorn.pid" + +# Set the path of the log files inside the log folder of the testapp +stderr_path "/opt/GS5/log/unicorn.stderr.log" +stdout_path "/opt/GS5/log/unicorn.stdout.log" + +before_fork do |server, worker| +# This option works in together with preload_app true setting +# What is does is prevent the master process from holding +# the database connection + defined?(ActiveRecord::Base) and + ActiveRecord::Base.connection.disconnect! +end + +after_fork do |server, worker| +# Here we are establishing the connection after forking worker +# processes + defined?(ActiveRecord::Base) and + ActiveRecord::Base.establish_connection +end |