From 119867038323324123677b0bd8d8b169c6bec4b5 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Mon, 29 Aug 2011 14:36:19 -0700 Subject: [PATCH] Added Foreman gem. Run Diaspora using `foreman start` (will start everything except mySQL. Passing in a -p flag will let you specifiy the port. Also: I took single_process_mode out of app config and made it an environment variable. If you want to boot a lightweight server, run `SINGLE_PROCESS=true rails s`. --- Gemfile | 2 ++ Gemfile.lock | 4 ++++ Procfile | 4 ++++ app/views/js/_websocket_js.haml | 2 +- config/application.yml.example | 4 ---- config/initializers/resque.rb | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 Procfile diff --git a/Gemfile b/Gemfile index d1b6564f5..6e5a5e185 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,8 @@ gem 'ohai', '0.5.8', :require => false #Chef dependency gem 'nokogiri' gem 'settingslogic', '2.0.6' +gem 'foreman' + gem 'vanna', :git => "git://github.com/MikeSofaer/vanna.git" #Security diff --git a/Gemfile.lock b/Gemfile.lock index b85ac8c09..19956057d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -200,6 +200,9 @@ GEM nokogiri (~> 1.4.3.1) ruby-hmac foreigner (0.9.1) + foreman (0.20.0) + term-ansicolor (~> 1.0.5) + thor (>= 0.13.6) formatador (0.2.0) fuubar (0.0.6) rspec (~> 2.0) @@ -481,6 +484,7 @@ DEPENDENCIES fixture_builder (= 0.2.2) fog (= 0.3.25) foreigner (= 0.9.1) + foreman fuubar haml (= 3.1.2) hoptoad_notifier diff --git a/Procfile b/Procfile new file mode 100644 index 000000000..23f79e5ce --- /dev/null +++ b/Procfile @@ -0,0 +1,4 @@ +redis: redis-server +websocket: ruby script/websocket_server.rb +web: bundle exec rails s thin -p $PORT +worker: QUEUE=* rake resque:work diff --git a/app/views/js/_websocket_js.haml b/app/views/js/_websocket_js.haml index f021fb1c1..2aa64a11c 100644 --- a/app/views/js/_websocket_js.haml +++ b/app/views/js/_websocket_js.haml @@ -2,7 +2,7 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. --if AppConfig[:single_process_mode] +-if ENV['SINGLE_PROCESS'] :javascript var websocket_enabled = false - else diff --git a/config/application.yml.example b/config/application.yml.example index 94653a39d..b1f8e1ebd 100644 --- a/config/application.yml.example +++ b/config/application.yml.example @@ -133,9 +133,6 @@ defaults: &defaults #s3_bucket: 'my_photos' s3_region: 'us-east-1' - # Set this to true if you want to do everything synchronously instead of using resque, our redis-backed queue system. - single_process_mode: true - # Use paypal for recurring donations paypal_hosted_button_id: "" @@ -154,7 +151,6 @@ development: production: <<: *defaults - single_process_mode: false # Setting the root certificate bundle (this is operating system specific). Defaults: # CentOS: '/etc/pki/tls/certs/ca-bundle.crt' diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index f97cc4e26..ce88bde9f 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -1,7 +1,7 @@ require 'resque' begin - if AppConfig[:single_process_mode] + if ENV['SINGLE_PROCESS'] if Rails.env == 'production' puts "WARNING: You are running Diaspora in production without Resque workers turned on. Please don't do this." end