diff --git a/docker/prod/nodejs/nginx_staging.conf b/docker/prod/nodejs/nginx_staging.conf index 5b72f5fcf2..0cc4e309f4 100644 --- a/docker/prod/nodejs/nginx_staging.conf +++ b/docker/prod/nodejs/nginx_staging.conf @@ -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; + client_max_body_size 200M; gzip on; gzip_http_version 1.1; gzip_disable "MSIE [1-6]\."; @@ -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; } diff --git a/frontend/src/js/config.json b/frontend/src/js/config.json index 38838db631..5c57891c7f 100644 --- a/frontend/src/js/config.json +++ b/frontend/src/js/config.json @@ -6,7 +6,7 @@ }, "staging": { "EnvironmentConfig": { - "API": "http://staging.evalai.cloudcv.org:8000/api/" + "API": "https://staging-evalai.cloudcv.org/api/" } }, "production": { diff --git a/scripts/deployment/deploy.sh b/scripts/deployment/deploy.sh index 1cfd03c8e7..89366c666a 100755 --- a/scripts/deployment/deploy.sh +++ b/scripts/deployment/deploy.sh @@ -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 @@ -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 diff --git a/scripts/deployment/push.sh b/scripts/deployment/push.sh index 19e6200608..296efb1e64 100755 --- a/scripts/deployment/push.sh +++ b/scripts/deployment/push.sh @@ -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 diff --git a/settings/staging.py b/settings/staging.py index 72dbf9588c..2645d9f460 100644 --- a/settings/staging.py +++ b/settings/staging.py @@ -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', )