Articles

Dependency tracking in rubygems to make you ... /fail

I haven’t posted in awhile, so I’ll make this short and sweet.

  • Rubygems 1.3.7 … old news to some, newish to me… Want to uninstall a gem in plain english? don’t bother. Want it to tell you why it won’t do what you want? It doesn’t know.

desolation bin # gem uninstall rack -v 1.2.1

ERROR: While executing gem ... (Gem::InstallError)

cannot uninstall, check `gem list -d rack`

/usr/lib64/ruby/site_ruby/1.8/rubygems/uninstaller.rb:76:in `uninstall'

/usr/lib64/ruby/site_ruby/1.8/rubygems/commands/uninstall_command.rb:73:in `execute'

/usr/lib64/ruby/site_ruby/1.8/rubygems/commands/uninstall_command.rb:71:in `each'

/usr/lib64/ruby/site_ruby/1.8/rubygems/commands/uninstall_command.rb:71:in `execute'

/usr/lib64/ruby/site_ruby/1.8/rubygems/command.rb:270:in `invoke'

/usr/lib64/ruby/site_ruby/1.8/rubygems/command_manager.rb:134:in `process_args'

/usr/lib64/ruby/site_ruby/1.8/rubygems/command_manager.rb:104:in `run'

/usr/lib64/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'

/usr/bin/gem:21

  • Now of course gem list -d rack tells me exactly what I did wrong… I guess I shouldn’t be shocked as Rubygems tries to handle dependency management better… it’s too bad it’s taken a step back in usability to try and get there.
Continue Reading…

Posted by scottmlikens on Aug 23, 2010

chef .8 down and dirty in screen

Simple post, just to detail if you want .8 and don’t want to use bootstrap or runit or init and you just want it working.

  • Get the base system up

sed -i 's/universe/multiverse universe/' /etc/apt/sources.list
apt-get update
env DEBIAN_FRONTEND=noninteractive apt-get upgrade -y
echo 'sun-java6-jdk shared/accepted-sun-dlj-v1-1 boolean true' | sudo debconf-set-selections
apt-get install -y ruby ruby1.8-dev libopenssl-ruby1.8 rdoc ri irb build-essential zlib1g-dev libxml2-dev wget ssl-cert git-core couchdb sun-java6-jdk sun-java6-jre

  • Setup gem to not annoy me

echo "gem: --no-rdoc --no-ri" >> ~/.gemrc

  • Now install rubygems,

cd /tmp
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar zxf rubygems-1.3.5.tgz
cd rubygems-1.3.5
sudo ruby setup.rb --no-ri --no-rdoc
sudo ln -sfv /usr/bin/gem1.8 /usr/bin/gem

  • Install RabbitMQ

wget http://www.rabbitmq.com/releases/rabbitmq-server/v1.7.0/rabbitmq-server_1.7.0-1_all.deb
dpkg -i rabbitmq-server_1.7.0-1_all.deb

  • Install Nanite

gem install nanite

  • Make sure you have rake/etc installed

gem install rake cucumber rspec libxml-ruby jeweler thin unicorn merb-core merb-slices

  • now setup RabbitMQ so that chef can talk to it (no more nanite)

rabbitmqctl add_vhost /chef
rabbitmqctl add_user chef testing
rabbitmqctl set_permissions -p /chef chef ".*" ".*" ".*"

  • Grab Chef .8 from master and start work

mkdir git;git clone git://github.com/opscode/chef.git

  • Install chef from master

rake install

  • You may catch a few missing dependencies, gem install them if I missed it (but I think this is right)
  • Now you need to install the chef-solr bins (the gemspec isn’t fixed to do this yet)

cd git/chef/chef-solr/bin;cp * /usr/bin

  • Grab mixlib-authentication from git

git clone git://github.com/opscode/mixlib-authentication.git

  • Install mixlib-authentication

cd mixlib-authentication && rake install

  • Grab mixlib-log from git

git clone git://github.com/opscode/mixlib-log

  • Install that also

cd mixlib-log && rake install

  • Now fire up screen and start it up
  • In not the perfect order, but.

1. Start nanite…

nanite-mapper

2. Start chef-solr

chef-solr

3. Start chef-solr-indexer

chef-solr-indexer

4. Grab some configs that should work,

mkdir -p /etc/chef
cd /etc/chef;wget http://likens.us/server.rb
cd /etc/chef;wget http://likens.us/client.rb

4. Start chef-server

chef-server

5. Now configure knife to work with the webui key and you should be solid.

knife configure

6. Run chef-client over localhost and it should register and work hopefully

7. Enjoy

8. Thanks to Bryan Helmkamp for updates to this post.

Continue Reading…

Posted by scottmlikens on Dec 14, 2009

down the pipe we go

Well I took the plunge and decided to upgrade my development chef-server to .8 alpha, and as I will honestly say it was a bit bumpy getting setup; but after a little work I got everything working.

Some oddity’s i’m sure will get cleaned up during the process, but I figured I would outline what I did to get it up and running so others can hack on it and make chef .8 a better place!

  • I’m running Ubuntu Karmic release, keep that in mind….

Step 1, install the gems you need…

Continue Reading…

Posted by scottmlikens on Nov 05, 2009

Why you should never do major changes to an API/Major flow in a minor release.

You’ll have to pardon my rant, as it is a rant, however it is one that annoys me strongly when it happens… Something changes in minor release of something.

In this case, my pain is Chef; as 0.7.0 came out we were rocking with Metadata.rb, as I wasn’t paying attention and reading release documentation properly suddenly that doesn’t do squat, and everything is in Metadata.json. I’m sure there was something in one of the release notes that I omitted, however it brings up a valid point that Opscode has broken many times (I am only mentioning these 2) in the .7 release cycle

They have repeatedly broken the basic idea of not making major changes in a minor release, such as this, or when they re-wrote the bootstrap system; and then neutered the old system so you had to use the old bootstrap tarball (which is the only reason I am not up in arms).

… However, if you want to do things like this, you should release a new major version and allow people to get used to the major changes. There are always growing pains with anything new, different, … however the past has taught us that you should not make stupid major changes to a structure without a major release.

Here’s to hoping that they don’t continue this fatal folly in the .8 series (when it’s out)

update

Adam Jacob has mentioned that .8 will be a smoother release and not have the backwards compatibility issues that plagued .7

Continue Reading…

Posted by scottmlikens on Nov 02, 2009

... a simple yet elegant and quick way to move your data from MySQL to MogoDB for playing with...

After enjoying some time with MongoDB earlier I decided to instead of manually adding data, just take an existing database in MySQL and move it over to MongoDB; and from there you can truly decide for yourself right?

29 lines later, I have my data and can index it and start using it immediately.

Requirements:

  • Ruby
  • Sequel
  • MongoDB
1. Provided you have mongod running, and the ruby mysql gem installed as well as the mongo gem, you can copy and paste this rather simple script and adapt it to your needs.

#!/usr/bin/ruby
require ‘rubygems’
require ‘sequel’
require ‘mongo’
require ‘pp’
include Mongo
v = []
@db2 = Mongo::Connection.new(“localhost”).db(‘database’)
coll = @db2.collection(‘collection’)
coll.clear
@db = Sequel.mysql(
‘database’
:user => “user”
:password => “password”,
:host => “localhost”
)
@db [
“select id, column1, column2, column3 from table”
].all do |query|
b = {
:id => query[:id],
:column1 => query[:column1],
:column2 => query[:column2],
:column3 => query[:column3],
}
v.push(b)
end
coll.insert(v)

2. sit back and now enjoy. Continue Reading…

Posted by scottmlikens on Oct 19, 2009