mietek / haskell-on-heroku

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

Support dokku - single host heroku compatible hosting #51

Closed dbp closed 5 years ago

dbp commented 9 years ago

It would be really great if halcyon/haskell-on-heroku could support dokku, a do-it-yourself single host heroku clone. It currently errors out by saying that it can't create the sandbox. I'm not sure where the incompatibility is - that dokku doesn't support enough of the buildpack spec to support what haskell-on-heroku is doing, or that halcyon is doing something that happens to work on heroku but that is out of spec or (hopefully) easily made compatible.

It fails with the following, after (or in) the "locating sandbox directories" step:

remote:    *** ERROR: Cannot build sandbox directory
remote:    *** ERROR: Failed to deploy app
remote:    *** ERROR: Deploying buildpack only
remote: 
remote:        To continue, build the app on a one-off PX dyno:
remote:        $ heroku run -s PX build
remote: 
remote:        Next, deploy the app:
remote:        $ git commit --amend --no-edit
remote:        $ git push -f heroku master

Of course, I'm not on heroku, so I can't run with a PX dyno. But the machine I'm on has 8GB of ram, so I don't think it is a resource issue (PX have 6GB, AFAIK).

To reproduce the issue, create a machine and install dokku on it (Digital Ocean has a pre-made image with it, or else it just needs an ubuntu 14.04 system and a shell script they provide can set it up).

Set up DNS records - an A for some root domain to the host, and * to the same host. (Or you can use a subdomain and a * under that). Now visit that url via a browser to set it up.

Then alias dokku to ssh dokku@domain-that-you-chose (or just type it out every time) and set up a demo application (I chose hello-wai):

dokku apps:create haskell-wai-app
dokku config:set haskell-wai-app BUILDPACK_URL="https://github.com/mietek/haskell-on-heroku.git" 
dokku config:set haskell-wai-app HALCYON_AWS_ACCESS_KEY_ID=youraccesskey
dokku config:set haskell-wai-app HALCYON_AWS_SECRET_ACCESS_KEY=yoursecretkey
dokku config:set haskell-wai-app HALCYON_S3_BUCKET=yourbucket

And then set up the remote and push the application:

git remote add dokku dokku@domain-that-you-chose:haskell-wai-app
git push dokku master
mietek commented 9 years ago

Please try again, with:

$ dokku config:set haskell-wai-app HALCYON_NO_BUILD_DEPENDENCIES=0

This is explained in the “Build the sandbox” section of the tutorial.

dbp commented 9 years ago

Thanks @mietek - that helped a lot, to the point where it builds the application successfully, but it errors out towards the end with:

remote: /build/compile.sh: line 73: /tmp/buildpacks/custom/bin/release: No such file or directory

The full trace when I push a second time (so everything is pre-built in s3):

-----> Cleaning up...
-----> Building haskell-wai-app from buildstep...
-----> Adding BUILD_ENV to build environment...
-----> Fetching custom buildpack
-----> Haskell app detected
remote: 
remote: 
remote: -----> Welcome to Haskell on Heroku
remote:        BUILDPACK_URL:                            https://github.com/mietek/haskell-on-heroku
remote:        CURL_CONNECT_TIMEOUT:                     5
remote:        CURL_TIMEOUT:                             30
remote:        HALCYON_AWS_ACCESS_KEY_ID:                (secret)
remote:        HALCYON_AWS_SECRET_ACCESS_KEY:            (secret)
remote:        HALCYON_NO_BUILD_DEPENDENCIES:            0
remote:        HALCYON_S3_BUCKET:                        s3...
remote: 
remote: -----> Installing buildpack... done, f88763a
remote: -----> Installing Halcyon... done, 7210a8a
remote: -----> Installing bashmenot... done, 08977d6
remote: -----> Examining cache contents
remote:        halcyon-build-hello-wai-1.0.tar.gz
remote:        halcyon-cabal-1.20.0.3.tar.gz
remote:        halcyon-cabal-1.20.0.3-hackage-2015-04-15.tar.gz
remote:        halcyon-ghc-7.8.4.tar.gz
remote:        halcyon-install-d69b6ad-hello-wai-1.0.tar.gz
remote:        halcyon-sandbox-ffec23f-hello-wai-1.0.tar.gz
remote: 
remote: -----> Installing hello-wai-1.0
remote:        Label:                                    hello-wai-1.0
remote:        Prefix:                                   /app
remote:        Source hash:                              d69b6ad
remote:        External storage:                         private and public
remote:        GHC version:                              7.8.4
remote: 
remote: -----> Restoring install directory
remote:        Extracting halcyon-install-d69b6ad-hello-wai-1.0.tar.gz... done, 4.7MB
remote: -----> Installing app to /app
remote: -----> Installed hello-wai-1.0
remote: 
remote: -----> Examining cache changes
remote:        - halcyon-build-hello-wai-1.0.tar.gz
remote:        - halcyon-sandbox-ffec23f-hello-wai-1.0.tar.gz
remote: 
remote: -----> App deployed:                             hello-wai-1.0
remote: 
remote:        To see the app, spin up at least one web dyno:
remote:        $ heroku ps:scale web=1
remote:        $ heroku open
remote: 
remote:        To run GHCi, use a one-off dyno:
remote:        $ heroku run bash
remote:        ~ $ restore
remote:        ~ $ cabal repl
remote: 
remote: 
remote: /build/compile.sh: line 73: /tmp/buildpacks/custom/bin/release: No such file or directory

And it isn't running on there, as is probably expected (App deployed message notwithstanding). Is this an dokku problem? If so, what is it that they are doing wrong?

mietek commented 9 years ago

Dokku apparently expects the bin/release script to be included with the buildpack, while the Heroku buildpack API says including the script is optional.

dbp commented 9 years ago

@mietek thanks. I added an upstream issue, and I can confirm that by adding a dummy bin/release file (I did that in my fork) I can deploy! So success, more or less.

mietek commented 9 years ago

@dbp: What’s the status of that? I can’t tell based on the discussion in the upstream issue.

mietek commented 5 years ago

I’m sorry. This project is no longer maintained.