Generating random passwords from linux command line

Managing production passwords isn’t a trivial task. I was trying to deploy a containerized app the other day that had a database deployed with it. During the deployment, I was trying to find an easy way to set a secure password. I didn’t want anyone to know the password because I wanted only the application to know it and no one else. Also, the container was setup in a way that the database cannot be accessed from the outside world.

So instead of hard-coding the password, after doing some research, I used the following command:Continue reading →

Setting up corporate proxy on Docker for mac

Working with Docker on corporate proxy is a painful experience. Mainly because there aren’t many guides available to do it. Finally after banging my head on the desk for a long time, my friend and colleague at https://nextmetaphor.io showed me how to do it.

First of all, fire up your terminal and open up docker tty in screen.

If you see a blank screen, press enter. You should see a prompt.

Make sure you are in the docker VM by typing the hostname command. You should see the response as moby. If your response is other than that, try that screen command again.

Now we want to view docker’s routing table. This is because we’ll need to find out the IP address of the host machine that is running the proxy. This is specific to my setup where I have a charles proxy server running on my machine which proxies to the remote corporate proxy.

Get the gateway entry for 0.0.0.0. In my case this is 192.168.65.1. That’s the IP for the host machine running docker. For the proxy running on your local machine, just map it to the port. My charles server is running on port 8099 so my proxy will be:

http://192.168.65.1:8099

Close screen by pressing Ctrl + a \ key. Once you’ve exited, open up docker for mac preferences.

Go to the “advanced” tab and fill out your proxy settings.

Hit apply and restart when done!

Your Docker for Mac should now work harmoniously with your proxy!

CodeEval: Fizz Buzz (Java)

Finally managed to get some spare time in order to do this. Helped be clear my head a bit. Here’s my quick 1 minute solution to CodeEval’s fizz buzz problem in Java:

Continue reading →

Blue-green deployments on AWS

blue green banner

Before we do this, make sure that you have a service that you want to deploy. To keep things simple, I followed the spring boot tutorial on making a restful web service. It was quick and the app worked like a charm. As usual, I went a bit extra and made my app return a stubbed list of users. You don’t have to. Make sure you have a /healthcheck endpoint and another endpoint that you can test with. In my case, I have /users which returns a list of users.

All righty then. Lets get a high level overview of what things are and how they are going to work. But before we do that, lets go through a quick real-ish life scenario.

Say you have a service that you have deployed onto AWS. Now you have a newer version of that service that you’d like to test. Since you never know if something works without actually trying it out, normally, after exhaustive testing in staging and other environments, you’d deploy that service into production to all your users. But ah ha! That one guy in your team forgot that one test case which made it blow up which means every single user of yours is now seeing error pages everywhere. This is bad so you roll it back to the previous version. Doesn’t sound too bad yet but by the time you do this, you’d have lost a couple of hours in time which would translate into actual money lost to the company which could eventually make a dent in your end of the year bonus.

Continue reading →

Gradle multi module projects

gradle logo

Recently I’ve had to deal with a lot of gradle projects, specifically the multi-module ones. It’s dead easy to setup, however, every time I do it, I have to refer to one of my old projects to see the layout. So, hopefully, while this document will certainly help future me, I hope it is of help to you too.

First things first, create a project directory. We will refer this directory as ‘project root directory’ in future. For all the awesome things that I do, we’ll call this one, drum roll please awesomeproject.

Continue reading →

%d bloggers like this: