mietek / haskell-on-heroku

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

How to build latest changes with a one-off PX dyno #43

Closed gsingh93 closed 9 years ago

gsingh93 commented 9 years ago

I have a yesod website that builds fine locally with cabal build, but I can't deploy it because certain things that need to be rebuilt are cached. What I need is to deploy my changes to master without building them (because that would build on a slow dyno) and the build later on on a PX dyno. I've tried following these instructions I don't get the expected lines when setting the HALCYON_PURGE_CACHE variable, which are:

   *** ERROR: Cannot build sandbox directory
   *** ERROR: Failed to deploy app
   *** ERROR: Deploying buildpack only

I get

remote:        Foundation.hs:74:37: Not in scope: ‘css_reset_css’
remote:    *** ERROR: Failed to build app
remote:    *** ERROR: Failed to deploy app

which is a build error that would be fixed if a complete rebuild was done. What am I doing wrong?

mietek commented 9 years ago

Please post your entire build log, preferably as a gist.

gsingh93 commented 9 years ago

Build log: https://gist.github.com/gsingh93/51b4f5e76ce09f031395

mietek commented 9 years ago

The final steps of the tutorial are meant to populate your private storage, including a sandbox directory archive — but the right sandbox directory archive for the current version of your app is already in your private storage, as you can see in line 233.

First, unset HALCYON_PURGE_CACHE, as it serves no purpose in your case. Next, unset PORT, as Heroku will set it for you.

…which is a build error that would be fixed if a complete rebuild was done.

I don’t understand. Foundation.hs:74:37: Not in scope: ‘css_reset_css’ looks like an error in your program. What do you mean by “complete rebuild”?

gsingh93 commented 9 years ago

It compiles, but notice how the Heroku build starts from build 5 of 8. I believe step 4 of 8 is actually what's required for the build to work properly. I could delete everything in S3 and push, but that build would take forever. If I clear everything and run heroku run -s PX build, the build is quick but it's building what's currently on master, not the changes I've made.

mietek commented 9 years ago

OK. To build your app from scratch, set HALCYON_APP_REBUILD to 1.

This is equivalent to deleting halcyon-build-class-load-0.0.0.tar.gz from S3 and purging the cache — so your intuition was partially correct.

gsingh93 commented 9 years ago

But the build that will happen won't happen on a PX server, will it?

mietek commented 9 years ago

Building on a PX one-off dyno is only needed to avoid running into the 15-minute Heroku build time limit. Your sandbox is already built, and building your app should take far less time.

gsingh93 commented 9 years ago

I see. It's working now, thank you for the help!

mietek commented 9 years ago

You’re welcome. One last thing — you should record the constraints given after *** WARNING: Using newest versions of all packages in a .halcyon/constraints file. Otherwise, your sandbox will become out-of-date soon after someone uploads a new version of one of your dependencies to Hackage.

gsingh93 commented 9 years ago

Will do, thanks.