Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker mode #49

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Copy link
Author

@PatrickPradier PatrickPradier Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is a bit ugly, I could replace it by adding a run.sh script in the repository.

RUN chmod u+x run.sh

ENTRYPOINT ["./run.sh"]
CMD ["noconsul"]
37 changes: 37 additions & 0 deletions docker/Readme.md
Original file line number Diff line number Diff line change
@@ -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`
17 changes: 17 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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