eye.rb 1.3 KB
Newer Older
Jonne Haß's avatar
Jonne Haß committed
1 2 3 4 5 6 7 8 9 10
require_relative "load_config"
rails_env = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"

Eye.config do
  logger Logger.new(STDOUT)
end

Eye.application("diaspora") do
  working_dir Rails.root.to_s
  env "DB" => ENV["DB"], "RAILS_ENV" => rails_env
11 12
  stdout "log/eye_processes_stdout.log" unless rails_env == "development"
  stderr "log/eye_processes_stderr.log"
Jonne Haß's avatar
Jonne Haß committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

  process :web do
    start_command "bin/bundle exec unicorn -c config/unicorn.rb"
    daemonize true
    pid_file "tmp/pids/web.pid"
    stop_signals [:TERM, 10.seconds]
    env "PORT" => ENV["PORT"]

    monitor_children do
      stop_command "kill -QUIT {PID}"
    end
  end

  group :sidekiq do
    with_condition(!AppConfig.environment.single_process_mode?) do
      AppConfig.server.sidekiq_workers.to_i.times do |i|
        i += 1

        process "sidekiq#{i}" do
          start_command "bin/bundle exec sidekiq"
          daemonize true
          pid_file "tmp/pids/sidekiq#{i}.pid"
          stop_signals [:USR1, 0, :TERM, 10.seconds, :KILL]
        end
      end
    end
  end

  with_condition(AppConfig.chat.enabled? && AppConfig.chat.server.enabled?) do
    process :xmpp do
      start_command "bin/bundle exec vines start"
      daemonize true
      pid_file "tmp/pids/xmpp.pid"
      stop_signals [:TERM, 10.seconds, :KILL]
    end
  end
end