deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 41 forks source link

Heroku buildpack for Ruby is broken in 2.6.1 #454

Closed smt116 closed 7 years ago

smt116 commented 7 years ago

I am in the middle of preparing instructions for creating a local cluster from scratches using minikube. Everything works fine till the moment of deployment for the application. I have a sample Ruby application and I am not able to deploy it using deis-builder v2.6.1. Here is the output:

sinatra-sample-application λ g push local master
Counting objects: 139, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (103/103), done.
Writing objects: 100% (139/139), 587.00 KiB | 0 bytes/s, done.
Total 139 (delta 61), reused 54 (delta 20)
remote: Resolving deltas: 100% (61/61), done.
Starting build... but first, coffee!
-----> Restoring cache...
       No cache file found. If this is the first deploy, it will be created now.
-----> Ruby app detected
/tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/shell_helpers.rb:38:in `read': Is a directory - /tmp/env/..data (Errno::EISDIR)
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/shell_helpers.rb:38:in `read'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/shell_helpers.rb:38:in `block in initialize_env'
remote: from /usr/lib/ruby/1.9.1/pathname.rb:435:in `each'
remote: from /usr/lib/ruby/1.9.1/pathname.rb:435:in `each_child'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/shell_helpers.rb:36:in `initialize_env'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/bin/compile:13:in `block in <main>'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:35:in `call'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:35:in `block in trace'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:40:in `yield_with_block_depth'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:17:in `block in instrument'
remote: from /usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:16:in `instrument'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/lib/language_pack/instrument.rb:35:in `trace'
remote: from /tmp/buildpacks/heroku-buildpack-ruby.git/bin/compile:11:in `<main>'
       !
       !     Is a directory - /tmp/env/..data
       !
remote: 2016/12/06 10:41:41 Error running git receive hook [Build pod exited with code 1, stopping build.]
To ssh://deis-builder.192.168.99.100.nip.io:2222/sinatra-app.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@deis-builder.192.168.99.100.nip.io:2222/sinatra-app.git'

The same command works fine if I change deis-builder deployment to v2.5.4 and replace the pod.

kmala commented 7 years ago

the only difference between both releases which might affect anything is https://github.com/deis/builder/pull/447 and the ruby buildpack is updated https://github.com/deis/slugbuilder/pull/120. I tested with the example ruby app and it is working fine https://github.com/deis/example-ruby-sinatra. However when i use the example given by you(https://github.com/smt116/sinatra-sample-application) i get corrupt gemfile error Your Gemfile.lock is corrupt. The following gem is missing from the DEPENDENCIES section: 'bacon' ! ! Failed to install gems via Bundler. !

mboersma commented 7 years ago

There is a newer release of the heroku Ruby buildpack which contains some bundler-related changes: https://github.com/heroku/heroku-buildpack-ruby/compare/v148...v149

@smt116 could you try the newer one to see if it resolves this issue?

deis config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-ruby#v149
mboersma commented 7 years ago

I tried the sample app mentioned above with Workflow v2.9.0 (Ruby buildpack v148) and saw the same error that @kmala mentioned (Your Gemfile.lock is corrupt.) Then I tried setting the buildpack to v149 (and v147, and v146) and I get the EISDIR error originally mentioned.

Was there a version of Workflow or builder in which this app did deploy successfully?

slack commented 7 years ago

I ran into this lastnight when putting together a demo... Since we mount a secret as /tmp/env we are getting the ..data/ ephemera from Kubernetes. I pushed a fixed buildpack to https://github.com/heroku/heroku-buildpack-ruby/compare/master...slack:env-from-files

I haven't had a chance to track down what changed and when. You can test with this buildpack by a little:

deis config:set BUILDPACK_URL="https://github.com/slack/heroku-buildpack-ruby.git#env-from-files"
smt116 commented 7 years ago

@kmala @mboersma the problem is that deployment will not proceed to the point with installing dependencies. It will fail on detecting application / compiling Ruby as said in the output with the error message.

The buildpack v149 is not working either, but @slack's fix solves the problem. @slack would you take care of the fixes / pull requests?

mboersma commented 7 years ago

works fine if I change deis-builder deployment to v2.5.4

That would seem to point the finger at #447 then, since it's the big change between that and the current versions...

bacongobbler commented 7 years ago

accidentally closed due to github seeing "Note that this doesn't fix deis/builder#454" in deis/slugbuilder#125 and immediately closing it because it saw "fix deis/builder#454". Hehe :)

mboersma commented 7 years ago

Doesn't fix--can't GitHub read? 😝

bacongobbler commented 7 years ago

I've filed a ticket about that, but we're starting to get off-topic. :)

If someone were to tackle deis/slugbuilder#124 then this problem will likely be resolved. I'm not sure if that approach would work however since secrets are mounted into the pod as read-only...

><> kd exec deis-minio-937487119-hztkj rm /var/run/secrets/deis/minio/user/accesskey
rm: cannot remove '/var/run/secrets/deis/minio/user/accesskey': Read-only file system

Perhaps if we un-mounted the filesystem?

><> kd exec deis-minio-937487119-hztkj mount | grep secrets
/dev/mapper/vg_vagrant-lv_root on /run/secrets type ext4 (rw,relatime,seclabel,data=ordered)
tmpfs on /run/secrets/kubernetes.io/serviceaccount type tmpfs (ro,relatime,rootcontext=unconfined_u:object_r:var_lib_t:s0,seclabel)
tmpfs on /run/secrets/deis/minio/user type tmpfs (ro,relatime,rootcontext=unconfined_u:object_r:var_lib_t:s0,seclabel)
kmala commented 7 years ago

@bacongobbler better thing would be copying just the files to another directory and passing that directory to the compile function.