Carlos Alexandro Becker

Continuous Delivery with GitHub, CircleCI, Docker and AWS Elastic Beanstalk

This is just a quick overview of how I did it in antibody’s homepage. The site has a very simple index.html plus a service that can discover and download the latest antibody version from GitHub releases. Not sure how relevant this is, but the service is written in Go. Currently, every commit pushed to the master branch of the site repo will be automatically pushed to production. There is no option to skip that.

Parse environment variables to structs in Go

In Go, it’s dead simple to get the value from an environment variable: fmt.Println(os.Getenv("HOME")) But, sometimes you have default values… so you would have to do something like this: home := os.Getenv("HOME") if home == "" { home = "THE DEFAULT HOME" } fmt.Println(home) If you need those values in a lot of places, you would end up creating a function for each one or something like that. I found this to be extremely boring.

Small Go Apps Containers

Or: how to ship your app in a <20Mb container. Well, as you may know, there is a good amount of people now building microservices in Go and deploying them as Docker containers. I do not yet have a lot of experience with Go and Docker, but I’ll try to share what I learned while building and shipping an internal tool, here, at ContaAzul. The Go code example I will assume that you know at least a little bit of Go, and, for the sake of simplicity and brevity, I’ll just use a very basic example from the Go wiki:

Avoid static imports

There are a lot of Java API’s and Frameworks which rely in static methods and the sort. Arguably, this is a bad OOP practice, but lets not enter this particular subject just yet. For example, it is pretty common to write unit tests like this: package blah; import static org.junit.Assert.assertTrue; import org.junit.Test; public class SomeTest { @Test public void testSomething() { assertTrue(1 + 1 == 2); } } While it’s kind of pretty to import static org.

Cross-compiling Go

go build generates a binary for the platform you run it in. So, if I build antibody in a Linux machine - which uses Mach-O, it will not work in OS X - which uses ELF. I wanted to distribute antibody at least for Linux and OS X, so I went out searching for how to do this in a not so complicated way… I found an article from 2012, demonstrating how to compile Go itself for multiple platforms, so you can use the specific go to build the binary for the specific platform, which is a lot of work to do.

I wrote Antigen in Go: Antibody

Learning Go was in my TODO list for a while, and finally I did something about it. This post contains some thoughts about it… Before we start, I should familiarize you with antigen. Antigen is particularly slow. With the plugins I have, it takes an eternity to load. I saw an attempt to re-write Antigen in Haskell, but I always believed that Antigen does too much, so I decided that it would be a nice thing to play with.

Running a Selenium Grid with docker-compose

At ContaAzul, we had 31 Windows machines powering our Selenium tests - one running the grid and 30 more running clients. Needless to say, this is very expensive. As we are already using Docker to run our builds (on Shippable), we decided to try it out to run Selenium tests too. It was no surprise that Selenium folks already made a ready-to-go set of Docker images. There is an image for the Selenium Grid itself, and the browser images - Chrome and Firefox, also with debug versions - which allow you to access them using VNC to “see what’s happening there”.

Docker: The very basics

Or “what the hell is this Docker thing?” Intro According to their website, Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications. Consisting of Docker Engine, a portable, lightweight runtime and packaging tool, and Docker Hub, a cloud service for sharing applications and automating workflows, Docker enables apps to be quickly assembled from components and eliminates the friction between development, QA, and production environments.

Docker Protips™

Like my old post on git, this is somewhat a collection of useful Docker commands/tricks/whatever. Feel free to leave yours in the comments! Stop all containers $ docker stop $(docker ps -qa) ps -qa will output the CONTAINER_ID of all containers; stop will get ps -qa as input and stop all of them. You can also kill all running containers instead of stop them. Delete all stopped containers $ docker rm $(docker ps -qa -f="exited=0") ps -qa will output the CONTAINER_ID of all containers; -f="exited=0" flag will tell docker ps to filter by exited containers only; rm will remove the container.

QCon Sao Paulo - 2015: A short overview

So, this week I attended to QCon-SP. The conference was great (congratulations everyone :beers:), but, I thought it would be nice to do an overview. So, the top subjects were Microservices and Docker. A lot of Big Data too, but I like the Microservices thing more, so I didn’t follow the Big Data track. We saw a lot of company culture too, and, believe it or not, it was strongly related to Microservices.