mietek / haskell-on-heroku

Buildpack for deploying Haskell apps
BSD 3-Clause "New" or "Revised" License
131 stars 16 forks source link

Why does my app require so many rebuilds? #57

Closed mohanzhang closed 8 years ago

mohanzhang commented 8 years ago

It seems that every day I deploy, I have to rebuild a sandbox. Is this because some of the packages I am depending on have new versions out on hackage?

I am using stack for my project, and I have seen HALCYON_CABAL_REMOTE_REPO, but what if I have extra dependencies outside of the stackage version in my stack.yaml?

Alternatively, is there some way to lock my dependencies at the versions I am using? https://github.com/mietek/halcyon/issues/41 suggests that the answer is no, but I was wondering if anything has changed since earlier this year? Or perhaps if there are other best practices? Thanks!

mietek commented 8 years ago

Is this because some of the packages I am depending on have new versions out on hackage?

Most likely, yes.

I am using stack for my project…

I haven’t tested using Stack together with Halcyon. Is your project open-source?

Alternatively, is there some way to lock my dependencies at the versions I am using?

Yes, using HALCYON_CONSTRAINTS. Every Halcyon example declares constraints in the form of a .halcyon/constraints magic file. Declaring constraints is a core Halcyon feature, described in the Halcyon tutorial and the Haskell on Heroku tutorial.

mohanzhang commented 8 years ago

Just for completeness, if anyone else was wondering the same thing, the way I (seem to have) fixed it was by getting a cabal.config off my stackage version: https://www.stackage.org/lts-3.6

Putting this in your project effectively acts as a lock on the versions you care about if you built with stack but also want to build with straight up cabal, as halcyon does. For the packages not on stackage, using HALCYON_CONSTRAINTS is a good way to lock those down in addition to the cabal.config files.

Thanks for the quick response @mietek!

mietek commented 8 years ago

Do not use .halcyon/constraints and cabal.config at the same time — use one or the other. Halcyon accepts both, but .halcyon/constraints takes precedence over cabal.config.

mohanzhang commented 8 years ago

Oops - I incorrectly assumed that they would union, with .halcyon/constraints getting precedence in case of conflicts. Don't try this at home, kids! Instead, just modify the cabal.config, which admittedly is not so ideal since you have to remember that you did this the next time you upgrade stackage versions.