Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,8 @@ application.
## Running Pageflow

In addition to the Rails server, you need to start two Rake tasks for
the background job processing. First, start a Resque worker which handles
jobs from all queues:

$ QUEUE=* rake resque:work

Image and video processing are examples of jobs that are executes by these workers.

Some jobs need to be executed repeatedly. For example, while videos are being
encoded by Zencoder, there is a job that runs every few seconds to fetch the
current progress. This delayed invocation of jobs is handled by the Resque
Scheduler Rake task:

$ QUEUE=* rake resque:scheduler
the background job processing. These tasks are listed in `Procfile` which
is generated in the project root folder by the Pageflow installer.

Consider using the [foreman gem](https://github.com/ddollar/foreman) to start all of
these processes (including the Rails server) with a single command in your
Expand Down
1 change: 1 addition & 0 deletions lib/generators/pageflow/install/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def generate_all

invoke 'pageflow:assets'
invoke 'pageflow:initializer'
invoke 'pageflow:procfile'
invoke 'pageflow:routes'
invoke 'pageflow:user'
invoke 'pageflow:seeds'
Expand Down
15 changes: 15 additions & 0 deletions lib/generators/pageflow/procfile/procfile_generator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails/generators'

module Pageflow
module Generators
class ProcfileGenerator < Rails::Generators::Base
desc 'Generate a Procfile in Rails root.'

source_root File.expand_path('../templates', __FILE__)

def generate_procfile
copy_file 'Procfile', 'Procfile'
end
end
end
end
3 changes: 3 additions & 0 deletions lib/generators/pageflow/procfile/templates/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: bundle exec rails server
worker: bundle exec rake resque:work QUEUE=*
scheduler: bundle exec rake resque:scheduler QUEUE=*
20 changes: 20 additions & 0 deletions spec/generators/pageflow/procfile/procfile_generator_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require 'spec_helper'
require 'support/shared_contexts/generator'
require 'generators/pageflow/procfile/procfile_generator'

module Pageflow
module Generators
describe ProcfileGenerator, type: :generator do
let(:procfile) { file('Procfile') }

it "generates '/Procfile'" do
run_generator

expect(procfile).to exist
expect(procfile).to contain 'web: bundle exec rails server'
expect(procfile).to contain 'worker: bundle exec rake resque:work QUEUE=*'
expect(procfile).to contain 'scheduler: bundle exec rake resque:scheduler QUEUE=*'
end
end
end
end