ruby on rails - Getting started with delayed jobs -
i using ror , mongodb. application deployed on heroku. want run few delayed jobs on amazon ec2. came across commands
git pull on repo. chmod 600 xyz.pem ssh -i xyz.pem ubuntu@ec2-234-33-37-14.compute-1.amazonaws.com
i have worked heroku not ec2 , if can point me resources or explain getting started setup of dealyed_job in amazon ec2.
things know:
1) how implement delayed jobs in code.
things don't know , have doubts:
1) how setup new machine on amazon ec2 have rails repo?
2)how run delayed_jobs connecting app mongo database in heroku.?
1) how setup new machine have rails repo?
you can automatically configure new machine in number of ways. popular ways puppet/chef/saltstack.
for simple setup, might want run script. aws allows supply script (via userdata) when launching machine. https://help.ubuntu.com/community/cloudinit
here example of userdata script might supply aws:
#!/bin/sh set -e -x apt-get --yes --quiet update apt-get --yes --quiet install git git clone https://github.com/user/repo.git /destination/folder
2) how run delayed_jobs connecting app mongo database?
documentation can found here: https://github.com/collectiveidea/delayed_job
delayed jobs
call .delay.method(params) on object , processed in background.
# without delayed_job @user.activate!(@device) # delayed_job @user.delay.activate!(@device)
mongo
if plan use delayed_job mongoid, add delayed_job_mongoid gemfile.
gem 'delayed_job_mongoid'
edit: further reading http://thediscoblog.com/blog/2013/06/10/backgrounding-tasks-in-heroku-with-delayed-job/ , https://github.com/collectiveidea/delayed_job_mongoid
Comments
Post a Comment