Commit 9a75c7fa by John Jarvis

add nginx for analytics-api

parent 25ccffd0
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
ENABLE_SPLUNKFORWARDER: False ENABLE_SPLUNKFORWARDER: False
ENABLE_NEWRELIC: False ENABLE_NEWRELIC: False
roles: roles:
- role: nginx
nginx_sites:
- analytics-api
- aws - aws
- analytics-api - analytics-api
- role: datadog - role: datadog
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
- xqueue - xqueue
- xserver - xserver
- certs - certs
- analytics-api
nginx_default_sites: nginx_default_sites:
- lms - lms
- edxlocal - edxlocal
......
...@@ -17,6 +17,7 @@ ANALYTICS_API_GIT_IDENTITY: !!null ...@@ -17,6 +17,7 @@ ANALYTICS_API_GIT_IDENTITY: !!null
# and a key being provided via NEWRELIC_LICENSE_KEY # and a key being provided via NEWRELIC_LICENSE_KEY
ANALYTICS_API_NEWRELIC_APPNAME: "your Newrelic appname" ANALYTICS_API_NEWRELIC_APPNAME: "your Newrelic appname"
ANALYTICS_API_PIP_EXTRA_ARGS: "-i {{ COMMON_PYPI_MIRROR_URL }}" ANALYTICS_API_PIP_EXTRA_ARGS: "-i {{ COMMON_PYPI_MIRROR_URL }}"
ANALYTICS_API_NGINX_PORT: "18080"
# #
# vars are namespace with the module name. # vars are namespace with the module name.
...@@ -32,7 +33,7 @@ analytics_api_venv_dir: "{{ analytics_api_venv_base }}/{{ analytics_api_service_ ...@@ -32,7 +33,7 @@ analytics_api_venv_dir: "{{ analytics_api_venv_base }}/{{ analytics_api_service_
analytics_api_venv_bin: "{{ analytics_api_venv_dir }}/bin" analytics_api_venv_bin: "{{ analytics_api_venv_dir }}/bin"
analytics_api_code_dir: "{{ analytics_api_app_dir }}/edx-analytics-data-api" analytics_api_code_dir: "{{ analytics_api_app_dir }}/edx-analytics-data-api"
analytics_api_conf_dir: "{{ analytics_api_home }}" analytics_api_conf_dir: "{{ analytics_api_home }}"
analytics_api_gunicorn_host: "0.0.0.0" analytics_api_gunicorn_host: "127.0.0.1"
analytics_api_gunicorn_port: "8080" analytics_api_gunicorn_port: "8080"
analytics_api_gunicorn_workers: "8" analytics_api_gunicorn_workers: "8"
analytics_api_gunicorn_timeout: "300" analytics_api_gunicorn_timeout: "300"
......
...@@ -51,6 +51,8 @@ nginx_lms_preview_gunicorn_hosts: ...@@ -51,6 +51,8 @@ nginx_lms_preview_gunicorn_hosts:
- 127.0.0.1 - 127.0.0.1
nginx_cms_gunicorn_hosts: nginx_cms_gunicorn_hosts:
- 127.0.0.1 - 127.0.0.1
nginx_analytics_api_gunicorn_hosts:
- 127.0.0.1
nginx_cfg: nginx_cfg:
# - link - turn on # - link - turn on
......
upstream analytics_api_app_server {
{% for host in nginx_analytics_api_gunicorn_hosts %}
server {{ host }}:{{ analytics_api_gunicorn_port }} fail_timeout=0;
{% endfor %}
}
server {
listen {{ ANALYTICS_API_NGINX_PORT }} default_server;
location / {
{% include "basic-auth.j2" %}
try_files $uri @proxy_to_app;
}
# No basic auth security on the heartbeat url, so that ELB can use it
location /analytics_api/status/{
try_files $uri @proxy_to_app;
}
{% include "robots.j2" %}
location @proxy_to_app {
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
proxy_set_header X-Forwarded-For $http_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://analytics_api_app_server;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment