Happy Gopher on CircleCI


CircleCI is one of the best CI providers nowadays. It has many features that many users love, what features? please go read all the stuffs. For freebies hunter, in addition of 3 free containers for public projects, it is also have one container free for private projects, as long as you… ahh, Okay, I will not talking about marketing stuff here, just go ahead to https://circleci.com and happy link surfing!. Oh, I will be waiting for you, don’t worry.

Okay, you’ve already came back? Great, now let’s continue!

Let’s say we have a brand new Go library, a very small library actually, the library usually will looks like:

$ tree
├── README.md
├── hello.go
└── hello_test.go
0 directories, 3 files

With this typical library structure, CircleCI is automatically detect the project type and run proper tests when you add your library repository as CircleCI project. Yes, no configuration needed. It just works!

OSX Yosemite

OSX Yosemite is a great and beautiful designed operating system. Has been running Yosemite for several months, I’ve written up some notes related to it. Some of the tips probably also applicable for other OSX versions.


TimeMachine is convenient way for having backup to external drives so you don’t have to worry about losing your data anymore. When you’re activating TimeMachine backup, by default it’s also activating a “local snapshots”.

Local snapshots is a local copy of your backup when your backup drive isn’t available. Using this way, you can easily recover or revert to your previous file without needed to attach your backup drive. Pretty neat for portable usage.

Local snapshots is located on .MobileBackups on your drive root. You can’t see it from Finder, but you can see it by using Terminal by typing: ls -la /.

Docker Tips

Docker is an open platform for distributed applications. It’s portable and lightweight. Once you’re dealing with Docker, then you’ll be figuring out how to do some tasks. In this post I will show you some of them.

Managing containers

Containers are easy to create. Everytime you do docker run then a new container will be created. For seeing all active containers that you have, you can use docker ps.

Sometimes you want to display all containers that you have, so there is docker ps -a comes to play. Too much information presented? you can just display the numeric IDs only by using docker ps -a -q.

If you have too much containers, you can also do filtering on it. By passing flag -f KEY=VALUE, you have filter controls. For example, if you want to filter by container by its name called “goofy_wozniak”, you can use docker ps -a -f name=goofy_wozniak. Want to filter inactive containers? you can simply do docker ps -a -q -f status=exited.

By combining filtering above, we can build a command to remove unused containers, like this:

$ docker rm $(docker ps -a -q -f status=exited)

Monitoring Tools

I am doing research for finding suitable monitoring tools for monitoring our internal and external services. It should be:

  • Lightweight
  • Allow custom (language-agnostic) scripts
  • Able to recover the process
  • Have ability for sending alerts to multiple channels

Other features might be useful are:

  • Ability to export check results to a collector / database
  • Having dashboard UI

The tools can be free or paid and ideally is an open source project. If you have any suggestions, please leave a comment below.

ImageMagick Input and Output

Using ImageMagick’s convert is pretty straightforward. For example, if you want to resize image you can use:

$ convert -resize 200x200 image.png small.png

Sometimes we want to use image on our standard input (STDIN), to let ImageMagick knowing where the image source is we can use:

$ cat image.png | convert -resize 200x200 - small.png

Pretty simple, right?

Fix 302 Redirect on GitHub Pages

Blogging using Jekyll and hosted on GitHub is a free but absolutely great solution. In previous GitHub hosted site configuration, you need to set your domain to an A record to

$ dig subosito.com +nocomments +nocmd +nostats

; <<>> DiG 9.9.2-P2 <<>> subosito.com +nocomments +nocmd +nostats
;; global options: +cmd
;subosito.com.                  IN      A
subosito.com.           2929    IN      A

This is basically work, but if you take carefully about the response you’ll see some weird behaviour.

$ curl -I http://subosito.com/notes/vim/
HTTP/1.1 302 Found
Connection: close
Pragma: no-cache
cache-control: no-cache
Location: /notes/vim/

User IP Address on Rackspace Load Balancer

On my previous post, I show you about the ability of Rackspace load balancer to redirect HTTP request to HTTPS one. One thing you might realized that the remote visitor IP that you get is only the private IP of your load balancer. If you have a load balancer that listen protocol HTTPS, you need to change it to listen HTTP (80).

Thankfully Rackspace support SSL Termination, it means, although you change your Load Balancer protocol to HTTP, it’s still able to serve HTTPS request. The other benefits is you don’t need to set SSL on your servers (nodes), just set it to listen port HTTP (80), and everything will be on the good way to go.

Reset httpsRedirect Value

Before changing Load Balancer protocol from HTTPS to HTTP, you need to ensure that your LB has no httpsRedirect: true attributes. As you can see on my previous post, you can simply perform:

PUT https://dfw.loadbalancers.api.rackspacecloud.com/v1.0/123456/loadbalancers/5678

Content-Type: application/json
Accept: application/json
X-Auth-Token: ad95275a06384ccb979afb7797e90672

    "loadBalancer": {
        "httpsRedirect": false

Rackspace Load Balancer HTTPS Redirection

Rackspace Load Balancer is great service, it can properly redirect request to your servers based on availability of the servers or randomly. When setting up Load Balancer you need to select which protocol/port that LB would listen. Say you want LB to serve HTTPS (443) request to your servers, then you can set LB as below:

Create Rackspace Load Balancer

Once completed then you’ll have fully working LB for your domain. Don’t forget to set your domain to the LB’s IP.

Rackspace Load Balancers

Check that your domain is already pointed to LB’s IP:

$ nslookup example.com

Non-authoritative answer:
Name:   example.com

Then you can open your browser and go to https://example.com/. Congratulations, everything is working now :)