[from now] 2014/10/16 00:44:00

diff --git a/.gitignore b/.gitignore
index 434d4b4..204a4d9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,6 @@ bower.json

 # Ignore MacOSX files.
 .DS_Store
+
+# Ignore Local env files.
+.env
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
index 0266bd3..cd0ea2b 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,8 +21,7 @@ gem 'groundworkcss'
 # Use ActiveModel has_secure_password
 # gem 'bcrypt', '~> 3.1.7'

-# Use unicorn as the app server
-# gem 'unicorn'
+gem 'unicorn'

 # Use Capistrano for deployment
 # gem 'capistrano-rails', group: :development
diff --git a/Gemfile.lock b/Gemfile.lock
index 3ef1dd1..9101305 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -97,6 +97,7 @@ GEM
       railties (>= 3.0, < 5.0)
       thor (>= 0.14, < 2.0)
     json (1.8.1)
+    kgio (2.9.2)
     libv8 (3.16.14.7)
     mail (2.6.1)
       mime-types (>= 1.16, < 3)
@@ -155,6 +156,7 @@ GEM
       activesupport (= 4.1.6)
       rake (>= 0.8.7)
       thor (>= 0.18.1, < 2.0)
+    raindrops (0.13.0)
     rake (10.3.2)
     rdoc (4.1.2)
       json (~> 1.4)
@@ -197,6 +199,10 @@ GEM
       execjs (>= 0.3.0)
       json (>= 1.8.0)
     unicode-display_width (0.1.1)
+    unicorn (4.8.3)
+      kgio (~> 2.6)
+      rack
+      raindrops (~> 0.7)
     warden (1.2.3)
       rack (>= 1.0)
     yard (0.8.7.4)
@@ -237,3 +243,4 @@ DEPENDENCIES
   therubyracer
   turbolinks
   uglifier (>= 1.3.0)
+  unicorn
diff --git a/Procfile b/Procfile
new file mode 100644
index 0000000..9249f1e
--- /dev/null
+++ b/Procfile
@@ -0,0 +1 @@
+web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
\ No newline at end of file
diff --git a/config/unicorn.rb b/config/unicorn.rb
new file mode 100644
index 0000000..bcd48c1
--- /dev/null
+++ b/config/unicorn.rb
@@ -0,0 +1,22 @@
+worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3)
+timeout 15
+preload_app true
+
+before_fork do |server, worker|
+  Signal.trap 'TERM' do
+    puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
+    Process.kill 'QUIT', Process.pid
+  end
+
+  defined?(ActiveRecord::Base) and
+    ActiveRecord::Base.connection.disconnect!
+end
+
+after_fork do |server, worker|
+  Signal.trap 'TERM' do
+    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
+  end
+
+  defined?(ActiveRecord::Base) and
+    ActiveRecord::Base.establish_connection
+end
\ No newline at end of file