tonycoco / heroku-buildpack-ember-cli

A Heroku Buildpack for Ember CLI Applications
MIT License
321 stars 121 forks source link

forced to purge heroku repo cache on every build #105

Closed drewnichols closed 8 years ago

drewnichols commented 8 years ago

I'm currenting seeing the following error whenever we deploy. It goes away whenever we clear the cache via heroku repo:purge_cache or if i set REBUILD_ALL=true on the target heroku app. Anyone else seeing this or have any suggestions?

Warning: Permanently added 'heroku.com,50.19.85.156' (RSA) to the list of known hosts.
Counting objects: 59, done.
Delta compression using up to 32 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (34/34), 3.97 KiB | 0 bytes/s, done.
Total 34 (delta 25), reused 30 (delta 21)
remote: Compressing source files... done.

remote: Building source:

remote: 
remote: -----> Fetching custom git buildpack... done

remote: -----> Ember CLI app detected

remote: -----> Exporting config vars to environment

remote: -----> Building environment: production

remote: 
remote:        PRO TIP: Avoid using semver ranges starting with '>' in engines.node

remote:        See https://devcenter.heroku.com/articles/nodejs-support

remote: 
remote: -----> Requested node range:  >= 0.10.0

remote: -----> Resolved node version: 4.1.1

remote: -----> Downloading and installing node

remote: -----> Using default npm version: 2.14.4

remote: -----> Downloading and installing nginx

remote: -----> Adding boot script

remote: -----> Copying configs

remote: -----> Restoring node_modules directory from cache

remote: -----> Restoring bower_components directory from cache

remote: -----> Bower already exists

remote: -----> Pruning cached dependencies not specified in package.json

remote:        unbuild bower@1.5.3

remote: -----> Pruning cached bower dependencies not specified in bower.json

remote:        /tmp/buildpack_86bd6f54dd88c3649d3e56892beab499/bin/compile: line 186: bower: command not found

remote: 
remote:  !     Push rejected, failed to compile Ember CLI app

remote: 
remote: Verifying deploy....

remote: 
remote: !   Push rejected to lift-admin.

remote: 
To git@heroku.com:lift-admin.git
! [remote rejected] 113997a5e27f4a58e72883d86d667575cda6ccbf -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:lift-admin.git'
tonycoco commented 8 years ago

Have you followed the steps atop the README.md?

You can also...

$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a APPNAME
drewnichols commented 8 years ago

yeah, heroku repo:purge_cache -a APPNAME clears up the problem for 1 deployment. On the following deploy the problem returns.

tonycoco commented 8 years ago

Weird. Could you post your bower.json and package.json files? I could be more helpful then :)

drewnichols commented 8 years ago

sure

package.json

{
  "name": "lift-admin",
  "version": "0.0.0",
  "description": "Small description for lift-admin goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "start": "ember server",
    "build": "ember build",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.0.2",
    "ember-cli": "0.2.5",
    "ember-cli-app-version": "0.3.3",
    "ember-cli-babel": "^5.0.0",
    "ember-cli-content-security-policy": "0.4.0",
    "ember-cli-dependency-checker": "^1.0.0",
    "ember-cli-fastclick": "^1.0.3",
    "ember-cli-font-awesome": "0.0.9",
    "ember-cli-htmlbars": "0.7.6",
    "ember-cli-ic-ajax": "0.1.1",
    "ember-cli-inject-live-reload": "^1.3.0",
    "ember-cli-less": "^1.3.0",
    "ember-cli-numeral": "^0.1.2",
    "ember-cli-qunit": "0.3.13",
    "ember-cli-simple-auth": "0.8.0",
    "ember-cli-simple-auth-devise": "0.8.0",
    "ember-cli-simple-auth-torii": "0.8.0",
    "ember-cli-uglify": "^1.0.1",
    "ember-cpm": "^1.3.2",
    "ember-data": "^1.0.0-beta.17",
    "ember-disable-proxy-controllers": "^0.7.0",
    "ember-export-application-global": "^1.0.2",
    "ember-idx-forms": "liftforward/ember-forms#allow-field-disabling",
    "ember-moment": "1.1.1",
    "ember-reset-scroll": "0.1.1",
    "ember-validations": "2.0.0-alpha.3",
    "express": "^4.8.5",
    "glob": "^4.5.3",
    "http-proxy": "^1.11.1",
    "morgan": "^1.5.3",
    "rimraf": "2.2.8",
    "torii": "0.5.1"
  }
}

bower.json

{
  "name": "lift-admin",
  "dependencies": {
    "bootstrap": "~3.2.0",
    "ember": "1.12.0",
    "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
    "ember-cli-moment-shim": "~0.0.3",
    "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
    "ember-data": "1.0.0-beta.17",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
    "ember-qunit": "0.3.3",
    "ember-qunit-notifications": "0.0.7",
    "ember-resolver": "~0.1.15",
    "jquery": "^1.11.1",
    "loader.js": "ember-cli/loader.js#3.2.0",
    "qunit": "~1.17.1",
    "fastclick": "~1.0.6",
    "numeral": "~1.5.3",
    "ember-simple-auth": "0.8.0",
    "lodash": "^2.4.0"
  }
}
tonycoco commented 8 years ago

Have you tried to update your version on Ember CLI? This is pretty old now...

"ember-cli": "0.2.5"
tonycoco commented 8 years ago

I think that would fix the issue. It seems like bower isn't included in that build of the Ember CLI itself

drewnichols commented 8 years ago

LOL old indeed. I'll give that a shot.

moha297 commented 8 years ago

I had posted comments in the community of the issue and REBUILD_ALL=true had fixed it for us.

I tried removing the variable to see the performance improvements. The build failed again. I followed the steps added to readme to purge app cache and doing another build with rebuild_all=true. The build was successful.

However, I removed the param from my env vars and it fails again. My logs look like as follows...

-----> Fetching custom git buildpack... done
-----> Ember CLI app detected
-----> Exporting config vars to environment
-----> Building environment: production
       PRO TIP: Avoid using semver ranges starting with '>' in engines.node
       See https://devcenter.heroku.com/articles/nodejs-support
-----> Requested node range:  >= 0.10.0
-----> Resolved node version: 4.1.1
-----> Downloading and installing node
-----> Using default npm version: 2.14.4
-----> Downloading and installing nginx
-----> Adding boot script
-----> Copying configs
-----> Custom nginx config found
-----> Restoring node_modules directory from cache
-----> Restoring bower_components directory from cache
-----> Bower already exists
-----> Pruning cached dependencies not specified in package.json
       unbuild bower@1.5.3
-----> Pruning cached bower dependencies not specified in bower.json
       /tmp/buildpack_e91ba4580419252d15215fc3b80f169f/bin/compile: line 186: bower: command not found
 !     Push rejected, failed to compile Ember CLI app

The error is pointing to bower being unavailable but the same was checked two steps before the error step - 'Bower already exists'.

My ember version is "ember-cli": "0.2.7", I can paste my bower and package.json files if it would help.

If it helps, my logs with debug mode

-----> Fetching custom git buildpack... done
-----> Ember CLI app detected
-----> Exporting config vars to environment
-----> Enable debugging
+ build_env=production
+ status 'Building environment: production'
+ echo '-----> Building environment: production'
-----> Building environment: production
+ mkdir -p /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor
+ trap cat_npm_debug_log ERR
++ /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/vendor/jq -r .engines.node /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/package.json
+ semver_range='>= 0.10.0'
++ curl --silent --get --data-urlencode 'range=>= 0.10.0' https://semver.io/node/resolve
+ node_version=4.1.1
+ '[' '>= 0.10.0' == null ']'
+ '[' '>= 0.10.0' == '*' ']'
+ '[' '>' == '>' ']'
+ protip 'Avoid using semver ranges starting with '\''>'\'' in engines.node'
+ echo
+ indent
+ c='s/^/       /'
+ case $(uname) in
+ echo 'PRO TIP: Avoid using semver ranges starting with '\''>'\'' in engines.node'
++ uname
+ sed -u 's/^/       /'
       PRO TIP: Avoid using semver ranges starting with '>' in engines.node
+ indent
+ c='s/^/       /'
+ case $(uname) in
+ echo 'See https://devcenter.heroku.com/articles/nodejs-support'
++ uname
+ sed -u 's/^/       /'
       See https://devcenter.heroku.com/articles/nodejs-support
+ echo
+ '[' '>= 0.10.0' == '' ']'
+ status 'Requested node range:  >= 0.10.0'
+ echo '-----> Requested node range:  >= 0.10.0'
-----> Requested node range:  >= 0.10.0
+ status 'Resolved node version: 4.1.1'
+ echo '-----> Resolved node version: 4.1.1'
-----> Resolved node version: 4.1.1
+ status 'Downloading and installing node'
+ echo '-----> Downloading and installing node'
-----> Downloading and installing node
+ node_url=http://s3pository.heroku.com/node/v4.1.1/node-v4.1.1-linux-x64.tar.gz
+ tar xzf - -C /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad
+ curl http://s3pository.heroku.com/node/v4.1.1/node-v4.1.1-linux-x64.tar.gz -s -o -
+ mkdir -p /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor
+ mv /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/node-v4.1.1-linux-x64 /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor/node
+ chmod +x /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor/node/bin/node /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor/node/bin/npm
+ PATH=/tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor/node/bin:/app/bin:/app/vendor/bundle/bin:/app/vendor/bundle/ruby/2.2.0/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin
++ /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/vendor/jq -r .engines.npm /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/package.json
+ npm_engine=null
+ '[' null '!=' null ']'
++ npm --version
+ status 'Using default npm version: 2.14.4'
+ echo '-----> Using default npm version: 2.14.4'
-----> Using default npm version: 2.14.4
+ status 'Downloading and installing nginx'
+ echo '-----> Downloading and installing nginx'
-----> Downloading and installing nginx
+ nginx_url=https://s3.amazonaws.com/devmynd-github/heroku-nginx-1.6.0.tar.gz
+ tar xzf - -C /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor
+ curl https://s3.amazonaws.com/devmynd-github/heroku-nginx-1.6.0.tar.gz -s -o -
+ status 'Adding boot script'
+ echo '-----> Adding boot script'
-----> Adding boot script
+ cp /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/bin/boot.sh /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad
+ status 'Copying configs'
+ echo '-----> Copying configs'
-----> Copying configs
+ mkdir -p /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/config
+ cp /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/config/htpasswd.rb /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/config
+ cp /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/config/mime.types /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/config
+ [[ ! -f /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/config/nginx.conf.erb ]]
+ status 'Custom nginx config found'
+ echo '-----> Custom nginx config found'
-----> Custom nginx config found
+ cd /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad
+ '[' '' == true ']'
+ '[' '' == true ']'
+ '[' '' == true ']'
+ '[' '' == true ']'
+ test -d /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/node_modules
+ test -d /app/tmp/cache/node_modules
+ status 'Restoring node_modules directory from cache'
+ echo '-----> Restoring node_modules directory from cache'
-----> Restoring node_modules directory from cache
+ ln -s /app/tmp/cache/node_modules /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/node_modules
+ test -f /app/tmp/cache/.heroku/node-version
++ cat /app/tmp/cache/.heroku/node-version
+ '[' 4.1.1 '!=' 4.1.1 ']'
+ test -d /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/bower_components
+ test -d /app/tmp/cache/bower_components
+ status 'Restoring bower_components directory from cache'
+ echo '-----> Restoring bower_components directory from cache'
-----> Restoring bower_components directory from cache
+ ln -s /app/tmp/cache/bower_components /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/bower_components
+ test -e /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/node_modules/bower/bin/bower
+ status 'Bower already exists'
+ echo '-----> Bower already exists'
-----> Bower already exists
+ PATH=/tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/node_modules/bower/bin:/tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/vendor/node/bin:/app/bin:/app/vendor/bundle/bin:/app/vendor/bundle/ruby/2.2.0/bin:/usr/local/bin:/usr/bin:/bin:/tmp/codon/vendor/bin
+ '[' '' '!=' '' ']'
+ status 'Pruning cached dependencies not specified in package.json'
+ echo '-----> Pruning cached dependencies not specified in package.json'
-----> Pruning cached dependencies not specified in package.json
+ indent
+ c='s/^/       /'
+ case $(uname) in
+ npm prune
++ uname
+ sed -u 's/^/       /'
       unbuild bower@1.5.3
+ status 'Pruning cached bower dependencies not specified in bower.json'
+ echo '-----> Pruning cached bower dependencies not specified in bower.json'
-----> Pruning cached bower dependencies not specified in bower.json
+ bower prune
+ indent
+ c='s/^/       /'
+ case $(uname) in
++ uname
+ sed -u 's/^/       /'
       /tmp/buildpack_aa09c05be62ba417a083a2ec16e2ee23/bin/compile: line 186: bower: command not found
++ cat_npm_debug_log
++ test -f /tmp/build_aa09c05be62ba417a083a2ec16e2ee23/DeliRadio-spark-aac045774211db8f2436fe6c7fca779e3eb395ad/npm-debug.log
 !     Push rejected, failed to compile Ember CLI app
rinti commented 8 years ago

I'm also getting remote: -----> Pruning cached bower dependencies not specified in bower.json remote: /tmp/buildpack_2f164fb4b7c8e7f5c012a8b90424096e/bin/compile: line 186: bower: command not found

if i dont use REBUILD_ALL. I'm on "ember-cli": "1.13.8"

tonycoco commented 8 years ago

For now, I've tagged pre-performance release as 0.9.0 and post-performance as 1.0.0. You can point your build pack URL at those

jjhampton commented 8 years ago

Experiencing similar issues as above:

-----> Fetching custom git buildpack... done
-----> Ember CLI app detected
-----> Exporting config vars to environment
-----> Building environment: production
       PRO TIP: Avoid using semver ranges starting with '>' in engines.node
       See https://devcenter.heroku.com/articles/nodejs-support
-----> Requested node range:  >= 0.10.0
-----> Resolved node version: 4.1.1
-----> Downloading and installing node
-----> Using default npm version: 2.14.4
-----> Downloading and installing nginx
-----> Adding boot script
-----> Copying configs
-----> Restoring node_modules directory from cache
-----> Restoring bower_components directory from cache
-----> Bower already exists
-----> Pruning cached dependencies not specified in package.json
       unbuild bower@1.5.3
-----> Pruning cached bower dependencies not specified in bower.json
       /tmp/buildpack_fb50e17f6279ec7203a7c0a0df6a83e5/bin/compile: line 186: bower: command not found
 !     Push rejected, failed to compile Ember CLI app

Ran heroku repo:purge_cache and it built successfully after re-deploy.

lardawge commented 8 years ago

I am not clear on what the actual problem or fix is. Deploying is VERY painful and slow. Running on 0.9.0 or 1.0.0 ends with errors until I purge cache. What is the suggested happy path here?

dnesteryuk commented 8 years ago

We are experiencing the same issue, we can deploy only after purging the cache.

kjarri commented 8 years ago

I having this same issue on a recent Ember project, so I'm using the latest ember-cli and most other components should be of latest version as well.

sbounmy commented 8 years ago

same here can't deploy unless I purge + rebuild all. I've tried to use buildpack version 0.9.0 but without success...

tonycoco commented 8 years ago

Can you try to...

$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a APPNAME

And then get on the latest?

sbounmy commented 8 years ago

I meant I've tried on latest it only works with purging + rebuild all. I gave a try on 0.9.0 but didn't build correctly. Sorry for being unclear in my last comment.

tonycoco commented 8 years ago

I'm going to try to recreate this tonight and fix it. Sorry about the mess! :)

kjarri commented 8 years ago

I just noticed that my packages.json didn't actually have bower specified, so the purge action in the buildpack seems to have removed bower on each push to heroku.

I've added "bower": "1.5.3" to packages.json and it seems to do the trick for me.

drewnichols commented 8 years ago

Adding bower to the package.json seems to have fixed the issue for me also

tonycoco commented 8 years ago

Hmm interesting. I'll take a look at ensuring that bower is installed.

tonycoco commented 8 years ago

Bower now gets locked to 1.5.3 in the install. Should fix this.

tonycoco commented 8 years ago

See: #110

sbounmy commented 8 years ago

@tonycoco do we need to have bower in package.json ? Because I just encountered this error by removing REBUILD_ALL

Delta compression using up to 8 threads.
Compressing objects: 100% (57/57), done.
Writing objects: 100% (65/65), 7.94 KiB | 0 bytes/s, done.
Total 65 (delta 42), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Fetching custom git buildpack... done
remote: -----> Ember CLI app detected
remote: -----> Exporting config vars to environment
remote: -----> Building environment: production
remote:
remote:        PRO TIP: Avoid using semver ranges starting with '>' in engines.node
remote:        See https://devcenter.heroku.com/articles/nodejs-support
remote:
remote: -----> Requested node range:  >= 0.10.0
remote: -----> Resolved node version: 4.2.1
remote: -----> Downloading and installing node
remote: -----> Using default npm version: 2.14.7
remote: -----> Downloading and installing nginx
remote: -----> Adding boot script
remote: -----> Copying configs
remote: -----> Restoring node_modules directory from cache
remote: -----> Restoring bower_components directory from cache
remote: -----> Bower already exists
remote: -----> Pruning cached dependencies not specified in package.json
remote:        unbuild bower@1.5.3
remote: -----> Pruning cached bower dependencies not specified in bower.json
remote:        /tmp/buildpack_31d6231289be5ed18ecfeac448341d99/bin/compile: line 186: bower: command not found
remote:
remote:  !     Push rejected, failed to compile Ember CLI app
remote:
remote: Verifying deploy...
heroku buildpacks -a myapp
=== myapp Buildpack URL
https://github.com/tonycoco/heroku-buildpack-ember-cli.git