How to overcome build time limit for Haskell projects on Heroku? - haskell

I'm trying to deploy Haskell application to Heroku using the following buildpack:
https://github.com/mfine/heroku-buildpack-stack
The build is going well until it hits the build time limit with the following error:
-----> Timed out running buildpack Haskell
! Push failed
Is there any way to increase this limit or to speed up the build?

Just split dependencies in half and make a push with only part of the dependencies enabled. Then make a push with all of them enabled. The latter build will use cached dependencies from the former build. If the project is super heavy on dependencies it would probably require more than two steps though.

I faced a similar issue with my angular project in a VPS with 1GB ram. I solved it by building the project in my local environment first and then uploading build files to the server.

Related

Failed to deploy web package to App Service "there is not enough space on the disk"

Trying to deploy a node.js project on microsoft azure from my git repository, however after taking around an hour to build I get this error message during the deployment phase, any ideas what could be causing this?
got a feeling it could be to do with the "npm install" command being ran on startup, having all those modules being installed at once probably makes it hit the file size limit of something. If this is the case tho, any advice on how to shrink my project size?
Git project: https://github.com/JonathanAdamsONE/onedeployment

Compile time of native dependencies takes too much time in node

I setup a gitlab runner which builds my node project. One dependency is nodegit which takes 480 seconds every time I build my app.
$ electron-builder install-app-deps
• electron-builder version=22.9.1
• loaded configuration file=package.json ("build" field)
• rebuilding native dependencies dependencies=nodegit#0.27.0 platform=darwin arch=x64
• rebuilding native dependency name=nodegit version=0.27.0
Done in 480.36s.
Is there any way to cache building these native dependencies? I found prebuild which created a tar.gz file. But I am not sure how I can make my project use this specific prebuilt file. Any help is highly appreciated!
A simple google search turned up Cache dependencies in GitLab CI/CD website which seems to have exactly what you are looking for. Which can also cache Node.js, PHP, Go, and Ruby dependencies between jobs.
A prebuild step needs to be included into the dependent module publishing phase. It should not be executed by the modules consumer.

Build and deploy or deploy to build

My application is based on node.js, and uses bower.js and others task runners to compile assets and build the actual assets (minify, concat, inject...).
Since this is my first application that will be running in a scalable enviroment on Heroku, I was wondering how is the process of deploying.
I mean, my current workflow is:
cd myRepo
git commit [blabla...]
git push heroku
And when running it, it runs npm run wich calls geddy and runs the server.
If I build before pushing, there will be files that are kind of redundant, but if I push the unbuilt project, it should build it on the cloud. Is that the main idea?
Thanks
it should build it on the cloud. Is that the main idea?
Correct; checkout the Dev Center for more Nodejs information:
Heroku Dev Center: Getting Started with Nodejs
Specifically here, it lists information on bower:
Heroku Node.js Support: Customizing the Build Process

Speed up deployment on Heroku [duplicate]

This question already has answers here:
Avoid npm refresh after every deployment on Heroku
(4 answers)
Closed 8 years ago.
Heroku is great. But every time I deploy, Heroku seems to like to redownload and rebuild all the packages. With socket.io and mailparser this is taking around 3 minutes.
Is there a way to speed up the deployment process? Is there a way to tell Heroku that it can cache these items? Or can I upload prebuilt node_modules?
It seems like as of today Heroku is finally caching the node_modules folder!
-----> Deleting 6 files matching .slugignore patterns.
-----> Node.js app detected
-----> Requested node range: 0.10.x
-----> Resolved node version: 0.10.22
-----> Downloading and installing node
-----> Restoring node_modules from cache
-----> Installing dependencies
-----> Pruning unused dependencies
-----> Caching node_modules directory for future builds
-----> Cleaning up node-gyp and npm artifacts
Build time is like 3 seconds for me now.
One thing I did to speed up process was to add .slugignore file to the main folder and add all the files and folders I did not want to run the app.
Sample content of .slugignore file:
working
mockups
*.psd
*.pdf
I'm running into the same problem.
Some discussion here about caching the node_modules folder: https://github.com/heroku/heroku-buildpack-nodejs/pull/37
Another idea: https://github.com/heroku/heroku-buildpack-nodejs/issues/25
I'm thinking about a few solutions right now.
Check in node_modules in a separate branch: The core Node.js maintainers actually recommend checking in the node_modules folder into source control (for apps, not libs). I don't like this. A way to get around it though might be to have a separate production branch with a different .gitignore file that doesn't ignore node_modules. When you want to deploy, just do a rebase from your master and node_modules will be checked in. At least this keeps your master branch free from dependencies.
Add a preinstall script to package.json to download compressed dependency zip: You could also add a pre-push git hook to bundle up your dependencies and upload them to S3. This would probably be too slow though.
Modify the heroku-buildpack-nodejs: Integrate the outstanding pull request with node_modules caching:
heroku config:set BUILDPACK_URL=https://github.com/opdemand/buildpack-nodejs.git
I had the same question (see Avoid npm refresh after every deployment on Heroku).
Heroku forces a download/build/etc. sequence because they need to start an app with a 'blank slate': to clean previous undeleted files, when they move your app to another server, when you assign new web dynos, etc.
The issue is clearly with native packages, and recompilation. For all js-only packages, I commit them with my project, and remove them from package.json. It gains a few seconds, but not that much.
I should definitely be possible to pre-compile and commit native modules (I successfully run wkhtml2pdf on Heroku, for instance, with a binary compiled for linux-amd64), if you get access to a Linux box (or VM) with the same configuration - as of today, Linux [...] 2.6.32-350-ec2 #57-Ubuntu SMP [...] x86_64 GNU/Linux.
Though I would not recommend it as a definitive solution, since it is likely to break some day - It does not seem to me that heroku guarantees the platform an app runs onto.
Seems like there has recently been progress at the heroku-buildpack-nodejs.
Once the pull request is merged, you can add
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs
to your heroku environment variables.
For now, David Dollar's forked repository is available at
https://github.com/ddollar/heroku-buildpack-nodejs
With this as your BUILDPACK_URL it should cache the npm modules.
I tried it with node.js 0.10.5a, npm version: 1.3.5 and npm_modules in .gitignore. Tt seems to work fine so far!
Check out this branch of the new Heroku Node.js buildpack, now in beta, which supports node_modules caching between builds:
https://github.com/heroku/heroku-buildpack-nodejs/tree/diet
To use it:
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-nodejs#diet -a my-node-app
git commit -am "fakeout" --allow-empty
git push heroku

Changing app from one language to another in heroku

Is it possible to switch a Heroku app on the Cedar stack from one language to another?
In this particular instance I am trying to migrate an app from PHP to NodeJS, which is being detected as a NodeJS app after performing a git push:
-----> Heroku receiving push
-----> Node.js app detected
-----> Fetching Node.js binaries
-----> Vendoring node 0.4.7
-----> Installing dependencies with npm 1.0.94
Dependencies installed
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size is 5.0MB
-----> Launching... done, v7
... however it then crashes with:
Error: No such file or directory - node main.js
Trying to run the Node REPL also suggests the binary doesn't exist:
> heroku run node
Running node attached to terminal... up, run.1
sh: node: not found
Is there any way to reinitialise a Cedar stack app, without creating a new instance?
Create a new instance application instance. It is probably not a good idea to try to morph one into the other. DNS will update for you automatically as that's handled by the routing mesh, and you'll be much happier and better off for it.
I (although a slightly different use case) migrated an application from Bamboo to Cedar and the whole process took me less than five minutes. The only downtime was a couple of seconds while I relocated the custom domain setup on the application.
I know it's an old question but I ran into this problem changing my app from PHP to NodeJs. The first time I run the git push heroku master I got an error saying that it couldn't use PHP buildpack.
So I went in my app Settings tab in Heroku dashboard and remove the PHP buildpack from the Buildpacks list.
Finally whe I ran git push heroku master, Heroku auto detected the NodeJS buildpack.

Resources