Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Cloud-CV/EvalAI into test…
Browse files Browse the repository at this point in the history
…imonial-section
  • Loading branch information
gautamjajoo committed Jul 23, 2021
2 parents fb31b17 + 5353625 commit d0bb13c
Show file tree
Hide file tree
Showing 58 changed files with 1,334 additions and 462 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,3 @@ out/
monitoring/prometheus/prometheus_db/*
!monitoring/prometheus/prometheus_db/.gitkeep
monitoring/grafana/grafana_db/grafana.db
monitoring/prometheus/django/*
!monitoring/prometheus/django/.gitkeep
5 changes: 4 additions & 1 deletion apps/challenges/aws_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,10 @@ def restart_workers(queryset):
count = 0
failures = []
for challenge in queryset:
if challenge.is_docker_based:
if (
challenge.is_docker_based
and not challenge.is_static_dataset_code_upload
):
response = "Sorry. This feature is not available for code upload/docker based challenges."
failures.append(
{"message": response, "challenge_pk": challenge.pk}
Expand Down
1 change: 1 addition & 0 deletions apps/challenges/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class Meta:
"allowed_submission_file_types",
"default_submission_meta_attributes",
"allowed_email_ids",
"is_submission_public",
)


Expand Down
43 changes: 30 additions & 13 deletions apps/jobs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,18 +486,6 @@ def change_submission_data_and_visibility(
if serializer.is_valid():
serializer.save()
response_data = serializer.data
if (
request.FILES.get("submission_input_file")
and challenge.is_static_dataset_code_upload
):
message = {
"challenge_pk": challenge_pk,
"phase_pk": challenge_phase_pk,
"submission_pk": submission_pk,
"is_static_dataset_code_upload_submission": False,
}
# publish message in the queue
publish_submission_message(message)
return Response(response_data, status=status.HTTP_200_OK)
else:
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Expand Down Expand Up @@ -1260,9 +1248,38 @@ def update_submission(request, challenge_pk):

if request.method == "PATCH":
submission_pk = request.data.get("submission")
submission = get_submission_model(submission_pk)
# Update submission_input_file for is_static_dataset_code_upload submission evaluation
if (
request.FILES.get("submission_input_file")
and submission.challenge_phase.challenge.is_static_dataset_code_upload
):
serializer = SubmissionSerializer(
submission,
data=request.data,
context={
"request": request,
},
partial=True,
)
if serializer.is_valid():
serializer.save()
message = {
"challenge_pk": challenge_pk,
"phase_pk": submission.challenge_phase.pk,
"submission_pk": submission_pk,
"is_static_dataset_code_upload_submission": False,
}
# publish message in the queue
publish_submission_message(message)
response_data = serializer.data
return Response(response_data, status=status.HTTP_200_OK)
else:
return Response(
serializer.errors, status=status.HTTP_400_BAD_REQUEST
)
submission_status = request.data.get("submission_status", "").lower()
job_name = request.data.get("job_name", "").lower()
submission = get_submission_model(submission_pk)
jobs = submission.job_name
if job_name:
jobs.append(job_name)
Expand Down
60 changes: 59 additions & 1 deletion docker-compose-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ services:
NODE_ENV: staging
ports:
- '80:80'
- '443:443'
volumes:
- /code/node_modules
- /code/bower_components
Expand All @@ -69,6 +68,7 @@ services:
NODE_ENV: staging
ports:
- "9999:80"
- "443:443"
volumes:
- /code/node_modules
logging:
Expand All @@ -94,3 +94,61 @@ services:
build:
context: ./
dockerfile: docker/prod/code-upload-worker/Dockerfile

prometheus:
hostname: prometheus
image: prom/prometheus:latest
user: "1000"
volumes:
- ./monitoring/prometheus/prometheus_staging.yml:/etc/prometheus/prometheus.yml
- ./monitoring/prometheus/prometheus_db:/var/lib/prometheus
- ./monitoring/prometheus/prometheus_db:/prometheus
- ./monitoring/prometheus/prometheus_db:/etc/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--web.external-url=http://localhost:9090/prometheus'
ports:
- '9090:9090'

grafana:
hostname: grafana
image: grafana/grafana:latest
user: "1000"
env_file:
- docker/prod/docker_staging.env
volumes:
- ./monitoring/grafana/grafana_db:/var/lib/grafana
depends_on:
- prometheus
ports:
- '3000:3000'

statsd-exporter:
hostname: statsd
image: prom/statsd-exporter:latest
command:
- '--log.level=info'
- '--web.telemetry-path=/statsd/metrics'
ports:
- '9125:9125'
- '9102:9102'

node_exporter:
hostname: node_exporter
image: prom/node-exporter
ports:
- '9100:9100'

nginx-ingress:
image: ${AWS_ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/evalai-staging-nginx-ingress:${COMMIT_ID}
build:
context: ./
dockerfile: docker/prod/nginx-ingress/Dockerfile
args:
MONITORING_ENV: staging
depends_on:
- prometheus
- grafana
ports:
- '80:80'
- '443:443'
18 changes: 17 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ services:
depends_on:
- db
- sqs
- statsd-exporter
volumes:
- .:/code

Expand Down Expand Up @@ -75,7 +76,6 @@ services:
- ./monitoring/prometheus/prometheus_db:/etc/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
restart: unless-stopped
ports:
- '9090:9090'

Expand All @@ -90,3 +90,19 @@ services:
- prometheus
ports:
- '3000:3000'

statsd-exporter:
hostname: statsd
image: prom/statsd-exporter:latest
command:
- '--log.level=info'
- '--web.telemetry-path=/statsd/metrics'
ports:
- '9125:9125'
- '9102:9102'

node_exporter:
hostname: node_exporter
image: prom/node-exporter
ports:
- '9100:9100'
1 change: 0 additions & 1 deletion docker/dev/django/uwsgi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ vaccum = true
python-autoreload = 1
buffer-size=32768
chmod-socket = 777
lazy-apps = true
3 changes: 2 additions & 1 deletion docker/dev/docker.env
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ SERVICE_DNS=localhost
GF_SECURITY_ADMIN_USER=admin
GF_SECURITY_ADMIN_PASSWORD=password

prometheus_multiproc_dir=/code/monitoring/prometheus/django
STATSD_ENDPOINT=statsd
STATSD_PORT=9125
8 changes: 8 additions & 0 deletions docker/prod/docker_staging.env
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ EKS_NODEGROUP_ROLE_ARN=x
SLACK_WEB_HOOK_URL=x
ENVIRONMENT=staging
SERVICE_DNS=x

GF_SECURITY_ADMIN_USER=x
GF_SECURITY_ADMIN_PASSWORD=x
GF_SERVER_ROOT_URL=http://localhost:3000/grafana
GF_SERVER_SERVE_FROM_SUB_PATH=true

STATSD_ENDPOINT=statsd
STATSD_PORT=9125
4 changes: 4 additions & 0 deletions docker/prod/nginx-ingress/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM nginx:1.13-alpine
ARG MONITORING_ENV
COPY docker/prod/nginx-ingress/nginx_${MONITORING_ENV}.conf /etc/nginx/conf.d/default.conf
COPY /ssl /etc/ssl
47 changes: 47 additions & 0 deletions docker/prod/nginx-ingress/nginx_staging.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
upstream prometheus {
server prometheus:9090 fail_timeout=0;
}

upstream grafana {
server grafana:3000 fail_timeout=0;
}

server {
server_name monitoring-staging.eval.ai;
listen 80;
return 301 https://monitoring-staging.eval.ai$request_uri;
}

server {
server_name monitoring-staging.eval.ai;
listen 443 ssl;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

ssl on;
ssl_certificate /etc/ssl/eval_ai.crt;
ssl_certificate_key /etc/ssl/eval_ai.key;
ssl_prefer_server_ciphers on;
# enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

location /prometheus {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://prometheus;
}

location /grafana {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://grafana;
}

}
22 changes: 22 additions & 0 deletions docker/prod/nodejs/nginx_staging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ upstream django_app {
server django:8000 fail_timeout=0;
}

upstream statsd_exporter {
server statsd:9102 fail_timeout=0;
}

upstream node_exporter {
server node_exporter:9100 fail_timeout=0;
}

server {
server_name staging-evalai.cloudcv.org evalai-staging.cloudcv.org;
listen 80;
Expand Down Expand Up @@ -53,6 +61,20 @@ server {
proxy_pass http://django_app;
}

location /statsd {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://statsd_exporter;
}

location /node_exporter {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://node_exporter/metrics;
}

ssl on;
ssl_certificate /etc/ssl/eval_ai.crt;
ssl_certificate_key /etc/ssl/eval_ai.key;
Expand Down
40 changes: 36 additions & 4 deletions docker/prod/nodejs_v2/nginx_staging.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,44 @@ upstream django_app {
server django:8000 fail_timeout=0;
}

upstream statsd_exporter {
server statsd:9102 fail_timeout=0;
}

upstream node_exporter {
server node_exporter:9100 fail_timeout=0;
}

server {
server_name beta-staging.eval.ai;
server_name staging.eval.ai;
listen 80;
return 301 https://beta-staging.eval.ai$request_uri;
return 301 https://staging.eval.ai$request_uri;
}

server {
server_name beta-staging.eval.ai;
server_name staging.eval.ai;
listen 443 ssl;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}

client_max_body_size 200M;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;

ssl on;
ssl_certificate /etc/ssl/eval_ai.crt;
ssl_certificate_key /etc/ssl/eval_ai.key;
ssl_prefer_server_ciphers on;
#enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
# enables all versions of TLS, but not SSLv2 or 3 which are weak and now deprecated.
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

access_log /var/log/nginx/access.log;
Expand All @@ -33,4 +51,18 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://django_app;
}

location /statsd {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://statsd_exporter;
}

location /node_exporter {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://node_exporter/metrics;
}
}
9 changes: 9 additions & 0 deletions docs/source/faq(developers).md
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,12 @@ rm -rf bower_components
npm install
bower install
```

#### Q. While trying to build EvalAI from the master branch and run the command docker-compose up:

```
ERROR: Service 'celery' failed to build: pull access denied for evalai_django, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
```

Please make sure to clone EvalAI in its default directory with name evalai. This happens because the parent directory changes the name of docker images.
For instance, the image evalai_django gets renamed to evalai_dev_django if your directory is renamed to EvalAI_dev.
Loading

0 comments on commit d0bb13c

Please sign in to comment.