I've followed the "minimal AWS deployment" guide here https://github.com/cloudfoundry/cf-release/tree/master/example_manifests to try CloudFoundry.
I understand that I have to install the bosh_cli_plugin_micro, but when I run this on an AWS Ubuntu 14.04 VM:
gem install bosh_cli_plugin_micro
I get:
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: blobstore_client requires aws-sdk-resources (= 2.2.0); aws-sdk requires aws-sdk-v1 (= 1.60.2)
Installing the AWS ruby sdk doesn't solve the problem. I suspect it's a problem of the aws sdk being a newer version than the one the micro bosh cli expects. Anyone have any suggestions?
One way to ensure you get a consistent set of gems would be to create a Gemfile like this:
source 'https://rubygems.org'
gem 'bosh_cli'
gem 'bosh_cli_plugin_micro'
and then run the bundle command from the same working directory as where your Gemfile is placed. To make sure you're always using the right version of the CLI and plugin, prepend commands with bundle exec, e.g.
$ bundle exec bosh micro deploy /path/to/stemcell
You may even wish to alias bosh to bundle exec bosh.
Related
I am using Sinatra and ruby on AWS, I have tried with both 2.1 and 1.9.3 using the AWS cli to create my elasticbeanstalk application.
I have installed the mandrill-api gem on my local machine and ruin bundle install (although that may not be necessary) and included it in the Gemfile gem 'mandrill-api' and in the app.rb file require'mandrill-api'`
but I keep getting the "Load error" cannot load mandrill-api.
Has anybody encountered and resolved this problem?
Many thanks.
You need to require 'mandrill', not mandrill-api. See the docs
I have set up my aws environment succesfully. However i am having one probelem. In my Gemfile i have the following line:
gem 'activeadmin', :github => 'gregbell/active_admin'
When i do a git aws.push i can see the following error in the aws logs:
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler/source/git.rb:177:in `rescue in load_spec_files': git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
I was able to fix that problem by creating this file: .ebextensions/ruby.config
option_settings:
- option_name: BUNDLE_DISABLE_SHARED_GEMS
value: "1"
- option_name: BUNDLE_PATH
value: "vendor/bundle"
packages:
yum:
git: []
This packages everything into vendor/bundle and my app starts correctyl.
However I have two problems with this approach:
It takes very long to deploy because it needs to install all gems every time
I am not longer able to execute commands when I ssh into the EC2 instance. For example I have to start an rpush deamon. Locally this works with bundle exec rpush development but on EC2 this results in:
bundle exec rpush
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /var/app/current/vendor/bundle/bin in PATH, mode 040777
git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run bundle install
Is there an other way for installing the gems correctly and at the same time using the system gems? Or if that is not possible, how can I start rpush when the gems are bundled?
Update your Gemfile.lock (bundle install&& bundle update) in your local env. and push a commit with Gemfile and Gemfile.lock. Deploy to AWS again.
Can you check if using gem 'activeadmin', 'git://github.com:gregbell/active_admin' in your Gemfile works for you?
You can also get faster deployments utilizing vendor/cache by following the instructions given here:
http://blogs.aws.amazon.com/application-management/post/Tx2XVRWSS4E971S/Locally-Packaging-Gem-Dependencies-for-Ruby-Applications-in-Elastic-Beanstalk
What solved my problem: I modified the bundle install script and added the --deployment flag
I'm trying to install the gem 'taglib-ruby' on Heroku. This gem compiles as a native extension which requires a system dependency called taglib, so after compiling and uploading it through heroku vulcan, I achieved to compile the gem via command line on heroku bash:
bundle exec gem install taglib-ruby -- --with-opt-dir=/app/vendor/taglib
And in order to this parameter would be used by bundler later, I added it as a bundler configuration through the command:
bundle config build.taglib-ruby '--with-opt-dir=/app/vendor/taglib'
I've already verified this config was applied, inspecting the file /.bundle/config and looking for the line BUNDLE_BUILD__TAGLIB-RUBY.
However after pushing out my project to heroku and while it is executing the bundle install command, heroku complains that the above gem (taglib-ruby) cannot be installed due the taglib library isn't present, although it's what I was trying to solve with the option '--with-opt-dir=/app/vendor/taglib' mentioned above.
So it appears that Heroku is ignoring the bundler configuration.
What could be happening? Do you know another way the achieve the same intention (install a gem with custom build options) on Heroku?
Pretty fundamental question but I'm trying to understand how best to use Bundler in a deployment situation.
I'm working on a Sinatra application that has about 20 dependent gems. During development, I'm using RVM with a custom gemset for the application, and I run bundle install to update the gemset in accordance with the gemfile.
When it comes to deployment (manually for now, so I can understand how it all works before using a tool like capistrano), I need to do bundle install --development right? This downloads the gems and places them in vendor/bundle.
My question is what else do I need to do? I'm using Unicorn on the server - do I just bundle exec unicorn ... and everything just works? (i.e. bundler finds the vendor directory and uses the gems from there?)
Should unicorn be a vendored gem in the application or a separate 'system' gem on the server that all applications share?
You need --deployment key, not --development: http://gembundler.com/man/bundle-install.1.html#DEPLOYMENT-MODE
On first run bundler creates config in .bundle directory. You can check it by running bundle config or just cat .bundle/config in project's directory. So bundle exec unicorn is enough since bundler knows where gems are installed. On development machine you can also install gems to arbitrary directory using --path key. For more details see manpage for bundle install (link above or bundle help install).
We have built a custom socket server in ruby and packaged it as a gem. Since this is an internal project we can not simply publish it to RubyForge or GitHub. I tried to setup our own gem server but gem would not authenticate over https. Our other deployment is all for standard rails applications that use capistrano and svn for deployment.
Our current setup which is to use a rails-like deployment with capistrano. which does the following:
Check out the code from svn
Build the gem
Install the gem
Restart the server
This just seems awkward, and makes the gem packaging seem like extra work -- but outside of the deployment issue it fits really nicely as a gem.
Is there a cleaner approach?
Start
gem server #That will serve all your local installed gems.
gem install YourLocalPkg1.X.X.gem
#on YourHost
use
gem sources --add localhost:8808
gem install YourGem
on client machine
develop something
rake gem
gem install YourLocalPkg2.X.X.gem #on YourHost
use
gem update YourGem #on client machine
Maybe you have a need to use https but I don't see why in your post.
On Some Machine
* Check out the code from svn #the railspart not in the gem
* gem update YourGem # or install if not exist....
* Restart the server
You can install gems from the local filesystem.
gem install /path/to/some.gem
Shouldn't be too hard for you to script scp with that, or use an NFS mount, etc.
gem install --local path_to_gem/filename.gem will help. Or you can get a trusted certificate on your web server.
You might be able to install from the server with gem install -P NoSecurity or -P LowSecurity, but I haven't tried that.
http://www.rubygems.org/read/chapter/21