Closed harlantwood closed 9 years ago
Thanks for getting started on this @harlantwood
I've pushed this branch to a test over at http://graphdocs-test.herokuapp.com/ and am getting an application error even though the build seems to have succeeded without errors. The logs currently show:
May 14 12:06:54 graphdocs-test app/web.1: bin/compile: line 5: node_modules/.bin/lessc: No such file or directory
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! Linux 3.13.0-49-generic
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! code ELIFECYCLE
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! graphdocs@0.0.0 prestart: `rm -rf app/assets/libs && bower install && bin/compile`
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! Exit status 1
May 14 12:06:54 graphdocs-test app/web.1: npm ERR!
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! Failed at the graphdocs@0.0.0 prestart script 'rm -rf app/assets/libs && bower install && bin/compile'.
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! This is most likely a problem with the graphdocs package,
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! not with npm itself.
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! Tell the author that this fails on your system:
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! rm -rf app/assets/libs && bower install && bin/compile
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! You can get their info via:
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! npm owner ls graphdocs
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! There is likely additional logging output above.
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! node v0.12.3
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! npm v2.9.1
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! Please include the following file with any support request:
May 14 12:06:54 graphdocs-test app/web.1: npm ERR! /app/npm-debug.log
I'm not sure why the lessc file is missing from there.
Because less and require.js are in devDependencues, you need to do:
heroku config:set NPM_CONFIG_PRODUCTION=false
Maybe we should add this to a deployment section of the readme.
Hm, the asset compiling prestart
is taking too long, I am getting:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
There are 2 solutions I can see:
postinstall
instead of prestart
. This should work on heroku, but may be a pain in local development, as it will execute after every npm install
Any feedback welcome.
I implemented option (1) above in this PR. This now deploys correctly. Open to finishing option (2) as well, though I think its probably best done from CI, as in the example links above, as it is a lot of messing around with git branches for a dev box...
Works for me, @willzeng can you put it on the test heroku instance when you get back?
I'm feeling more enthusiastic about option (2) above. I'll make another PR for that and reference it here. Let's hold off on merging this PR for now, so we can choose between the two strategies.
Not fully debugged yet, but here is a sneak peak at option (2) in action:
production
in this case) to my test cograph heroku instance: -- expand the bin/deploy
section to see the compilation and deploy to heroku.Once it is working reliably I'll create a PR. This system is the best of all worlds, IMO; I will expand on that in the PR.
(Of course, CI is the ideal place to run your tests as well, as they get fleshed out.)
Feedback welcome as always.
Thanks @harlantwood, getting continuous integration working would be great. This second would definitely be the way to go. What still needs to be set up for it to run reliably (besides configuring the tests)?
You're welcome @willzeng -- glad we agree on the second option being preferable.
I tested deployment about 10x in a row with zero failures, so now consider it reasonably reliable.
I opened #642 for that strategy; closing this one.
(Hopefully) simplified and improved the npm / heroku setup.
Notes:
set -e
means that if any command fails, execution stops (app fails to start)less
to dev dependenciesrm -rf app/assets/libs
because repeatedbower install
(on my machine at least) caused errorsUpshot: everything should work the same as before, except that
npm start
now runsbower install
instead of the Procfile doing it.lessc
should now work on Heroku, which it was not for me previously.