-
Notifications
You must be signed in to change notification settings - Fork 5
phyloDB docker Image
After doing Step 2, follow this Step 3. Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow packaging up an application with all the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, the application will run on any other Linux machine containing docker, regardless of any customised settings that machine might have that could differ from the machine used for writing and testing the code. You can follow the instructions or from 1, or from 2.
-
Start docker desktop.
-
Build phylodb docker image. We must create our docker application image, to run the respective application container. To do so, we need to navigate to the phylodb project folder, open terminal and run the command
docker build -t phylodb .
. This command will search for a Dockerfile in the current directory, build the respective image and tag it as 'phylodb:latest'. Note: check if the Dockerfile in 'phylodb\Dockerfile' has a java version consistent with previous steps.

- Check your docker engine resources. For this example, the resources can be:

-
Run docker-compose file. Now we run our containers with the database and application. To do so, we need to navigate to the first solution folder (
phyloDB-master
) and run the commandUSER=$(id -u):$(id -g) DB_PATH=$HOME/instance1/db APP_PATH=$HOME/instance1/app docker-compose up -d
. This will start two containers, one with the phylodb application and the other with the Neo4j database. TheUSER=$(id -u):$(id -g)
means that the container user will have the same permissions as the current user. TheDB_PATH=$HOME/instance1/db
andAPP_PATH=$HOME/instance1/app
are the directories that we created before and will now be used to bind mount. We also need to make sure that the database connection at application properties of phylodb project contains the name of the database service used in docker-compose file. At this moment we have our solution up and running.

You can also check that, for instance, the database is running on port 7474
. If using localhost, it can be ckecked in
http://localhost:7474/browser/
-
Initiate database. After the database is started we need to load the schema with an admin user. These scripts are in the solution folder in '/scripts/init'. Now we need to run the command
docker exec -it {CONTAINER ID} bash
, where the 'CONTAINER ID' is the id of the database container, and start the Neo4j cypher shell by runningcypher-shell -u neo4j -p password
. Once this is executed, we can now run the initiation scripts to the database. In the previous image, 'CONTAINER ID' is phylodb-master_db_1.
-
Build phylodb docker image. We must create our docker application image, to run the respective application container. To do so, we need to navigate to the phylodb project folder, open terminal and run the command
docker build -t phylodb .
. This command will search for a dockerfile in the current directory, build the respective image and tag it as 'phylodb:latest' -
Run docker-compose file. Now we run our containers with the database and application. To do so, we need to navigate to the first solution folder (
phyloDB-master
) and run the commandUSER=$(id -u):$(id -g) DB_PATH=$HOME/instance1/db APP_PATH=$HOME/instance1/app docker-compose up -d
. This will start two containers, one with the phylodb application and the other with the Neo4j database. TheUSER=$(id -u):$(id -g)
means that the container user will have the same permissions as the current user. TheDB_PATH=$HOME/instance1/db
andAPP_PATH=$HOME/instance1/app
are the directories that we created before and will now be used to bind mount. We also need to make sure that the database connection at application properties of phylodb project contains the name of the database service used in docker-compose file. At this moment we have our solution up and running.
You can also check that, for instance, the database is running on port 7474
. If using localhost, it can be ckecked in
http://localhost:7474/browser/
-
Initiate database. After the database is started we need to load the schema with an admin user. These scripts are in the solution folder in '/scripts/init'. Now we need to run the command
docker exec -it {CONTAINER ID} bash
, where the 'CONTAINER ID' is the id of the database container, and start the Neo4j cypher shell by runningcypher-shell -u neo4j -p password
. Once this is executed, we can now run the initiation scripts to the database. In the previous image, 'CONTAINER ID' isphylodb-master_db_1
.
You can then continue to last step, namely Step 4.