Trifork Blog

Category ‘DevOps’

RUNNING CUSTOM “LINT” CHECKS ON YOUR ANDROID BUILDS

April 13th, 2015 by
(http://blog.trifork.com/2015/04/13/running-custom-lint-checks-on-your-android-builds/)

In this post, I’ll share a very simple tip on how to add very simple custom checks of your Android source code to your Jenkins build server, but the tip should be very easily ported to other build servers too.

What?
Most developers know of Lint checks as something which perform some kind of static analysis of their code and which complain heavily about stuff if you are enabling this check for the first time on an old project. Unfortunately, chances are rather high that you choose to disable the check due to time constraints not allowing you to fix all issues right now. Or maybe you actually enable running the checks as part of your build but choose not to make lint errors break it. Those two solutions are equally bad since none of them prevent you from adding bad code to the codebase.

Why?
I won’t go to great lengths to explain why you should perform lint checks, but I’ll say that there are many, many simple checks which can be checked at compile-time and which you (or your colleagues) might not have noticed when implementing a given feature. And why not let the lint tool weed out the stupid errors since it is so much better at detecting these things than you? For example, lint checks can prevent you from publishing an app which crashes on some devices due to code calling APIs, which are not available on devices with too low versions of Android running on them. Lint will compare the minimum API version supported by your app and the API version of every call performed in your app so you can ensure that you have carefully guarded these calls correctly and therefore won’t crash your app at run-time.

Read the rest of this entry »

How to manage your Docker runtime config with Vagrant

July 20th, 2014 by
(http://blog.trifork.com/2014/07/20/how-to-manage-your-docker-runtime-config-with-vagrant/)

Vagrant LogoIn this short blog I will show you how to manage a Docker container using Vagrant. Since version 1.6 Vagrant supports Docker as a provider, next to existing providers for VirtualBox and AWS. With the new Docker support Vagrant boxes can be started way faster. In turn Vagrant makes Docker easier to use since its runtime configuration can be stored in the Vagrantfile. You won’t have to add runtime parameters on the command line any time you want to start a container. Read on if you like to see how I create a Vagrantfile for an existing Docker image from Quinten’s Docker cookbooks collection.

Read the rest of this entry »

Docker From A Distance – The Remote API

December 24th, 2013 by
(http://blog.trifork.com/2013/12/24/docker-from-a-distance-the-remote-api/)

Docker-logoMany people use docker from the command line to build images, run containers and manage Docker on their machine. However, you can also run the same Docker commands via its remote REST API. In this blog I will guide you through Docker’s remote API using curl while pointing out a few details and tools that you might not know about. We will remotely search and pull an elasticsearch image, run a container and clean up after ourselves.

Read the rest of this entry »

NLUUG DevOps Conference 2013 – Reliability, clouds and the UNIX way

November 26th, 2013 by
(http://blog.trifork.com/2013/11/26/nluug-devops-conference-2013-reliability-clouds-and-the-unix-way/)

Last Thursday I attended the NLUUG DevOps conference in Bunnik, near Utrecht. The NLUUG is the Dutch UNIX user group. In this blog I will summarize the talks I attended, some fun things I learned and I will discuss my own talk about continuous integration at a large organization.
Read the rest of this entry »

Puppet from the trenches – How to prevent overwritten user configuration with a custom type

October 29th, 2013 by
(http://blog.trifork.com/2013/10/29/puppet-from-the-trenches-how-to-prevent-overwritten-user-configuration-with-a-custom-type/)

Puppet_LogoIn this installment of the ‘from the trenches’ series I cover the use of Puppet during one of our projects. We have used Puppet to provision Jenkins instances as part of a build and deployment platform for a large organization. I discuss the problem of when Puppet overwrites user managed configuration and how we solved it by writing a custom type.

Read the rest of this entry »

Using Docker to efficiently create multiple tomcat instances

August 15th, 2013 by
(http://blog.trifork.com/2013/08/15/using-docker-to-efficiently-create-multiple-tomcat-instances/)

Docker-logoIn my previous blog article I gave a short introduction into Docker (“an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere”). In this article we’ll check out how to create an image for Tomcat 7 and the Java 7 JDK as dependency.

So, let’s go ahead and do some ‘coding’. First, you need to install docker. Instructions can be found here. I already mentioned you need a Linux system with a modern kernel, so if you happen to be a Mac or Windows user, there are instructions on linked pages on how to use Vagrant to easily setup a virtual machine (VM) to use. For now we’ll work locally, but once you start installing servers you might find the Chef project to install docker useful as well.

As a first step after installation, let’s pick the first example from the Docker getting started page and create an Ubuntu 12.04 container, with completely separated processes, its own file system and its own network interface (but with network connection via the host), and have it print “hello world”. Do this by running

docker run ubuntu /bin/echo hello world

Cool huh? You probably just ran something on a different OS than that of your own machine or (in case you’re on Windows/Mac) the VM in which Docker is running! In this command ubuntu defines the image (found automatically as it is one of the standard images supplied by Docker). The run command creates an instance of the image (a container), feeding it /bin/echo hello world as the command to execute.

Read the rest of this entry »

Ansible from the Trenches

August 13th, 2013 by
(http://blog.trifork.com/2013/08/13/ansible-from-the-trenches/)

Although its name might suggest something different on Wikipedia, Ansible is an open source framework that is capable of automating various system tasks like setting up a server, deploying and configuring applications and command execution (See Ansibleworks.com). Ansible can run across many virtual machines without the need to augment it with other tools. For distribution on various machines Ansible by default relies on SSH as a transport layer. So aside from an SSH server, Ansible doesn’t require any additional daemons to be running on the remote servers. Also Ansible doesn’t leave any traces on remote systems after its done running. Ansible  depends on the python interpreter that comes with the majority of Linux distributions. And it uses a YAML format to describe configuration and execute commands, which makes it readable.

So why not use Ansible to deploy an application across several virtual machines?
For our project we needed to deploy and configure the following packages on Ubuntu 12.04:

  • JDK 7
  • Tomcat 7
  • Elasticsearch
  • Riak
  • Application war’s

Read the rest of this entry »