heroku - buildpacks generate slug size too heavy - node.js

I've started to create a very simple nodeJS server,
For now, the server do nothing.
I'm trying to install many buildpacks on my heroku server (The purpose of my server is a document convertor)
so this is my .buildpacks :
https://github.com/rishihahs/heroku-buildpack-libreoffice.git
https://github.com/elbongurk/heroku-buildpack-ghostscript.git
https://github.com/GetJobber/heroku-buildpack-poppler.git
https://github.com/ello/heroku-buildpack-imagemagick
So when I try to git push heroku, everything is installed, but when it's the compression times, I got this message :
remote: ! Compiled slug size: 321.1M is too large (max is 300M).
How can I avoid that ?
(nb: there is nothing I can't send from my code, so no slugfile)

Here are some things to try.
Get the heroku repo plugin and use heroku repo:purge_cache -a <app name>. Sometimes that helps.
Carefully go through the buildpacks and check for redundancy. For example, sometimes different buildpacks will both install the same package, which takes up extra space.
Sometimes static files are the problem. You could try a CDN.
Contact Heroku directly.
Go to a different platform, or perhaps use an IaaS platform.

Related

Heroku: How to deploy a NodeJS app with a private repo dependency?

I want to deploy a NodeJS app on Heroku that has a private repository listed as a dependency in package.json.
How do I grant Heroku read-only access to this single repository, without exposing any credentials unnecessarily?
This question has been asked repeatedly in various forms, but I was unable to get any of the answers working.
Here is what finally did the trick — Note that I am on Windows 10:
Generate key in git bash with the command ssh-keygen -t ssh-rsa -C "myusername#protonmail.com" (empty password)
Copy & paste the *.pub file (created by the above command) contents as a deploy key here: https://github.com/myusername/my-private-repo/settings/keys
my-private-repo above refers to the dependency, not the repo you are deploying
On Heroku, add https://github.com/heroku/heroku-buildpack-ssh-key.git as a buildpack — ABOVE — the heroku/nodejs buildpack
Set your Heroku app's environment variable BUILDPACK_SSH_KEY to the — ENTIRE — contents of the other file (not the one ending with .pub) including the NEWLINE at the end (not sure if that's optional)
Set dependency URL in package.json like so:
"dependencies": {
"my-private-repo": "git+ssh://github.com/myusername/my-private-repo.git"
}
Happy deploying 🙂

Git:Heroku Repository or object not found:

Here is the error message from Heroku master push command
Git LFS: (0 of 5 files) 0 B / 167.50 MB
batch response: Repository or object not found: https://git.heroku.com/xxxx-brushlands-xx267.git/info/lfs/objects/batch
Check that it exists and that you have proper access to it
error: failed to push some refs to 'https://git.heroku.com/xxxx-brushlands-xx267.git'
Added a long text file to Git LFS (git for large files) and after that Heroku stopped working.
What might be the issue ?
A workaround:
git push heroku master --no-verify
This disables git-lfs pre-push hook. Metadata files are commited but binaries are not uploaded.
Then, as per upendra's answer, a buildpack can be used to download the files.
After alot of googling I found that the problem is with Heroku. If you are using Heroku, then Heroku doesn't support LFS and you have to look for alternatives.
I uploaded my long text file to dropbox and accessing it from there. Heroku should definitely look in to this issue.
I found a temporary solution to the problem of using Git LFS with Heroku. I am just putting it here just in case if people are still looking for it - https://github.com/git-lfs/git-lfs/issues/805
If that doesn't work, then try this out. This method worked for me - https://github.com/raxod502/heroku-buildpack-git-lfs

Heroku Redis To Go

From command prompt I try adding Redis as heroku addons:create redistogo:nano
I get the following error
Creating redistogo:nano on MyProjectName... !!
Couldn't find that app.
I tried logging-in & installing from Heroku/Redistogo
But Heroku ask for CC information even if I select free version of RedisToGo.
Is this normal on Heroku site?
You should use this command:
$ heroku addons:create redistogo:nano --app YourAPPName
... Creating redistogo:nano on ⬢ YourAPPName... free
... Created redistogo-URL-for-your-APP as REDISTOGO_URL
... Use heroku addons:docs redistogo to view documentation

Cloudfoundry : Cannot push NodeJS app to Bluemix

I am trying to push Kibana
https://www.elastic.co/products/kibana
to Bluemix PaaS via cloudfoundry. At cf push i get this error
Error uploading application.
GetFileAttributesEx C:\Users\asd\qwe\zxc\installedPlugins\shield\node_modules\eslint\node_modules\file-entry-cache\node_modules\flat-cache\node_modules\del\node_modules\globby\node_modules\glob\node_modules\inflight\node_modules\wrappy\package.json: The system cannot find the path specified.
i can see that the package.json is actually present at that path! How do i resolve this?
cf --version
cf version 6.12.4-b4b6af1-2015-09-18T10:55:12+00:00
The error is due to the file path being too long. Add the node_modules directory to a .cfignore file in the app's root directory and then push again. The node_modules won't be uploaded and will instead be installed as part of the staging process.
See https://github.com/IBM-Bluemix/nodejs-cloudant/blob/master/.cfignore for an example .cfignore.
You could also switch to npm v3 which keeps the node_modules directory flatter, but you still wouldn't normally push it with your app.

(remote rejected) master -> master (pre-receive hook declined), Push rejected, failed to compile Node.js app

I know that there's couple posts like this one, but solution of any of them works for me.
Here is what I receive when I go for git push heroku master:
Please support. Ignoring node_modules is not working.
Docpad app - package.json file is updated according to docpad's manual.
I also have Procfile set up as in the link above.
PS. I have tried to deploy docpad app via openshift, but while Im going with manual from http://docpad.org/docs/deploy/ I receive error at step 5.
The application 'appname' is configured for git reference deployments but the
artifact provided ('https://github.com/myusername/appname#master') is a url.
Please provide a git reference to deploy (branch, tag or commit SHA1) or
configure your app to deploy from binaries with 'rhc configure-app appname
--deployment-type binary'.
If I configure myapp to deployment-type binary it isnt working neither.
The plugin which heroku tries to install returned 404 and the installation fails due to that.
Verify that the plugin is indeed public and not something you have wrote or used locally.
There is no package with this name hosted on the registry you use.
Remove the line with "docpad-plugin-blah": "2" from your package.json file. That line was provided in the docs simply to show you how to install plugins, but there's no such plugin as blah.
"dependencies": {
"docpad": "6"
},
I strongly recommend that you read through the Getting Started on OpenShift to get an overview of the development workflow using Git.
That being said, and if you really meant to use git reference deployments and you know why you are using them, then read through the Managing Deployments section on the developers page of OpenShift and find out how to properly set up git reference deployments. For instance, 'https://github.com/myusername/appname#master' is not a valid git url and therefore it cannot be cloned.

Resources