Thursday, 9 November 2017

Cloud Foundry and Ruby on IBM Bluemix - Learning, learning, learning - keep those lessons learning

Following a previous post: -


I'm running through this: -


and was hitting an issue with the version of Ruby specified within some of the lesson material.

This is what I saw: -

cf push

Using manifest file /Users/davidhay/Downloads/LFS132x/Scaling/web_app/manifest.yml

Creating app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

Creating route web-app-pseudopoetic-para.eu-gb.mybluemix.net...
OK

Binding web-app-pseudopoetic-para.eu-gb.mybluemix.net to web-app...
OK

Uploading web-app...
Uploading app files from: /Users/davidhay/Downloads/LFS132x/Scaling/web_app
Uploading 1.4K, 5 files
Done uploading               
OK

Starting app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (1.4K)
Staging...
-----> Download go 1.9.1
-----> Running go build supply
-----> Ruby Buildpack version 1.7.6
-----> Supplying Ruby
-----> Installing bundler 1.15.4
       Download [https://buildpacks.cloudfoundry.org/dependencies/bundler/bundler-1.15.4-e083af6d.tgz]
       **ERROR** Unable to determine ruby: Unable to determine ruby version: Running ruby: No Matching versions, ruby = 2.4.0 not found in this buildpack
Failed to compile droplet: Failed to run all supply scripts: exit status 15
Exit status 223
Staging failed: STG: Exited with status 223
Stopping instance 2c697834-9c31-40d3-8bfc-49211038f0ab
Destroying container
Successfully destroyed container

FAILED
Error restarting application: BuildpackCompileFailed

TIP: use 'cf logs web-app --recent' for more information

Looking at the Gemfile we have this: -

source "https://rubygems.org"
ruby "2.4.0"

gem "sinatra"
gem "thin"
gem "puma"


Supposedly IBM Bluemix ( now IBM Cloud ) supports Ruby 2.4.0, as per this: -



and this: -



Thankfully this brought light to my darkness: -


I altered my Gemfile: -

source "https://rubygems.org"
ruby "~> 2.4.0"

gem "sinatra"
gem "thin"
gem "puma"


and then tried again: -

cf push

Using manifest file /Users/davidhay/Downloads/LFS132x/Scaling/web_app/manifest.yml

Updating app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

Uploading web-app...
Uploading app files from: /Users/davidhay/Downloads/LFS132x/Scaling/web_app
Uploading 1.4K, 5 files
Done uploading               
OK

Starting app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
Creating container
Successfully created container
Downloading app package...
Downloaded app package (1.4K)
Staging...
-----> Download go 1.9.1
-----> Running go build supply
-----> Ruby Buildpack version 1.7.6
-----> Supplying Ruby
-----> Installing bundler 1.15.4
       Download [https://buildpacks.cloudfoundry.org/dependencies/bundler/bundler-1.15.4-e083af6d.tgz]
-----> Installing ruby 2.4.2
       Download [https://buildpacks.cloudfoundry.org/dependencies/ruby/ruby-2.4.2-linux-x64-3810a760.tgz]
-----> Installing dependencies using bundler 1.15.4
       Running: bundle install --without development:test --jobs=4 --retry=4 --path /tmp/contents845865966/deps/0/vendor_bundle --binstubs /tmp/contents845865966/deps/0/binstubs --deployment
       Fetching gem metadata from https://rubygems.org/.........
       Fetching version metadata from https://rubygems.org/.
       Using bundler 1.15.4
       Fetching daemons 1.2.4
       Fetching eventmachine 1.2.3
       Fetching puma 3.8.2
       Installing daemons 1.2.4
       Installing eventmachine 1.2.3 with native extensions
       Installing puma 3.8.2 with native extensions
       Fetching rack 1.6.5
       Fetching tilt 2.0.7
       Installing tilt 2.0.7
       Installing rack 1.6.5
       Fetching rack-protection 1.5.3
       Fetching thin 1.7.0
       Installing thin 1.7.0 with native extensions
       Installing rack-protection 1.5.3
       Fetching sinatra 1.4.8
       Installing sinatra 1.4.8
       Bundle complete! 3 Gemfile dependencies, 9 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into /tmp/contents845865966/deps/0/vendor_bundle.
       Cleaning up the bundler cache.
-----> Creating runtime environment
-----> Saving vendor_bundle to cache
-----> Running go build finalize
-----> Finalizing Ruby
-----> Copy binaries to app/bin directory
Uploading droplet, build artifacts cache...
Exit status 0
Staging complete
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (4.2M)
Uploaded droplet (22.4M)
Uploading complete
Stopping instance 214ab50c-5785-4260-9f19-a9c99323a7f5
Destroying container
Successfully destroyed container

1 of 1 instances running

App started


OK

App web-app was started using this command `rackup -p $PORT`

Showing health and status for app web-app in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

requested state: started
instances: 1/1
usage: 32M x 1 instances
urls: web-app-pseudopoetic-para.eu-gb.mybluemix.net
last uploaded: Thu Nov 9 18:54:33 UTC 2017
stack: cflinuxfs2
buildpack: https://github.com/cloudfoundry/ruby-buildpack.git

     state     since                    cpu    memory     disk        details
#0   running   2017-11-09 06:56:11 PM   0.0%   0 of 32M   0 of 256M


cf apps

Getting apps in org david_hay@uk.ibm.com / space david_hay as david_hay@uk.ibm.com...
OK

name      requested state   instances   memory   disk   urls
web-app   started           1/1         32M      256M   web-app-pseudopoetic-para.eu-gb.mybluemix.net

YAY!

2 comments:

Heisterberg said...

Great tip!
Worked for me too.
Thanx for posting :o)

Dave Hay said...

No problems, more than happy to help :-)

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...