linuxacademy / content-github-service-broker-ruby

Travis Thomsen - Repository for Cloud Foundry Certified Developer Course
Apache License 2.0
0 stars 5 forks source link

This example appears to be broken, unfortunately #1

Open immo-huneke-zuhlke opened 4 years ago

immo-huneke-zuhlke commented 4 years ago

There appear to be two distinct problems when I try to follow this example.

When pushing the service broker, I encounter the following issue:

Staging app and tracing logs...
   Downloading web_config_transform_buildpack...
   Downloading staticfile_buildpack...
   Downloading java_buildpack...
   Downloading ruby_buildpack...
   Downloading dotnet_core_buildpack...
Error staging application: An app was not successfully detected by any available buildpack
TIP: Use 'cf buildpacks' to see a list of supported buildpacks.
FAILED

I did make sure that I was in the correct subdirectory of the project root - service_broker.

This could be a compatibility issue again. The ruby_buildpack was downloaded, but its version was ruby_buildpack-cached-cflinuxfs3-v1.8.18.zip, released on 12 May 2020, which presumably doesn't support the version of Ruby specified in the Gemfile (2.4.3).

It is difficult to discover which versions of anything are supported by any given buildpack version. About the best way I have been able to discover is to open the GitHub releases log. In this particular case, it lists support for Ruby versions 2.5.7, 2.5.8 and upwards. However, even the minimum necessary version change in the Gemfile (to Ruby version 2.5.8) does not avoid the next problem: although the app can now be pushed successfully, it cannot be turned into a service. See output below.

$ cf create-service github-repo-xxx public github-repo
Creating service instance github-repo in org xxx.xxx.org / space development as xxx.xxx@nhsx.nhs.uk...
Service broker error: GitHub returned an error - POST https://api.github.com/user/repos: 404 - Not Found // See: https://developer.github.com/v3/repos/#create
FAILED

Instead, I went back to an earlier buildpack. There is none that supports Ruby 2.4.3 with stack cflinuxfs3, so the best compromise is to set the Ruby version in the Gemfile to 2.4.4 and choose version 1.7.25:

$ cf push github-xxx -k 512m -m 512m -b https://github.com/cloudfoundry/ruby-buildpack/releases/download/v1.7.25/ruby-buildpack-cflinuxfs3-v1.7.25.zip

Unfortunately this doesn't fix the problem either.

How to investigate what is going on? The app log doesn't tell me anything.

immo-huneke-zuhlke commented 4 years ago

I eventually discovered that the "repo" permission had inadvertently been removed from my personal access token! No wonder the broker was unable to access GitHub. However, the backward compatibility issue with the buildpack continues to exist.