I am running out of space on heroku slug size, so I was thinking I can solve it by separating a worker from the main web dyno and have heroku built separate slugs for each dyno. Is this even possible? I found no info on this anywhere, so I could neither prove it can be done, nor prove it wrong. Any thoughts? Thanks
2 Answers
It is possible to split web and worker (if it makes sense) and deploy them differently.
You could also look at reducing the slug following the Heroku guidelines, or using Docker to containerize the application. Docker images are not limited by the slug max size limit.
-
unfortunately I can't make my slug size smaller and I know I can split web and worker, but hot tell heroku to build it as separate slugs? thanks– BelovojCommented Dec 23, 2021 at 22:16
Since it seems like the underlying issue you want to solve is slug size, have you attempted either of the following potential solutions?
- Ignore files that don't need to be in the final build using
.slugignore
(documentation) - Clear the build cache because sometimes this may take up extra space (documentation)
- Create a support ticket asking for an increase in your allowed slug size.
While these may not immediately answer your "how can I split up a slug" question, I feel like they may be easier solutions to solving your slug size issue than hacking around your deployment process, which seems not fun.
-
reducing slug size the conventional documented way is not an option, because problems are not the same in nature. My problem is I have huge dependencies, so there is nothing else I can do but split the app.– BelovojCommented Dec 26, 2021 at 7:55