Moonshine/Logrotate with Delayed Job

274 views
Skip to first unread message

Tom Rossi

unread,
Apr 3, 2012, 8:35:39 PM4/3/12
to railsmachin...@googlegroups.com
Does anyone know the best way to configure moonshine to recycle delayed_job after it rotates the rails logs?  I don't want to duplicate what is in the rails_logrotate method, but I'm not sure of another way around it?

Thanks,
Tom

Josh Nichols

unread,
Apr 4, 2012, 10:02:26 AM4/4/12
to railsmachin...@googlegroups.com
Hi Tom,

It's ruby, so you can always redefine the method :) There is a built in thing though to control what happens after a logrotate, see https://github.com/railsmachine/moonshine/blob/master/lib/moonshine/manifest/rails/rails.rb#L54

So, that'd look like, in config/moonshine.yml:

    :rails_logrotate:
      :postrotate: touch /srv/yourapp/current/tmp/restart.txt && god restart yourapp-dj

That assumes your app is in /srv/yourapp, that you are using god to manage dj, and there's a task/group called yourapp-dj.

- Josh


--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/railsmachine-moonshine/-/hBTxddrqK-wJ.
To post to this group, send email to railsmachin...@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moon...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/railsmachine-moonshine?hl=en.

Tom Rossi

unread,
Apr 4, 2012, 7:54:00 PM4/4/12
to railsmachin...@googlegroups.com
I'm still doing it the hard way, but I think this should work!  Thanks Josh!

:rails_logrotate:
  :postrotate: touch /srv/tick/current/tmp/restart.txt && cd /srv/tick/current;RAILS_ENV=production script/delayed_job restart


On Wednesday, April 4, 2012 10:02:26 AM UTC-4, Josh Nichols wrote:
Hi Tom,

It's ruby, so you can always redefine the method :) There is a built in thing though to control what happens after a logrotate, see https://github.com/railsmachine/moonshine/blob/master/lib/moonshine/manifest/rails/rails.rb#L54

So, that'd look like, in config/moonshine.yml:

    :rails_logrotate:
      :postrotate: touch /srv/yourapp/current/tmp/restart.txt && god restart yourapp-dj

That assumes your app is in /srv/yourapp, that you are using god to manage dj, and there's a task/group called yourapp-dj.

- Josh


On Apr 3, 2012, at 8:35 PM, Tom Rossi wrote:

Does anyone know the best way to configure moonshine to recycle delayed_job after it rotates the rails logs?  I don't want to duplicate what is in the rails_logrotate method, but I'm not sure of another way around it?

Thanks,
Tom

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/railsmachine-moonshine/-/hBTxddrqK-wJ.
To post to this group, send email to railsmachine-moonshine@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moonshine+unsub...@googlegroups.com.

Tom Rossi

unread,
Apr 4, 2012, 7:57:28 PM4/4/12
to railsmachin...@googlegroups.com
This does bring up a question I have about the delayed job pid.  Most deploys the rake config I have doesn't work:

after "deploy:restart", "delayed_job:stop","delayed_job:start"

It just isn't able to stop the delayed job.  It doesn't fail, but I see a bunch of orphan delayed jobs still running out there.  I did some digging and the pids are going into the tmp/pids folder rather than the pids folder.  Should I change the location of delayed_job's pid?

Thanks!
Tom


On Wednesday, April 4, 2012 10:02:26 AM UTC-4, Josh Nichols wrote:
Hi Tom,

It's ruby, so you can always redefine the method :) There is a built in thing though to control what happens after a logrotate, see https://github.com/railsmachine/moonshine/blob/master/lib/moonshine/manifest/rails/rails.rb#L54

So, that'd look like, in config/moonshine.yml:

    :rails_logrotate:
      :postrotate: touch /srv/yourapp/current/tmp/restart.txt && god restart yourapp-dj

That assumes your app is in /srv/yourapp, that you are using god to manage dj, and there's a task/group called yourapp-dj.

- Josh


On Apr 3, 2012, at 8:35 PM, Tom Rossi wrote:

Does anyone know the best way to configure moonshine to recycle delayed_job after it rotates the rails logs?  I don't want to duplicate what is in the rails_logrotate method, but I'm not sure of another way around it?

Thanks,
Tom

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/railsmachine-moonshine/-/hBTxddrqK-wJ.
To post to this group, send email to railsmachine-moonshine@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moonshine+unsub...@googlegroups.com.

Tom Rossi

unread,
Apr 9, 2012, 1:05:23 PM4/9/12
to railsmachin...@googlegroups.com
That was exactly what I needed, thanks!


On Wednesday, April 4, 2012 10:02:26 AM UTC-4, Josh Nichols wrote:
Hi Tom,

It's ruby, so you can always redefine the method :) There is a built in thing though to control what happens after a logrotate, see https://github.com/railsmachine/moonshine/blob/master/lib/moonshine/manifest/rails/rails.rb#L54

So, that'd look like, in config/moonshine.yml:

    :rails_logrotate:
      :postrotate: touch /srv/yourapp/current/tmp/restart.txt && god restart yourapp-dj

That assumes your app is in /srv/yourapp, that you are using god to manage dj, and there's a task/group called yourapp-dj.

- Josh


On Apr 3, 2012, at 8:35 PM, Tom Rossi wrote:

Does anyone know the best way to configure moonshine to recycle delayed_job after it rotates the rails logs?  I don't want to duplicate what is in the rails_logrotate method, but I'm not sure of another way around it?

Thanks,
Tom

--
You received this message because you are subscribed to the Google Groups "Moonshine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/railsmachine-moonshine/-/hBTxddrqK-wJ.
To post to this group, send email to railsmachine-moonshine@googlegroups.com.
To unsubscribe from this group, send email to railsmachine-moonshine+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages