heroku outputs "error fetching custom buildpack", but only sometimes - django

I have a Django project hosted on Heroku with a buildpack forked from cirlabs/heroku-buildpack-geodjango. Sometimes when I push to Heroku it responds with
Counting objects: 16, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 790 bytes, done.
Total 9 (delta 7), reused 0 (delta 0)
-----> Heroku receiving push
-----> Fetching custom buildpack... failed
! Heroku push rejected, error fetching custom buildpack
To git#heroku.com:taplister-staging.git
! [remote rejected] dev -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:heroku-app.git'
I'm wondering if this may be an error with the buildpack itself, or if it's something about how Heroku interacts with github?
Oh, also among my heroku config is the buildpack URL
BUILDPACK_URL: https://github.com/taplister/heroku-buildpack-geodjango
Any insights are greatly appreciated.

This occasionally happens. Since you're using a custom buildpack, each time you push Heroku will download the buildpack over Git, and then use it to process your build.
Sometimes, depending on issues (network latency, temporary downtime, whatever) Heroku just won't be able to finish the Git clone, and will fail with the above error.
This is a known issue, and the only way around it is to retry the push.

Related

Django Heroku app moved to new computer - error on git push heroku master

I recently moved my Django project deployed on Heroku to a new computer. By cloning my repository on my new computer. I have now made changes to the project on the new computer and have committed to my GitHub repository.
Now I have added my project GitHub repository, as well as the Heroku remote repository to the remote and I, can see it when I run git remote -v:
heroku https://git.heroku.com/myapp.git (fetch)
heroku https://git.heroku.com/myapp.git (push)
origin https://github.com/username/repo.git (fetch)
origin https://github.com/username/repo.git (push)
Now when I want to commit new changes I do:
git add .
and then
git commit -m "commit message" - which commits to my GitHub repository? I do not know if this is correct
Now when I want to push to heroku master using the command git push heroku master
I get the following error:
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://git.heroku.com/myapp.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I have also added keys, using heroku keys:add which since I didn't have any keys on my new computer I created a new one, which now I can see it when I run heroku keys.
I want to just push the new changes I made on my repository to heroku master. How can I push the new changes? using the command git push heroku master?
I have tried these command:
git push heroku master -f
Which this gave me the error: ! [remote rejected] master -> master (pre-receive hook declined)
git push heroku +HEAD:master
Which this gave me the error: ! [remote rejected] master -> master (pre-receive hook declined)
I have tried git fetch and I still get the same error
EDIT
I ran git fetch heroku, However, Now I get a new error:
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://git.heroku.com/myapp.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details
I have tried using git push -f heroku master however, I get the error:
master -> master (pre-receive hook declined)
try this:
git pull
git add .
git commit -m "commit message"
git push heroku master
Furthermore, check out here what `git commit -m "commit message" do.

Delayed Job on Heroku does not work

My app runs fine on my local machine which has 16 Gig of Ram using 'heroku local' command to start both the dyno and workers using the Procfile. The background jobs queued in Delayed Job are processed one-by-one and then the table is emptied. When I run on Heroku, it fails to execute the background processing at all. It gets stuck with the following out of memory message in my logfile:
2016-04-03T23:48:06.382070+00:00 app[web.1]: Using rack adapter
2016-04-03T23:48:06.382149+00:00 app[web.1]: Thin web server (v1.6.4 codename Gob Bluth)
2016-04-03T23:48:06.382154+00:00 app[web.1]: Maximum connections set to 1024
2016-04-03T23:48:06.382155+00:00 app[web.1]: Listening on 0.0.0.0:7557, CTRL+C to stop
2016-04-03T23:48:06.711418+00:00 heroku[web.1]: State changed from starting to up
2016-04-03T23:48:37.519962+00:00 heroku[worker.1]: Process running mem=541M(105.8%)
2016-04-03T23:48:37.519962+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2016-04-03T23:48:59.317063+00:00 heroku[worker.1]: Process running mem=708M(138.3%)
2016-04-03T23:48:59.317063+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2016-04-03T23:49:21.449475+00:00 heroku[worker.1]: Error R14 (Memory quota exceeded)
2016-04-03T23:49:21.449325+00:00 heroku[worker.1]: Process running mem=829M(161.9%)
2016-04-03T23:49:24.273557+00:00 app[worker.1]: rake aborted!
2016-04-03T23:49:24.273587+00:00 app[worker.1]: Can't modify frozen hash
2016-04-03T23:49:24.274764+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_set/builder.rb:45:in `[]='
2016-04-03T23:49:24.274771+00:00 app[worker.1]: /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/attribute_set.rb:39:in `write_from_user'
I know that R14 is out of memory error. so I have two questions:
Is there anyway that delayed job can be tuned to take less memory. There will be some disk swapping involved, but it least it will run.
Why do I keep getting rake aborted! Can't modify frozen hash error (lines 4 and 5 from bottom of the log shown below). I do not get it in my local environment. What does it mean? Is it memory related?
Thanks in advance for your time. I am running Rails 4.2.6 and delayed_job 4.1.1 as shown below:
→ gem list | grep delayed
delayed_job (4.1.1)
delayed_job_active_record (4.1.0)
delayed_job_web (1.2.10)
Bharat
I found the problem. I am posting my solution here for those who may be running in similar problems.
I increase the heroku worker memory to use 2 standard dynos meaning I gave it 1 Gig memory so as to remove the memory quota problem. That made R14 go away, but still I continued to get
rake aborted!
Can't modify frozen hash
error and the program will crash then. So the problem was clearly here. After much research, I found that the previous programmer had used the 'workless' gem to reduce heroku charges. Workless gem makes heroku workers go to sleep when not being used and therefore no charges are incurred when not running heroku.
What I did not post in my original question is that I have upgraded the app from Rails 3.2.9 to Rails 4.2.6. Also my research showed that the workless gem had not been upgraded in the last three years and there was no mention on rails 4 on their site. So the chances were that it may not work well with Rails 4.2.6 and Heroku.
I saw some lines in my stack trace which were related to the workless gem. This was a clue for me to see what happens if I subtract, i.e., remove this gem from production. So I removed it and redeployed.
The frozen hash error went away and my delayed_job worker ran successfully to completion on Heroku.
The lesson for me was carefully read the log and check out all the dependencies :)
Hope this helps.

Changes to Loopback App Not Being Deployed via slc deploy

I am attempting to deploy some changes to a loopback app running on a remote Ubuntu box on top of strong-pm.
The changes that I make locally are not being reflected in what gets deployed to the server. Here are the commands I execute:
$slc build
$slc deploy http://IPADDRESS deploy
to which I get a successful deploy message which looks like this:
peter#peters-MacBook-Pro  ~/Desktop/projects/www/places-api   master  slc deploy http://PADDRESS deploy
Counting objects: 5740, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5207/5207), done.
Writing objects: 100% (5740/5740), 7.14 MiB | 2.80 MiB/s, done.
Total 5740 (delta 1555), reused 150 (delta 75)
To http://PADDRESS:8701/api/services/1/deploy/default
* [new branch] deploy -> deploy
Deployed `deploy` as `placesAPI` to `http://IPADDRESS:8701/`
Checking the deployed files on the server here :
/var/lib/strong-pm/svc/1/work
I can see that the changes I made to the local app are not reflected in what has just been deployed to the server.
In order to check that the changes are reflected in the build, I checked out the deploy git repository, like so:
git checkout deploy
Inspecting the files here, I can see that the changes I made are present.
**does anyone know why the changes are not reflected in what is deployed to the server ? **
I know this is a old post but for anyone getting this issue I just encountered the same problem.
Finally I used slc arc and tried to Build from there.
Make sure that the "Fully qualified path to archive" has a correct value
It should be something like
../project-1.0.0.tgz

Issues deploying django [django, git, heroku]

I created a heroku app:
$ heroku create olp-website
Creating olp-website... done, stack is cedar
Then I tried to push my git branch to the app:
git push heroku deploy
Counting objects: 25, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (25/25), 8.48 KiB, done.
Total 25 (delta 1), reused 0 (delta 0)
Pushed to non-master branch, skipping build.
To git#heroku.com:olp-website.git
* [new branch] deploy -> deploy
Then,I tried to add addons to the app:
$ heroku addons:add cloudamqp:panda
! No app specified.
! Run this command from an app folder or specify which app to use with --app APP.
So this is both a general and a specific question. Does the branch have to be the master branch (see "Pushed to non-master branch, skipping build")? And is it possible to be inside a specific heroku app or do you have to specify the app for each addon?
Yes - check out Heroku's Dev Center. The article tells you how to do it:
git push heroku yourbranch:master
As for the add-on, just specify the app. So something like
heroku addons:add cloudamqp:panda -a myappname

error: failed to push some refs to 'git#heroku.com:dry-plains-3718.git'

Here what i am getting :
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (10/10), 3.60 KiB, done.
Total 10 (delta 0), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To git#heroku.com:dry-plains-3718.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:dry-plains-3718.git'
Earlier i thought it was problem of .gitignore file but that also working fine . I have ingnored my virutal env and *.pyc as given in documentation.
I tried :
heroku create --stack cedar
also I had to add my pub key to heroku.
heroku keys:add ~/.ssh/id_rsa.pub
this is also not able solve my problem.
I don't know much about the heroku implementation. Anything specific I should check or try?
Please help me as i referred many documents but still getting same error . Thanks in advance :)
I believe cedar recognizes django apps by the existance of a requirements.txt file.
Pleaee check is to be sure you have created 'requirements.txt' and 'Procfile' in the root of your source tree that is being pushed. The names are case sensitive.
This tutorial includes instructions on creating them:
https://devcenter.heroku.com/articles/django