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

Docker vn #553

Draft
wants to merge 15 commits into
base: staging
Choose a base branch
from
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
# Runs service on port 80.
# Healthchecks service up every 5m.

FROM python:3.7
FROM python:3.9
RUN apt update ; apt install -y rsync
RUN pip install pipenv uvicorn[standard]
ENV SEQREPO_ROOT_DIR=/usr/local/share/seqrepo/2021-01-29
ENV GENE_NORM_DB_URL=http://dynamodb:8001
ENV AWS_ACCESS_KEY_ID = 'DUMMYIDEXAMPLE'
ENV AWS_SECRET_ACCESS_KEY = 'DUMMYEXAMPLEKEY'
ENV AWS_DEFAULT_REGION = 'us-west-2'
Comment on lines +8 to +12
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should consider having these as ARGs.

Copy link
Author

Choose a reason for hiding this comment

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

These values are required during container runtime as well. It would be better to continue with ENV unless we are planning for build time customisation.

COPY . /app
WORKDIR /app
RUN if [ ! -f "Pipfile.lock" ] ; then pipenv lock ; else echo Pipfile.lock exists ; fi
Expand All @@ -13,4 +18,4 @@ EXPOSE 80
HEALTHCHECK --interval=5m --timeout=3s \
CMD curl -f http://localhost/variation || exit 1

CMD pipenv run uvicorn variation.main:app --port 80 --host 0.0.0.0
CMD cd src pipenv run uvicorn variation.main:app --log-level debug --port 80 --host 0.0.0.0
41 changes: 41 additions & 0 deletions README.md
rajatkapoordfci marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,44 @@ From the _root_ directory of the repository:
```shell
pytest tests/
```

## Docker Setup:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## Docker Setup:
## Docker Setup

This section deals with setting up Variation Normalizer's backend dependencies via Docker. You must have Docker installed for this section. See more [here](https://docs.docker.com/engine/install/).

To create a new Docker network, use the [docker network create](https://docs.docker.com/reference/cli/docker/network/create/) command. For example, `docker network create tulip-net`

## SeqRepo
Copy link
Member

Choose a reason for hiding this comment

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

This should be a subheading

Suggested change
## SeqRepo
### SeqRepo

Variation Normalizer depends on [Biocommons SeqRepo](https://github.com/biocommons/biocommons.seqrepo). It is recommended to have the image as a volume attached to SeqRepo since the size exceeds 10 GB and can take a while to download.
1. Pull the image from Docker Hub Repository:

```shell
docker pull biocommons/seqrepo

## UTA
Copy link
Member

Choose a reason for hiding this comment

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

This should be a subheading

Suggested change
## UTA
### UTA

The Postgres UTA instance is another dependancy required for Variation Normalizer. To setup Container for UTA postgres Db instance. Follow the following steps:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The Postgres UTA instance is another dependancy required for Variation Normalizer. To setup Container for UTA postgres Db instance. Follow the following steps:
[Biocommons UTA](https://github.com/biocommons/uta) is another dependency required for the Variation Normalizer.

a.) Pull the image from Docker Hub Repository by typing following command in terminal.
Set the uta_v env variable by typing command uta_v=<"name of the version>. For eg uta_v=uta_20210129b.
Command : docker pull biocommons/uta:$uta_v
b.) Once the image is downnloaded, Start the container with the command :
docker run
-d
-e POSTGRES_PASSWORD=some-password-that-you-make-up
-v /tmp:/tmp
-v uta_vol:/var/lib/postgresql/data
--name $uta_v
--net=<"name of the network> \
biocommons/uta:$uta_v
Comment on lines +218 to +229
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
a.) Pull the image from Docker Hub Repository by typing following command in terminal.
Set the uta_v env variable by typing command uta_v=<"name of the version>. For eg uta_v=uta_20210129b.
Command : docker pull biocommons/uta:$uta_v
b.) Once the image is downnloaded, Start the container with the command :
docker run
-d
-e POSTGRES_PASSWORD=some-password-that-you-make-up
-v /tmp:/tmp
-v uta_vol:/var/lib/postgresql/data
--name $uta_v
--net=<"name of the network> \
biocommons/uta:$uta_v
1. Pull the image from Docker Hub Repository:
```shell
docker pull biocommons/uta:$uta_v

Where uta_v is the name of the UTA version, for example uta_v=uta_20210129b

b.) Once the image is downloaded, run the following:

docker run  
-d  
-e POSTGRES_PASSWORD=some-password-that-you-make-up  
-v /tmp:/tmp  
-v uta_vol:/var/lib/postgresql/data  
--name $uta_v  
--net=<"name of the network> \  
biocommons/uta:$uta_v


### DynamoDB
AWS provides a docker image for the local instance. The DynamoDB local instance requires credentials (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`). You can provide dummy values for these if you do not have an AWS account.
1. Pull the image from Docker Hub repository and start the container:

```shell
docker run --net tulip-net -d --name dynamodb -p 8001:8001 amazon/dynamodb-local:1.18.0 -jar DynamoDBLocal.jar -port 8001

### Running the Dockerfile locally

1. Build the image from the docker file:

```shell
docker build -t variation-normalization .
Loading