Skip to content

Instantly share code, notes, and snippets.

@infernalmaster
Forked from nragaz/unicorn.rb
Created July 11, 2013 14:16
Show Gist options
  • Select an option

  • Save infernalmaster/5975837 to your computer and use it in GitHub Desktop.

Select an option

Save infernalmaster/5975837 to your computer and use it in GitHub Desktop.
# unicorn_rails -c /srv/myapp/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
working_directory (rails_env == 'production' ? "/srv/myapp/current" : `pwd`.gsub("\n", ""))
worker_processes (rails_env == 'production' ? 10 : 4)
preload_app true
timeout 30
if rails_env == 'production'
listen '/tmp/unicorn.sock', :backlog => 2048
pid "/srv/myapp/shared/pids/unicorn.pid"
stderr_path "/srv/myapp/shared/log/unicorn.log"
stdout_path "/srv/myapp/shared/log/unicorn.log"
else
listen 8080
rails_root = `pwd`.gsub("\n", "")
pid "#{rails_root}/tmp/pids/unicorn.pid"
stderr_path "#{rails_root}/log/unicorn.log"
stdout_path "#{rails_root}/log/unicorn.log"
end
GC.copy_on_write_friendly = true if GC.respond_to?(:copy_on_write_friendly=)
before_fork do |server, worker|
ActiveRecord::Base.connection.disconnect!
##
# When sent a USR2, Unicorn will suffix its pidfile with .oldbin and
# immediately start loading up a new version of itself (loaded with a new
# version of our app). When this new Unicorn is completely loaded
# it will begin spawning workers. The first worker spawned will check to
# see if an .oldbin pidfile exists. If so, this means we've just booted up
# a new Unicorn and need to tell the old one that it can now die. To do so
# we send it a QUIT.
#
# Using this method we get 0 downtime deploys.
old_pid = Rails.env.production? ? "/srv/myapp/shared/pids/unicorn.pid.oldbin" :
"#{Rails.root}/tmp/pids/unicorn.pid.oldbin"
if File.exists?(old_pid) && server.pid != old_pid
begin
Process.kill("QUIT", File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
# someone else did our job for us
end
end
end
after_fork do |server, worker|
ActiveRecord::Base.establish_connection
worker.user('rails', 'rails') if Process.euid == 0 && rails_env == 'production'
end
@juituto
Copy link

juituto commented Nov 14, 2016

How do I get sly.js to work on my store webpage to display products for sale?

@juituto
Copy link

juituto commented Nov 14, 2016

I am using Adobe Dreamweaver html to code for my store. Is there anyway to implement sly.js to display webpage products andd how?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment