• Posted on

    Resolving Image Creation Failure on DockerD due Pool Size Limit


    Problem

    Sometimes, when working with docker engine on CI systems, certain type of errors could arise from the challenging restrictions or limits on the environment. This is typical with the inherent server-client architecture of docker.

    Here’s one of the problems that I’ve seen recently. When a client is connecting to dockerd in order to build an application image or prepare and pull external images, the server reports this issue:

    failed to prepare a4mv4dh8qcq283c7x47a4nwpg: devmapper: Thin Pool has 161986 free data blocks which is less than minimum required 163840 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior
    
  • Posted on

    Using UUIDs as Primary Key for Active Record Models

    It’s advised that using universally unique identifiers (UUIDs) for exposed resource identifiers is more secure, and convenient for database distribution.

    As expected, it’s relatively simple to configure Active Record to generate with UUID primary key based migrations.

    Setup

    Here are the steps:

    1. Setup the default generation inside config/application.rb:

      # config/application.rb
         
      module SampleApp
        class Application < Rails::Application
          ...
          # Change the primary key default type to UUIDs.
          config.generators do |g|
            g.orm :active_record, primary_key_type: :uuid
          end
         end
      end
      
  • Posted on

    Optimize Image Files from Your Terminal

    In many times you may find yourself in need for optimzing rapidly a bunch of images in your hands. There are handy utility libraries that can help you reduce image sizes with simple commands in the terminal. The following lists some of these tools:

    1. OptiPNG: Advanced PNG Optimizer:

    Get it for Mac OS X:

    brew install optipng
    

    For Linux Ubuntu:

    apt-get install optipng
    

    To optimize an image, run:

    optipng <img-name>.png
    
  • Posted on

    Fixing Sinatra UTF-8 issue in Tilt rendered templates

    In the past week, I’v been deploying a Sinatra app to AWS Elastic Beanstalk. In development environment, everything was working just fine, but when I published the application and tested it in production, I encountered a weird problem in one of the templates that was supposed to be supporting uft-8 text without any issues.

    Symptoms

    The error was appearing in one of the .erb view files that contains a textarea field. When it is populated with a non English text at the server, the application crashes with 500 code. Here’s a fragment of the error stack trace:

  • Posted on

    Eloquent Ruby (Book Review)

    book-cover

    Recently, I’ve read Oslen Russ’s “Eloquent Ruby” and it was delightful read overall.

    The book has a considerable reputation among the community programmers. It’s divided into (4) units on Ruby foundations and the software process practices.