Setting up a simple web server with Ansible

A few weeks ago I presented a short introduction to Ansible. Here's a video in which you can learn the basics of server provisioning.

I'm telling how to build a simple web server with Ansible - for that I'm using roles, tasks, variables, templates and loops.

The advanced project which is mentioned is available at GitHub

Easy Sign Ups For ServiceDesk just got released!

So after I few months I finally had time to finish and release Easy sign ups!

Basically the whole thing was laying on the disk almost done for weeks. But didn't have the time and mood to finish it. To be honest for most of the time I was juggling between moving forward with the project or killing it.

Luckily the sales of OpenID Authentication for JIRA were recently going up. As those two share most of the code it give me a spark to finish the product. Also I was contacted by a few people interested in using the plugin with ServiceDesk.

I have already a few downloads from people interested in the plugin and I haven't started marketing it yet. I plan to contact all the previous customers and let them know about the plugin.

I silently expect this plugin to beat OpenID for JIRA at least two-folds. Will see if my guesses were right in a year.

Now I'm playing again with Zen. Thinking about killing the idea too and using this time for something more productive.

Before I make any decision I plan to play with PostgREST more - I need to figure out how it handles security. I know it does but I haven't figured it out yet if that's something I could use.

Zen - playing around with Phoenix - Trello tribute (or clone)

I was playing recently with Phoenix Trello an open source clone of Trello.

I'm looking for ways to add new features to Zen as quickly as possible and with the least effort I can. So when I found it I though it would be great to incorporate it.

But since I played with it I'm not so eager. I decided that boards in Trello-way would be a limitation.

I also want to focus first on more important things - like having a workflow and custom fields. I think I can achieve more having a simple issue view first.

Still thinking though. I know people love boards. But I don't want Zen to be another fancy board.

I'm more into process management.

Having said that I need to put the project aside for some time as I need to release OpenID Authentication for ServiceDesk first. This is something that could potentially bring me more income.

And as I already did some fun stuff I'm going to present couple of brown bags at Spartez, this Friday is Ansible, then PostgREST, later React.

Atlassian doesn't know how to do free software

Recently a buddy of mine sent me a post summing up bad experiences people had with Atlassian's SourceTree. What an angry mob :-)

It's not the first time the company didn't know what to do with its free offering. Once upon a time I worked on Atlassian Connectors for Eclipse and we were struggling to move the product forward. Finally after years it was killed.

If you have a product like JIRA which brings a lot of money and a companion app that is free guess where all the effort will go? We had some good ideas back then - like moving code reviews into IDE. That could have been a great feature but was complex to implement and cost us a lot of time to support (as Eclipse didn't have any nice API and we used a lot of hacks). So the product was castrated at some point to make it simpler to maintain.

At the same time ALM works were working on their JIRA client and after the years Connector is gone and they are still around as they had an incentive to build a product that people want, give them good support and move it forward. As they got paid to do it.

It's not that Atlassian is bad at free software to be honest. I think there's no point in doing free software in the first place. Money is a great indicator of people's interest. If they give you money they find the software useful.

And you don't want to make a useless software, don't you?

Zen - adding nice issue keys

Stealing good ideas is a good idea. So loving the fact that every JIRA issue has a nice key I want to have exactly the same in Zen.

I'm using PostgREST as a backend for now. That's an easy way to write to the database without writing any code. But at the same time that's a stupid way to write to the database because you cannot add any custom code.

Without any other place to write the code that forces me to use the power of the database (or PostgreSQL in this case). Fixing this requires only two triggers:

class CreateProjectNoRule < ActiveRecord::Migration
  def change
    execute <<-SQL
      CREATE OR REPLACE FUNCTION projects_insert_row() RETURNS TRIGGER AS $sql$
        DECLARE
          sequence_name text;
          create_sequence text;
        BEGIN
          IF NEW.seq IS NULL THEN
            sequence_name := 'project_no_' || (SELECT nextval('projects_no'));
            create_sequence := 'CREATE SEQUENCE IF NOT EXISTS '
              || quote_ident(sequence_name) || ' START WITH 1 OWNED BY projects.seq';
            EXECUTE create_sequence;
            NEW.seq := sequence_name;
          END IF;

          RETURN NEW;
        END;
      $sql$ LANGUAGE plpgsql;

      CREATE TRIGGER projects_insert BEFORE INSERT ON projects FOR EACH ROW EXECUTE PROCEDURE projects_insert_row();
    SQL
  end
end
class CreateIssueNoRule < ActiveRecord::Migration
  def change
    execute <<-SQL
      CREATE OR REPLACE FUNCTION issues_insert_row() RETURNS TRIGGER AS $sql$
        DECLARE
          sequence_name text;
        BEGIN
          IF NEW.no IS NULL THEN
            sequence_name := (SELECT seq FROM projects WHERE id=NEW.project_id);
            NEW.no := (SELECT nextval(sequence_name));
          END IF;

          RETURN NEW;
        END;
      $sql$ LANGUAGE plpgsql;

      CREATE TRIGGER issues_insert BEFORE INSERT ON issues FOR EACH ROW EXECUTE PROCEDURE issues_insert_row();
    SQL
  end
end

This it the power of using the database to its full potential. Cannot wait to introduce more advanced concepts :-)

And yes, this means that I'm tying Zen to PostgreSQL forever. I can live with that.

But wait, aren't those migrations written with Active Record Migrations? They are, but I'm using an awesome gem standalone migrations to run them without Rails project.