Docker meets Vagrant (registry-less mode)

In very common web application I’m using MongoDB as a database, memcached to store session data and caches, ActiveMQ for messaging and Solr for full text search.

And every time there is a very common team is working on a very common app. And every developer in my team is changing stuff in databases. And every QA wants to have they own junk in databases. Finally I need up to 7 different environments (for every developer, and for development testing, and for staging). And I remember ‘Doing a task more than twice? Then, Automate it.’ rule.

In this article I’ll describe how to use Docker and Vagrant locally w/o remote registry. And how I can easily solve all my problems with all thous modern DevOps technologies. I’m going to use Vagrant to automate virtual machine preparation on developer computer. And Docker to do a container management. Every system component (like MongoDB or ActiveMQ) will be described as a docker container. For this step Docker will do the same job as Chef or Puppet but in the next article I’ll explain how to use it w/ remote registry to maintain non-virtual environment.

Continue reading

HTML5/AngularJS/Nginx crawlable application

Full Ajax

A lot of java web applications and java web frameworks use an architecture that does not allow separate ui and backend development. Thus, there is no way to separate team of highly specialised frontend and backend development into ui-team and backend-team. Regardless of the preferences of the developer he has to understand of how presentation and businnes-logic-layer works. If ui-developer knows just data model (which connect application tempates and controllers) and how to run server – it is a huge success. In particularly bad cases, ui-developer needs to re-build entire application when changing few lines in of the javascript code, or know about language of jsp files when he wants to correct css style. Also, formation and transfer html files from server instead of pure data affecting performance of server and network.

Continue reading

Migrating multimodule SVN project into GIT with history

Ok, you are using SVN for keeping you sources and you decided to switch into git?

This is easy if your have plain project structure:

-- trunk
    -- module_1
        -- src
    -- module_2
        -- src

You need just import it from svn using git.

But what if you have trunk, branches and tags dirs for every module:

-- module_1
    -- trunk
        -- src
-- module_2
    -- trunk
        -- src

And you don’t want to lose your history.

Continue reading

Store session data in cookie

In Web applications, users session can store a lot of data:

  • Information about the users profile
  • User roles
  • Temporary data (for example, wizard step data)

However, such storage can be a real headache if we have few backend servers that serve this application. To provide load-balancing and fault-tolerance in the service, session data should be stored in external storage (redis, memcached, sql). Appearance of new storage adds stress to supporting and performance.

Continue reading

Create your own dsl

In software development I encounter problems with creating user interfaces for manage logical chains.
More complex chain of logic cause more difficult to develop, test, and debug resulting interface.
That interfaces are hard to understand without help of man, who participated in the design.

Instead of complex interface is to try to use DSL.
This require a little more skill from the end user but in return it will eliminate the overloaded ui.
It provide a more flexible control over logic at lower labor costs.
A much easier debugging, testing, and auto-testing.

Consider the example of pethouse. We have the following classes:

class Food {
    Integer size
}
class Pet {
    String name
    Long age
    Closure hello
}
@DSLRoot("pet_house")
class PetHouse {
    String name
    Pet master
    @DSLTypeHint(Pet) List<Pet> pet
    @DSLTypeHint(Food) Map<String, Food> food
}

Continue reading