0

I have a rake task which generates some static pages. I need the task to run either during deployment so the pages end up in the slug (preferable), or after each dyno cycle. Is there a way to do that? It is a Rails app.

Brandon
  • 1,735
  • 2
  • 22
  • 37

1 Answers1

0

You have a number of options here.

Customize the buildpack so that your static files end up in the release, that is the only point that you can control the contents of the slug and therefore have the files present when a dyno starts.

Another option, if you really need to do this - and I would advise against this as if it takes too long then the boot will be timed out, but you can do

web: rake mytask && rails s -p $PORT

in your Procfile. This will ensure that the dyno itself has the static files available on it when it starts.

John Beynon
  • 37,398
  • 8
  • 88
  • 97
  • I was hoping not to have to make a custom buildpack...but it looks like this might end up being the way to go. Thanks for the feedback, I'll accept the answer if I go with it. – Brandon Oct 05 '18 at 00:38