You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2022/09/22 03:01:49 UTC

[airavata-mft] branch master updated: Add docker mode

This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git


The following commit(s) were added to refs/heads/master by this push:
     new 455c8f5  Add docker mode
455c8f5 is described below

commit 455c8f56c439699ff8ad708cdb346958e84c09a4
Author: PatrickPradier <pa...@gael.fr>
AuthorDate: Thu Aug 25 14:22:39 2022 +0200

    Add docker mode
---
 docker/Dockerfile         | 31 +++++++++++++++++++++++++++++++
 docker/Readme.md          | 37 +++++++++++++++++++++++++++++++++++++
 docker/docker-compose.yml | 17 +++++++++++++++++
 3 files changed, 85 insertions(+)

diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 0000000..9e22372
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,31 @@
+FROM maven:3.8.6-jdk-11
+
+RUN apt-get update -y
+RUN apt-get install git -y
+
+RUN mkdir airavata
+WORKDIR /airavata
+
+RUN git clone https://github.com/apache/airavata-custos.git
+RUN git clone https://github.com/apache/airavata-data-lake.git
+RUN git clone https://github.com/apache/airavata-mft.git
+
+WORKDIR /airavata/airavata-custos
+RUN git checkout develop
+RUN mvn install
+
+WORKDIR /airavata/airavata-mft/
+RUN ! mvn install --fail-at-end
+
+WORKDIR /airavata/airavata-data-lake/
+RUN ! mvn install --fail-at-end
+
+WORKDIR /airavata/airavata-mft/scripts
+RUN ["./build.sh"]
+
+RUN touch ../airavata-mft/MFT-Agent-0.01/logs/airavata.log
+RUN printf '#!/bin/bash\n_term() {\n./stop-consul.sh\n./stop-mft.sh\n}\ntrap _term SIGTERM\nif [[ "$1"  == consul ]];then\n  ./start-consul.sh linux\nfi\n./start-mft.sh\n./log.sh agent &\nchild=$!\nwait "$child"' > run.sh
+RUN chmod u+x run.sh
+
+ENTRYPOINT ["./run.sh"]
+CMD ["noconsul"]
diff --git a/docker/Readme.md b/docker/Readme.md
new file mode 100644
index 0000000..912dca7
--- /dev/null
+++ b/docker/Readme.md
@@ -0,0 +1,37 @@
+## Build and run airavata-mft as a docker container
+
+Build the docker image from the directory containing the Dockerfile:
+
+`docker build -t airavata/mft .`
+
+Run the docker image:
+
+`docker run --name mft -d airavata/mft consul`
+
+You can access the command line:
+
+`docker exec -it mft /bin/bash`
+
+You can print the agent logs:
+
+`docker logs -f mft`
+
+## Run multiple agent on the same machine
+
+A _docker-compose.yml_ file is available to run multiple mft agent. It will launch a consul server and _n_ mft agents.
+
+Start the stack:
+
+`docker-compose up -d --scale mft-agent=n`
+
+Get the logs:
+
+`docker-compose logs -f`
+
+Stop every containers:
+
+`docker-compose stop`
+
+Stop and remove every containers:
+
+`docker-compose down`
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
new file mode 100644
index 0000000..3e12e93
--- /dev/null
+++ b/docker/docker-compose.yml
@@ -0,0 +1,17 @@
+version: '3.8'
+
+services:
+
+  consul-server:
+    image: hashicorp/consul:latest
+    container_name: consul
+    restart: always
+    network_mode: 'host'
+    command: "agent -dev"
+
+  mft-agent:
+    image: airavata/mft
+    restart: always
+    network_mode: 'host'
+    depends_on:
+      - consul-server