Skip to content

@betamatt /Procfile
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Running delayed_job with foreman
# You're on your own for environment setup. Personally, I deploy out a .env file to the shared dir
# and symlink it the same way as what's done for the .foreman file here.
Capistrano::Configuration.instance(:must_exist).load do
_cset(:app_user, 'www-data')
_cset(:foreman_bin, 'bundle exec foreman')
namespace :foreman do
desc "Export the Procfile to Ubuntu's upstart scripts"
task :export, :roles => [:app, :queue] do
run "cd #{current_path} && #{foreman_bin} export upstart /etc/init -a #{application} -u #{app_user} -l #{latest_release}/log"
end
desc "Symlink foreman configuration"
task :symlink_config, :except => { :no_release => true } do
run <<-CMD
rm -f #{latest_release}/.foreman &&
ln -s #{shared_path}/foreman #{latest_release}/.foreman
CMD
end
end
after 'deploy:finalize_update', 'foreman:symlink_config'
namespace :deploy do
desc "Start the application services"
task :start, :roles => [:app, :queue] do
sudo "start #{application}"
end
desc "Stop the application services"
task :stop, :roles => [:app, :queue] do
sudo "stop #{application}"
end
desc "Restart the application services"
task :restart, :roles => [:app, :queue] do
run "start #{application} || restart #{application}"
end
end
after "deploy:update", "foreman:export"
end
queue: ./queue.sh
#!/bin/sh
exec bundle exec rake jobs:work RAILS_ENV=${RACK_ENV:-development} 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.