From 4bde00177cf81fe516be5d5a83fc68d78780a480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sun, 17 May 2015 18:48:02 +0200 Subject: [PATCH] replace foreman with eye closes #5966 --- Changelog.md | 1 + Gemfile | 2 +- Gemfile.lock | 16 +++++++++++++--- Procfile | 3 +-- bin/eye | 16 ++++++++++++++++ config/eye.rb | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ script/server | 11 +++-------- 7 files changed, 83 insertions(+), 14 deletions(-) create mode 100755 bin/eye create mode 100644 config/eye.rb diff --git a/Changelog.md b/Changelog.md index f6ba74c6b..d1deb89dd 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ * Do not retry a couple of unrecoverable job failures [#5938](https://github.com/diaspora/diaspora/pull/5938) [#5942](https://github.com/diaspora/diaspora/pull/5943) * Remove some old temporary workarounds [#5964](https://github.com/diaspora/diaspora/pull/5964) * Remove unused `hasPhotos` and `hasText` functions [#5969](https://github.com/diaspora/diaspora/pull/5969) +* Replace foreman with eye [#5966](https://github.com/diaspora/diaspora/pull/5966) ## Bug fixes * Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846) diff --git a/Gemfile b/Gemfile index 4ee605797..37f931230 100644 --- a/Gemfile +++ b/Gemfile @@ -203,7 +203,7 @@ group :production do # we don"t install these on travis to speed up test runs # Process management - gem "foreman", "0.62" + gem "eye", "0.7.pre" # Redirects diff --git a/Gemfile.lock b/Gemfile.lock index 38102f14a..52add90ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,6 +88,9 @@ GEM mime-types (>= 1.16) celluloid (0.16.0) timers (~> 4.0.0) + celluloid-io (0.16.2) + celluloid (>= 0.16.0) + nio4r (>= 1.1.0) childprocess (0.5.6) ffi (~> 1.0, >= 1.0.11) chunky_png (1.3.4) @@ -173,6 +176,12 @@ GEM eventmachine (1.0.7) excon (0.45.3) execjs (2.5.2) + eye (0.7.pre) + celluloid (~> 0.16.0) + celluloid-io (~> 0.16.0) + sigar (~> 0.7.2) + state_machine + thor factory_girl (4.5.0) activesupport (>= 3.0.0) factory_girl_rails (4.5.0) @@ -287,8 +296,6 @@ GEM nokogiri (~> 1.5, >= 1.5.11) font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) - foreman (0.62.0) - thor (>= 0.13.6) formatador (0.2.5) fuubar (2.0.0) rspec (~> 3.0) @@ -411,6 +418,7 @@ GEM net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (2.9.2) + nio4r (1.1.0) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) notiffany (0.0.6) @@ -636,6 +644,7 @@ GEM celluloid (>= 0.14.1) ice_cube (= 0.11.1) sidekiq (>= 3.0.0) + sigar (0.7.3) simple_captcha2 (0.3.4) rails (>= 4.1) simple_oauth (0.2.0) @@ -660,6 +669,7 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) + state_machine (1.2.0) systemu (2.6.5) test_after_commit (0.4.1) activerecord (>= 3.2) @@ -729,13 +739,13 @@ DEPENDENCIES devise_lastseenable (= 0.0.4) diaspora-vines (~> 0.1.27) entypo-rails (= 2.2.3) + eye (= 0.7.pre) factory_girl_rails (= 4.5.0) faraday (= 0.9.1) faraday-cookie_jar (= 0.0.6) faraday_middleware (= 0.9.1) fixture_builder (= 0.3.6) fog (= 1.30.0) - foreman (= 0.62) fuubar (= 2.0.0) gon (= 5.2.3) guard (= 2.12.5) diff --git a/Procfile b/Procfile index 4119cf536..627365c9e 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,2 @@ -web: bin/bundle exec unicorn_rails -c config/unicorn.rb -p $PORT +web: bin/bundle exec unicorn -c config/unicorn.rb -p $PORT sidekiq: bin/bundle exec sidekiq -xmpp: bin/bundle exec vines start diff --git a/bin/eye b/bin/eye new file mode 100755 index 000000000..dfab4bad8 --- /dev/null +++ b/bin/eye @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'eye' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('eye', 'eye') diff --git a/config/eye.rb b/config/eye.rb new file mode 100644 index 000000000..d50460303 --- /dev/null +++ b/config/eye.rb @@ -0,0 +1,48 @@ +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 + stdall "log/eye_processes.log" + + 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 diff --git a/script/server b/script/server index 17f5784e7..466b4ef0f 100755 --- a/script/server +++ b/script/server @@ -182,13 +182,9 @@ https://github.com/diaspora/diaspora/issues/4202 for details " fi -vines=0 -if [ "$chat" = "true" ] && [ "$chat_server" = "true" ] +if [ "$chat" = "true" -a "$chat_server" = "true" -a "$chat_bosh_proxy" = "false" ] then - vines=1 - if [ "$chat_bosh_proxy" = "false" ] - then - warning " + warning " ***************************************************************** You enabled the chat feature but haven't configured BOSH! That could lead to mixed-content problems with the http clients. Please @@ -204,7 +200,6 @@ printf "Starting Diaspora in $RAILS_ENV mode " if [ -n "$PORT" ] then printf "on port $PORT " - port_option="-p $PORT" fi if [ "$embed_sidekiq_worker" = "true" ] then @@ -219,4 +214,4 @@ else fi echo "" -exec bin/bundle exec foreman start -m "xmpp=$vines,web=1,sidekiq=$workers" $port_option +exec bin/bundle exec loader_eye -st -c config/eye.rb