Published at 29.10.2014
Table of Contents
When it comes to Ruby development we often rely on Open Source libraries (gems) to implement our applications. And we rely on Bundler to take care of our gem dependencies and versioning.*
Since buildpacks execute the bundling process (
bundle install) during the staging phase of applications, all needed dependencies are downloaded from the Rubygems servers.
Sometimes we rely on dependend gems in private repositories to build our application. Since we don’t want to add login information to our Gemfile we need to ensure that all needed packages exist in our application prior to uploading it to anynines using the
cf push command.
Let’s take our Sinatra sample application as a deployment example.
Let’s assume we want to add a private gem located at
<strong><em>email@example.com:anynines/private_gem.git</em></strong> to our application.
This is what our Gemfile would look like:
If we configured our git environment properly, we can install the new gem by using the
bundle install command as usual. For more information on how to setup your git environment with github.com please refer to this excellent article.
We need to ensure that all our gem dependencies are provided to the anynines platform when uploading our application. Bundler offers the bundle package command to store the dependent .gem files and git repositories in the vendor directory in the application’s root directory.
Now that we have all our gems in place we can deploy our application to anynines:
The push command will upload our app’s bits including the vendored gems to the anynines platform and use them to bundle the application prior to starting it.
If you are new to anynines or Cloud Foundry please have a look at our documentation to learn how to use anynines to deploy your applications. Feel free to browse through our Github repositories including additional application examples in various programming languages ready to be deployed to anynines.
* If you are new to the Ruby world please refer to this article on how to use Bundler.