Skip to content

This was something , which intrigued me for the past few months. I couldnt find time to work on this docker item until today. The concept in using Docker to build your own unique cluster farm of bots was quite kool. One can make as many worker bees in a single cluster farm as long as there is DISK and RAM space available. I will provide one example on how i was able to build a simple cluster using Docker and Docker-tools.

1) Docker
2) Docker-Toolbox

In order for us to build a simple docker cluster bots, we must create a BOSS worker agent then create other worker bees in this exact order.

I am assuming you are on linux/mac since windows docker worker agents will be a whole different beast, where one has to deal with, when comes to building a docker cluster bot farm aka a Borg Collective.

1) docker-machine create --driver virtualbox boss1
2) docker-machine ip boss1
3) docker-machine ssh boss1

so now, we are inside boss1 the container, we must initialize the boss1 to become the BOSS in this docker Cluster.

1) docker swarm init --advertise-addr boss1_IP_addr
it returns something like this:

docker swarm join --token SWMTKN-1-5qualk27cjkwaplb1j7zn88me2zlxqe7owe1cn2c2s14wb2mpt-3liv5iz5sz9c8j6jtd3w5nql8 192.168.99.100:2377


2) docker node ls
it returns something like this:

ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
88ruvvd93cwd7cp4jt5u1tkwg * boss1 Ready Active Leader 19.03.5

So now, you can see that this container had became a cluster leader in our swarm. We must now add other worker bees to our cluster (Borg Collective). We must now fire-up another terminal tab in your OS to create additional worker containers (repeat this task below to create more borgs/bees by changing work1 to work2 or *workN).

*where workN , N is a number.

1) docker-machine create --driver virtualbox work1
2) docker-machine ip work1
3) docker-machine ssh work1

Now, we would need to paste that command from above to allow this worker1 to join the BOSS Collective.

4) docker swarm join --token SWMTKN-1-5qualk27cjkwaplb1j7zn88me2zlxqe7owe1cn2c2s14wb2mpt-3liv5iz5sz9c8j6jtd3w5nql8 192.168.99.100:2377

Its weird how this worked so well, but continue to open a new tab and run steps 1,2,3 in creating additional worker borg agents then add the BOSS ID to each of the worker bees (depending how many you wish to make). These steps did worked ! After creating a dozen or so bots, you can install all kinds of opensource software unto them and allow the BOSS to control the worker bees/borgs aka swarm/collective.

If you do decide for your worker bees to get out of your swarm. In each of the workers, one can execute including the leader.

docker swarm leave

once outside of the swarm cluster, you can use the commands to stop the instances/containers and delete them by using the following commands.

docker-machine stop work2
docker-machine rm work2

docker-machine stop work1
docker-machine rm work1

docker-machine stop boss1
docker-machine rm boss1

Happy Dockering !

From our previous mention of using homebrew on mac. This time we will be going through how to add, delete, and clean software installed using macports.

1) https://macports.org

I have briefly mentioned the use of using homebrew for adding additional software packages to MacOS from highsierra to newer OS in our previous posting. After some thought, it would also be useful to jogged my memory on how to use macports when one is on a mac device after installing this package manager utility. I recommend using either one or even both software package manager. The Fink utility is a foreign to me, i have not used this at the moment but i am certain it will be as good as macports.

Install macports:
Download their binary executable from their website for your MacOS.

Once installed, one can fire up a native mac terminal or install Hyper or even iTerm v3.x.x console. When comes to running commands, it is your preference that you should choose and be comfortable with one to two terminal on mac before executing the following commands once you have macports installed.

# to update package listings
sudo port selfupdate

# to search for packages
sudo port search PACKAGEName

# to Install packages
sudo port install PACKAGEName

# to upgrade outdated packages
port upgrade outdated

# to check current inactive packages
sudo port installed inactive

# to clean current inactive packages
sudo port uninstall inactive

# to check current active packages
sudo port installed active

# to delete package
sudo port uninstall PACKAGEName

# to check dependencies software packages
sudo port echo leaves

# to clean out dependencies
sudo port uninstall leaves

# Start / Stop
sudo port load mariadb-10.1-server
sudo port unload mariadb-10.1-server

# secure install
sudo /opt/local/lib/mariadb-10.1/bin/mysql_secure_installation

# login
/opt/local/lib/mariadb-10.1/bin/mysql -u username -p

# Change Password
/opt/local/lib/mariadb-10.1/bin/mysqladmin -u root password ''