mfojtik blog

Look at you, hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge perfect immortal machine

Resolve application DNS in OpenShift v2

If you followed this OpenShift howto and you installed OpenShift Origin using the Puppet modules in Vagrant, then maybe you come across with the problem how you can access your OpenShift applications outside the Vagrant virtual machine. By default OpenShift vagrant file will forward ports 80, 443, 22 and 53 to your host machine. This allows vagrant ssh to work and also allows you to access OpenShift Apache service using curl http://localhost:8080.

How we started using Sequel in Deltacloud

Since I started working on Deltacloud API, we always used to say that Deltacloud is stateless and you don’t need to have any persistence store. Well, that is no longer true and we added the database as a dependency. But don’t panic, Deltacloud is still stateless and the database is here only to help our CIMI implementation be even more awesome. The story begun when we came across the problem of how to map some CIMI entities and some properties to the backend providers.

rbenv - a better alternative for rvm in Fedora

If you are Ruby developer, you may know that there is more than one Ruby platform. Sometimes it is important to easy switch between them, without messing up the operating system and installed gems. So far, the most popular utility for managing multiple Ruby distributions is RVM. However this tool goes far beyond to just switching Ruby versions. It has bundled gem sets management, it patches Ruby to achieve better integration and many other ugly things.

Ruby application boilerplate

You know it, you’ve got an idea but the process of getting all files in place is boring and slows you down. In the end, you find yourself dealing with CSS and DataMapper configuration rather than working on the ‘real’ application logic, which I found very frustrating. Boilerplater Because I don’t want to start all the time from the scratch, I created a small Ruby utility to help me bootstrap my new application development.

Deltacloud with EC2 frontend? Why not.

We are doing the Deltacloud API project because we think that preventing from vendor API lock-in is very important to everyone who uses services provided by a public or private cloud vendor. But what if you are already locked in to one particular cloud API? And yes, I am speaking about the Amazon EC2 API which seems to by widely adopted. Since this API is soo popular, the other projects like OpenStack or Eucalyptus provide an EC2 API adaptor for those who are already locked by Amazon EC2.

How to have nice Ruby exceptions

Deltacloud is now modular and offers the drivers API

The Deltacloud API revamp is now done and pushed to our master GIT repo. The revamp itself does not affect the backward compatibility nor introduces any API schema changes. The main goal of this work is to make Deltacloud API a modular Sinatra application, thus pluggable to any other Rack-based web application (Rails, Padrino, Sinatra, etc..). As a side effect, since we do not use the Sinatra methods in a global namespace, this revamp also introduces the possibility to use Deltacloud API as a Ruby library.

Deltacloud API using modular Sinatra way

When we started the Deltacloud API project three years ago, we thought the best way how to do it would be to use the Sinatra framework. This Ruby framework provides a simple DSL for writing small-size web applications. And since Deltacloud API does not use any database or complicated messaging system it is perfect use-case for Sinatra application. However, after a while, we realized that using just plain Sinatra routes is not perfectly DRY, since we repeated too much code and actions.

Avoiding anti-patterns in Ruby - Arrays

Since I came to Ruby from the Java and PHP world I’ve found many expressions used in Ruby cryptic and I’ve been trying to avoid them in my daily life. After years and thousand lines of Ruby code I’ve read, I feel a need to change the way I write the code. I want to make my code look better, readable and preferably save some keystrokes. In software engineering, an anti-pattern (or antipattern) is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.

Creating REST API's using Sinatra and Rabbit

When we started working on Deltacloud API rewrite to Sinatra, we realized that creating routes for every single Deltacloud collection can be pretty frustrating. Usually, when you writing REST based application in Sinatra you end-up with typing the same CRUD operations for every collection of resources your application have. This was a bit frustrating, since many operations are similar and basically doing the same thing. For example the ‘show’ operation is usually defined like this: Basically you type this code over and over for all :show operations.