Skip to content

Commit 45e9094

Browse files
RishabhJain2018sanketbansal
authored andcommitted
Setup: Fix docker configuration to set up evalai-ngx in dev environment(Cloud-CV#129)
1 parent cb894f4 commit 45e9094

File tree

7 files changed

+51
-103
lines changed

7 files changed

+51
-103
lines changed

README.md

+8-56
Original file line numberDiff line numberDiff line change
@@ -35,60 +35,28 @@ Our ultimate goal is to build a centralized platform to host, participate and co
3535

3636
Some background: Last year, the [Visual Question Answering Challenge (VQA) 2016](http://www.visualqa.org/vqa_v1_challenge.html) was hosted on some other platform, and on average evaluation would take **~10 minutes**. EvalAI hosted this year's [VQA Challenge 2017](https://evalai.cloudcv.org/featured-challenges/1/overview). This year, the dataset for the [VQA Challenge 2017](http://www.visualqa.org/challenge.html) is twice as large. Despite this, we’ve found that our parallelized backend only takes **~130 seconds** to evaluate on the whole test set VQA 2.0 dataset.
3737

38-
## Installation Instructions
38+
## Development setup
3939

40-
Setting up EvalAI-ngx on your local machine is really easy.
41-
Follow this guide to setup your development machine.
40+
Use [Docker Compose](https://docs.docker.com/compose/install/) to run all the components of EvalAI-ngx together. The steps are:
4241

43-
Get the source code on your machine via git
44-
```
45-
git clone [email protected]:Cloud-CV/EvalAI-ngx.git
46-
```
47-
If you have not added [ssh key](https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/) to your GitHub account then get the source code by running the following command
48-
```
49-
git clone https://github.com/Cloud-CV/EvalAI-ngx
50-
```
51-
52-
```
53-
npm install -g @angular/cli
54-
cd EvalAI-ngx/
55-
npm install
56-
```
57-
58-
## Development
59-
60-
### For Running on localhost:
61-
62-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
63-
64-
### Backend for localhost:
65-
66-
Setting up EvalAI on your local machine is really easy. You can setup EvalAI using docker:
67-
The steps are:
68-
69-
1. Install [docker](https://docs.docker.com/install/linux/docker-ce/ubuntu/) and [docker-compose](https://docs.docker.com/compose/install/) on your machine.
70-
71-
2. Get the source code on to your machine via git.
42+
1. Get the source code on to your machine via git.
7243

7344
```shell
74-
git clone https://github.com/Cloud-CV/EvalAI.git evalai && cd evalai
45+
git clone https://github.com/Cloud-CV/EvalAI-ngx.git && cd evalai-ngx
7546
```
7647

77-
3. Build and run the Docker containers. This might take a while.
48+
2. Build and run the Docker containers. This might take a while. You should be able to access EvalAI at `localhost:8888`.
7849

7950
```
80-
docker-compose up --build
51+
docker-compose up
8152
```
8253

83-
4. That's it. Open web browser and hit the url [http://127.0.0.1:8888](http://127.0.0.1:8888). Three users will be created by default which are listed below -
84-
54+
3. That's it. Open web browser and hit the url [http://127.0.0.1:8888](http://127.0.0.1:8888). Three users will be created by default which are listed below -
55+
8556
**SUPERUSER-** username: `admin` password: `password`
8657
**HOST USER-** username: `host` password: `password`
8758
**PARTICIPANT USER-** username: `participant` password: `password`
8859
89-
If you are facing any issue during installation, please see our [common errors during installation page](https://evalai.readthedocs.io/en/latest/faq(developers).html#common-errors-during-installation).
90-
91-
9260
### For deploying with [Surge](https://surge.sh/):
9361
9462
Surge will automatically generate deployment link whenever a pull request passes Travis CI.
@@ -131,22 +99,6 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
13199
132100
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
133101
134-
### Setup using Docker
135-
136-
You can also use Docker Compose to run all the components of EvalAI-ngx together. The steps are:
137-
138-
1. Get the source code on to your machine via git.
139-
140-
```shell
141-
git clone https://github.com/Cloud-CV/EvalAI-ngx.git && cd EvalAI-ngx
142-
```
143-
144-
2. Build and run the Docker containers. This might take a while. You should be able to access EvalAI at `localhost:8888`.
145-
146-
```
147-
docker-compose -f docker-compose.dev.yml up -d --build
148-
```
149-
150102
## The Team
151103
152104
EvalAI-ngx is currently maintained by [Shekhar Rajak](http://s-hacker.info/), [Mayank Lunayach](https://github.com/lunayach), [Shivani Prakash Gupta](https://www.behance.net/shivaniprakash19), [Rishabh Jain](https://rishabhjain2018.github.io/) and [Deshraj Yadav](https://deshraj.github.io).
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,42 @@
1-
version: "2"
1+
version: "3"
22
services:
33

44
db:
5-
image: postgres
5+
image: postgres:10.4
66
ports:
77
- "5432:5432"
88

9-
rabbitmq:
10-
image: rabbitmq
11-
hostname: rabbitmq
9+
sqs:
10+
image: pakohan/elasticmq
11+
hostname: sqs
1212
ports:
13-
- "5672:5672"
14-
- "15672:15672" # here, we can access rabbitmq management plugin
13+
- 9324:9324
1514

1615
django:
1716
container_name: ngx_django
1817
hostname: django
1918
env_file:
20-
- docker/dev.env
19+
- docker/dev/docker.env
2120
build:
2221
context: ./
2322
dockerfile: docker/dev/django/Dockerfile
2423
ports:
2524
- "8000:8000"
26-
command: ["./docker/wait-for-it.sh", "db:5432", "--", "sh", "/code/docker/dev/django/container-start.sh"]
2725
depends_on:
2826
- "db"
27+
- "sqs"
2928

30-
submission-worker:
29+
worker:
3130
env_file:
32-
- docker/dev.env
31+
- docker/dev/docker.env
3332
build:
3433
context: ./
35-
dockerfile: docker/dev/rabbitmq/Dockerfile
36-
command: ["./docker/wait-for-it.sh", "django:8000", "--", "python", "scripts/workers/submission_worker.py"]
34+
dockerfile: docker/dev/worker/Dockerfile
3735
depends_on:
3836
- "django"
3937

4038
angularjs:
41-
container_name: ngx_angularjs
39+
container_name: evalai_ngx
4240
hostname: angularjs
4341
build:
4442
context: ./
@@ -48,5 +46,8 @@ services:
4846
ports:
4947
- "8888:4200"
5048
- "4200:4200"
49+
depends_on:
50+
- "django"
5151
volumes:
52-
- .:/code
52+
- .:/code
53+
- /code/node_modules

docker/dev/angularjs/Dockerfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
FROM node:9.4.0
2-
MAINTAINER CloudCV Team
1+
FROM node:12.2.0
32

4-
RUN apt-get update -qq && apt-get install -y build-essential git curl libfontconfig
3+
RUN apt-get update
4+
RUN apt-get install -y build-essential git curl libfontconfig
55
RUN apt-get install nodejs-legacy -y
6-
RUN apt-get install npm -y
7-
RUN npm cache verify
8-
RUN npm install -g @angular/[email protected] --unsafe
6+
RUN npm install -g @angular/[email protected]
97

108
RUN mkdir /code
119

1210
# Copy codebase
1311
COPY . /code
1412

1513
WORKDIR /code
16-
1714
RUN npm install
15+
RUN npm audit fix
1816

1917
EXPOSE 8888
2018

docker/dev/django/Dockerfile

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1-
FROM python:2.7
2-
MAINTAINER CloudCV
3-
ENV PYTHONUNBUFFERED 1
1+
FROM python:3.6.5
42

5-
ENV DEBIAN_FRONTEND noninteractive
3+
ENV PYTHONUNBUFFERED 1
64

75
RUN apt-get update \
86
&& apt-get upgrade -y \
97
&& apt-get install -y
108

11-
RUN apt-get install -y apt-utils
12-
13-
RUN groupadd webapps
14-
RUN useradd evalai -G webapps
15-
RUN mkdir -p /var/log/evalai/ && chown -R evalai /var/log/evalai/ && chmod -R u+rX /var/log/evalai/
16-
RUN mkdir -p /var/run/evalai/ && chown -R evalai /var/run/evalai/ && chmod -R u+rX /var/run/evalai/
17-
189
RUN mkdir /code
1910

2011
RUN git clone https://github.com/Cloud-CV/EvalAI.git /code/
2112

2213
WORKDIR /code
2314

24-
RUN cp /code/settings/dev.sample.py /code/settings/dev.py
25-
2615
RUN pip install -r requirements/dev.txt
2716

28-
CMD ["sh", "/code/docker/dev/django/container-start.sh"]
17+
CMD ["./docker/wait-for-it.sh", "db:5432", "--", "sh", "/code/docker/dev/django/container-start.sh"]
2918

3019
EXPOSE 8000

docker/dev/django/container_start.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
cd /code && \
3+
python manage.py migrate --noinput && \
4+
python manage.py seed && \
5+
python manage.py runserver 0.0.0.0:8000

docker/dev.env renamed to docker/dev/docker.env

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
AWS_ACCESS_KEY_ID=x
2+
AWS_SECRET_ACCESS_KEY=x
3+
AWS_DEFAULT_REGION=us-east-1
4+
AWS_ACCOUNT_ID=x
5+
16
DEBUG=True
7+
DJANGO_SERVER=django
8+
DJANGO_SETTINGS_MODULE=settings.dev
29

310
POSTGRES_NAME=postgres
411
POSTGRES_USER=postgres
512
POSTGRES_PASSWORD=postgres
613
POSTGRES_HOST=db
714
POSTGRES_PORT=5432
8-
9-
DJANGO_SERVER=django
10-
11-
RABBITMQ_HOST=rabbitmq
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM python:2.7
2-
MAINTAINER CloudCV
1+
FROM python:3.6.5
2+
33
ENV PYTHONUNBUFFERED 1
44

55
RUN apt-get update && apt-get install -y python python-pip python-dev libpq-dev libjpeg-dev libyaml-dev libffi-dev
@@ -10,10 +10,10 @@ RUN git clone https://github.com/Cloud-CV/EvalAI.git /code/
1010

1111
WORKDIR /code
1212

13-
RUN cp settings/dev.sample.py settings/dev.py
14-
15-
RUN pip install -U cffi service_identity
16-
13+
RUN pip install -U cffi service_identity cython==0.29 numpy==1.14.5
1714
RUN pip install -r requirements/dev.txt
15+
RUN pip install -r requirements/worker.txt
16+
17+
ADD . /code
1818

19-
CMD ["python", "scripts/workers/submission_worker.py"]
19+
CMD ["python", "-m", "scripts.workers.submission_worker"]

0 commit comments

Comments
 (0)