Skip to content
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
24 changes: 22 additions & 2 deletions docker/prod/nodejs/nginx_staging.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
upstream django_app {
server django:8000 fail_timeout=0;
}

server {
server_name staging-evalai.cloudcv.org;
listen 80;
client_max_body_size 400M;
rewrite ^/(.*) https://staging-evalai.cloudcv.org/$1 permanent;

# Access Logs
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://django_app;
}
}

server {
listen 80;
sendfile on;
default_type application/octet-stream;

server_name evalai-staging.cloudcv.org;
Copy link
Member

Choose a reason for hiding this comment

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

Can we please be consistent everywhere? It looks like you are using staging-evalai somewhere and evalai-staging at other places.

client_max_body_size 200M;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
Expand All @@ -11,9 +33,7 @@ server {
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;

root /code/frontend;

location / {
try_files $uri $uri/ /index.html =404;
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/js/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"staging": {
"EnvironmentConfig": {
"API": "http://staging.evalai.cloudcv.org:8000/api/"
"API": "https://staging-evalai.cloudcv.org/api/"
}
},
"production": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployment/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ case $opt in
fi
echo "Pulling queue name for $env server challenge..."
if [ ${env} == "staging" ]; then
queue_name=$(curl -L -X GET -H "Authorization: Token $token" http://staging.evalai.cloudcv.org:8000/api/challenges/get_broker_url/$challenge/)
queue_name=$(curl -L -X GET -H "Authorization: Token $token" https://staging-evalai.cloudcv.org/api/challenges/get_broker_url/$challenge/)
elif [ ${env} == "production" ]; then
queue_name=$(curl -k -L -X GET -H "Authorization: Token $token" https://evalapi.cloudcv.org/api/challenges/get_broker_url/$challenge/)
fi
Expand All @@ -83,7 +83,7 @@ case $opt in
token=${3}
echo "Pulling queue names for $env server challenges..."
if [ ${env} == "staging" ]; then
queue_names=$(curl -L -X GET -H "Authorization: Token $token" http://staging.evalai.cloudcv.org:8000/api/challenges/get_broker_urls/)
queue_names=$(curl -L -X GET -H "Authorization: Token $token" https://staging-evalai.cloudcv.org/api/challenges/get_broker_urls/)
elif [ ${env} == "production" ]; then
queue_names=$(curl -k -L -X GET -H "Authorization: Token $token" https://evalapi.cloudcv.org/api/challenges/get_broker_urls/)
fi
Expand Down
9 changes: 4 additions & 5 deletions scripts/deployment/push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ export COMMIT_ID=$(git rev-parse HEAD)
build_and_push() {
aws configure set default.region us-east-1
eval $(aws ecr get-login --no-include-email)
if [ "${TRAVIS_BRANCH}" == "production" ]; then
echo "Pulling ssl certificates and nginx configuration..."
aws s3 cp s3://cloudcv-secrets/evalai/${TRAVIS_BRANCH}/ssl/ ./ssl/ --recursive
aws s3 cp s3://cloudcv-secrets/evalai/${TRAVIS_BRANCH}/nginx_${TRAVIS_BRANCH}.conf ./docker/prod/nodejs/nginx_${TRAVIS_BRANCH}.conf
fi
echo "Pulling ssl certificates and nginx configuration..."
aws s3 cp s3://cloudcv-secrets/evalai/${TRAVIS_BRANCH}/ssl/ ./ssl/ --recursive
aws s3 cp s3://cloudcv-secrets/evalai/${TRAVIS_BRANCH}/nginx_${TRAVIS_BRANCH}.conf ./docker/prod/nodejs/nginx_${TRAVIS_BRANCH}.conf
echo "Pulled ssl certificates and nginx configuration successfully"
docker-compose -f docker-compose-$1.yml build
docker-compose -f docker-compose-$1.yml push

Expand Down
4 changes: 2 additions & 2 deletions settings/staging.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from .prod import * # noqa: ignore=F405

ALLOWED_HOSTS = [
'staging.evalai.cloudcv.org',
'staging-evalai.cloudcv.org',
]

CORS_ORIGIN_ALLOW_ALL = False

CORS_ORIGIN_WHITELIST = (
'staging-evalai.s3.amazonaws.com',
'staging.evalai.cloudcv.org',
'staging-evalai.cloudcv.org',
)