Signal doesn’t come with authentication support by default, but as it is a Rails application, is very easy to extend its functionality with a plugin.
We at Gonow started using Signal with Gitorious in a intranet and as we trust each other, authentication was not a problem. As time passed by, we changed Gitorious for Github, so we exposed our server to the internet and as some projects must stay secret, we needed a way to secure them and this way signal-auth was born.
As a Signal plugin is nothing more than a Rails plugin, the installation is like any other:
When Signal changed to Bundler as the gem dependency manager, all the projects inside it that were also using Bundler started to break, as some gems were not being loaded. This behavior did also occur with other continuous integration tools that also use Bundler, like Integrity.
This problem happend because when Bundler is loaded it sets some environment variables like BUNDLE_GEMFILE and this environment variables were being read by the projects inside Signal.
Let’s suppose Signal is installed in /var/local/apps/signal. When Signal is started, it will load Bundler and Bundler will try to read the environment variable BUNDLE_GEMFILE to know where the Gemfile is. As BUNDLE_GEMFILE is empty, it will read the Gemfile in the application root path and set this path to BUNDLE_GEMFILE. At this moment, the value of BUNDLE_GEMFILE is /var/local/apps/signal/Gemfile.
Now lets imagine we have a project inside Signal called Panthers and that his build script is like this:
When this script is executed by Signal, it will load Bundler and again Bundler will try to read the environment variable BUNDLE_GEMFILE to know where the Gemfile is. The problem is that at this time BUNDLE_GEMFILE would be set to /var/local/apps/signal/Gemfile and because of this Bundler will load Signal’s gems instead of Panther’s gems.
To resolve this, now when Signal executes a build script, it unsets some environment variables like BUNDLE_GEMFILE and RAILS_ENV, trying to simulate a “clean” environment.
If you know a better solution for this, please let me know.
I’m not a fan of Heroku’s deployment way, but I know that many people is and that many of them don’t know that with Inploy you can deploy your Rails 3 applications in a similar way.
Thomas Ritz contributed with Inploy creating a template called rails3_push. The template modifies Inploy so it creates a repository in the server on setup and pushes to it on every update, being followed by all the tasks that it executes by default on every deploy.
In order to use this template, like any other, you must specify it in the deploy.rb file:
Until all the commits got merged in both repositories, you can execute the following commands to get a configured environment:
git submodule add -b rails3 git://github.com/dcrec1/blue-ridge.git ./vendor/plugins/blue-ridge
rails g blue_ridge:skeleton
As today, starting developing a Rails 3 application using the default libraries is very easy, but when we want to use those tools that were great in Rails 2, some problems begin to appear.
These problems aren’t caused in any way due that Rails or the libraries are unstable. What happens is that a lot of plugins and gems had to update their integration with the framework and some chose to create pre-release versions, others to create branches and others just to bump to a new version, which means we have to hunt which version to use and from where in order to get compatible features.
To simplify the work of many people and to encourage the adoption of Rails 3, I decided to create a template that configures the gems I most use in my projects and installs them in the application, along with other tasks that can be easily followed in the script.
In the programming world, an annotation is a way to mark the code that is below it for many purposes. In Cucumber, the tags it uses are a kind of annotation to apply callbacks and classify some features and scenarios:
I’m a big fan of Pivotal Tracker. When we used it at Gonow, the team I was part of did sit at a single table and that was very cool, because even when using the tool, it was very easy to tell everybody what task we were picking or delivering.
When I had the opportunity to work with Pivotal in a remote team, I did miss to know what was happening in real time, so I decided to create Kilt.
Kilt is a daemon created with Ruby that requests the updates of the projects an user is involved with and notifies about them:
With Kilt I can keep working and at the same time being informed of what is happening in the projects I’m working on.
To install Kilt you just need to download the gem and execute kilt-install with your token:
sudo gem install kilt
In the case you don’t know your token, you can execute this:
curl -u USERNAME:PASSWORD -X GET https://www.pivotaltracker.com/services/v3/tokens/active
The previous command will return a xml document with the token and id of the given user. Case you didn’t like the command, another ways of retrieving the token can be found in the Pivotal Tracker documentation.
Once installed Kilt, you can initialize it by executing:
This means that you can generate a scaffold in a Rails application, go to the model, replace ActiveRecord::Base with ActiveLucene::Document and everything should be still working with the difference that the model should be being saved in a Lucene index rather than in a relational database.
As the documents are now being saved in a Lucene index, we can find them using the Lucene query syntax, without forgetting that as ActiveLucene has a similar interface to ActiveRecord, we can also find them by an id, find the first, find the last, etc.
The base class of ActiveLucene is called Document because as the documents of another systems, it doesn’t have a defined structure and all the attributes are dynamic, so you do not have to worry about them.
ActiveLucene was extracted from Lunr, a not-enterprise search server from which I will speak in a future post, but as today, it can also be used in applications where having a relational database doesn’t make much sense and especially in the ones where you want to search documents by text.
The restriction of ActiveLucene is that it only works with JRuby, since Lucene is a Java library that runs on the JVM. Case this isn’t a problem, using ActiveLucene should be much simpler and lighter than using a solution such as Sphinx or Solr, depending of the case this may result in great benefits.
Lucene has a lot of features and ActiveLucene doesn’t support them all, but they will be added to the project as needed. As today, there is support for highlighting and a little for paging, as can be seen in the following video, along with a basic demonstration of the tool:
I used to work with ThinkingSphinx until the day I needed to index documents with dynamic attributes. As Sphinx indexes data from the result of an SQL query, the goal didn’t seem possible.
I decided then to take another look at Solr. Solr, differently from Sphinx, is an HTTP server and indexes data from posted XML documents. Each document can have a different structure, so it fits perfectly with the model of dynamic attributes.
Thiago Jackwin, aka RailsFreaks, created a plugin that integrates Rails with Solr called acts_as_solr. The plugin is very good, but Thiago disappeared from the map some time ago, he lost the domain, left GitHub and doesn’t answer emails any more. As a result of this, different forks and forks of forks have been created and the Git tree became a mess.
Annoyed with the situation of the project, I decided to fork the fork I liked the most and created a new repository called acts_as_solr_reloaded, with new features. This way, I hope the project gets easier to be found and that it gives more trust. I’m also compromising myself to keep the repository up to date and to pull contributions.
As today, the new features acts_as_solr_reloaded comes with are: