Once you realize how addictive and rewarding Open Source Development is, you will end up spending days with it. So here I am working on my WikiToLearn:Ratings project for GSoC-2016.Only few days back it felt that it is good time to choose a proper database application for handling our data , which can be modeled into a graph.We stumbled upon OrientDB a distributed graph database. So here I am sharing my experiences while setting up OrientDB inside Docker.
Just imagine you went to a fine restaurant and you ordered a delicious pizza, as you were busy taming your taste buds you get served with this.
You are further given some red tomatoes and freshly prepared basil to make sauce and toppings on your own. I know you how do you feel not because I went to such restaurant , but because this is a common scenario that the programmers face.
When we are working in teams it becomes really essential to collaborate seamlessly. That requires that you have a uniform working environment as your fellow team mates. But unfortunately this is not the case. Ever! . There are always some differences in the developing environments that need to be bridged . Now that mostly involves installing dependencies, packages and what not. The situation similar to the pizzeria as we ourselves need to make sauce and toppings for our pizza!
But what if I tell you that there is something that can save you from all this ?
Here comes _DOCKER._According to the internet:
“Docker allows you to package an application with all of its dependencies into a standardized unit for software development.”
That means to run an application on any platform you just need to install docker, build the pack with the application and all it’s supporting components and then you are done. Now anyone using that application only needs docker installed to run that application. No more ugly setup , nothing just run docker and your application is up.
So recently I got a chance to use docker to fire up my OrientDB database. Therefore in the remaining post I will be explaining what it took to run OrientDB inside Docker! I am using Ubuntu 14.04(LTS)
-
Initially we need to download the Docker image of OrientDB .Think of this image as your full application along with all the necessary components to run it. So need to a need a set of instructions to download all the dependencies and install them. This instructions can be run in a batch process with the help of a Dockerfile. Just copy the contents of this file and save it on your disk with your favorite text editor, then run this command on the terminal to build the image from the Dockerfile:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersdocker build -f /path/to/a/Dockerfile -
Now once you have the image and the other dependencies you need to run this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersdocker run -d -p 2424:2424 -p 2480:2480 -v config:/orientdb/config -v database:/orientdb/databases -v backup:/orientdb/backup -e ORIENTDB_ROOT_PASSWORD=mypasswdhere orientdb:latest -
Your server is up now you can access the web interface by going on this address:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactershttp://localhost:2480/ -
If you want to run console you need to additionally issue this command:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersdocker run -it --net="host" orientdb:latest /orientdb/bin/console.sh This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersorientdb> connect remote:localhost root <Passwd> -
Now if you need to kill the container you can issue this command to see the running containers:
docker ps
. You can see the container name you wish to kill and use:docker kill <container name>
Congratulations! now you have a fully functional OrientDB server running inside a docker container.