Author Archives: cyberaka

About cyberaka

I am an experienced Senior Solution Architect with proven history of designing robust and highly available Java based solutions. I am skilled in architecting designing and developing scalable, highly available, fault tolerant and concurrent systems which can serve high volume traffic. I have hands on experience in designing RESTful MicroServices architecture using Spring Boot, Spring Cloud, MongoDB, Java 8, Redis and Kafka. I like TDD (JUnit), BDD (Cucumber) and DDD based development as required for my projects. I have used AWS primarily for cloud based deployment and I like developing cloud enabled POC as a hobby in my spare time. I have deigned and developed CI/CD pipeline using Jenkins and leveraged Docker, Kubernetes for containerizing and deploying some of my applications. I am highly experienced in creating high performing technical teams from scratch. As an ex-entrepreneur I am very much involved in the business side of the IT industry. I love interacting with clients to understand their requirements and get the job done.

Fractal Folders

I have asked myself this question a number of times. What is the best possible way to structure my UI code? Should I cluster the files using functionality or by the type of file? etc. etc.

I found a partial answer in Fractal Folders while learning ReactJS. This basically proposes that for an UI page there are many functionalities which it is comprised of and the artefacts related to these sub-functionality should be clustered as sub-folders.

 

Uninstalling and reinstalling brew

I use brew utility for all my terminal based installation needs. However recently I had to deal with a corrupted brew install. To fix this I followed this link. The uninstallation and reinstallation worked fine and I now have a working brew instance.

The commands as mentioned in the above link are:

$ cd `brew –prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew
$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

 

Export JSON from RoboMongo

I use RoboMongo extensively for all my Mongo development work / debugging. I however sorely needed a way to export JSON from it. A Stack Over Flow link came up in a Google search and I was able to export JSON for my use. Basically you need to execute this command which uses “printjsononeline” function provided by Mongo to give you one line JSON for each row in the collection:

db.getCollection('collection_name').find({}).forEach(function(x){printjsononeline(x)});

Installing pip on MacOS

I recently started exploring python and immediately ran into the following issue:
$ pip install requests
-bash: pip: command not found

A quick google search yielded this result. So basically on MacOS you have Python preinstalled along with easy_install command. So the following command installs pip:

$ sudo easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Best match: pip 9.0.1
....
....
Processing dependencies for pip
Finished processing dependencies for pip

A quick and handy solution indeed!

Adding docker support in Spring Boot application

Adding docker containerization support in a working Spring Boot application is surprisingly easy.

Step 1: Add the docker maven plugin to your pom file.

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>com.spotify</groupId>
            <artifactId>dockerfile-maven-plugin</artifactId>
            <version>1.3.4</version>
            <configuration>
                <repository>${project.artifactId}</repository>
            </configuration>
        </plugin>
    </plugins>
</build>

Step 2: Build the application as well as the docker image

mvn clean package install dockerfile:build

Step 3: I have a local docker registry setup in my Lan so I prefer to push this image to my network registry manually (this can be automated as well however).

docker tag my-app:latest my_network_registry_host:5000/my-app

Step 4: Now we can bootup this docker image anywhere in the network.

docker run \
--detach \
--link <any database link> \
-e <Environment variable 1> \
-e <Environment variable 2> \
-p 8080:8080 \
--name my-app \
my_network_registry_host:5000/simply-hr
 Step 5: Checkout the application URL @ http://localhost:8080. Tail the log if you want to
docker logs --follow simply-hr

Setting up Redmine docker instance

In order to setup a fully functional Redmine server via Docker I use the following consolidated command:

docker run \
--detach \
--name redmine \
--link mysql:mysql \
--publish 3000:3000 \
--env="REDMINE_DB_MYSQL: redmine" \
--env="REDMINE_DB_PASSWORD: redmine" \
--volume /Volumes/DATA/Abhinav/Docker/redmine/files:/usr/src/redmine/files \
redmine

This connects my mysql docker instance with sonar and it is able to create tables and start using MySQL properly for storing all it’s data.