Unverified Commit 6047c0b2 by George Babey Committed by GitHub

Merge pull request #4443 from edx/gbabey/analytics-api-edx-django-service

Move analytics-api to edx_django_service role
parents 5834df9b c1b45eb8
......@@ -9,7 +9,7 @@
roles:
- aws
- role: nginx
nginx_sites:
nginx_default_sites:
- analytics_api
- analytics_api
- role: datadog
......
......@@ -13,7 +13,6 @@
- lms
- xqueue
- xserver
- analytics_api
nginx_default_sites:
- lms
- mysql
......
......@@ -13,11 +13,48 @@
ANALYTICS_API_GIT_IDENTITY: !!null
# depends upon Newrelic being enabled via COMMON_ENABLE_NEWRELIC
# and a key being provided via NEWRELIC_LICENSE_KEY
ANALYTICS_API_NEWRELIC_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-analytics-api"
ANALYTICS_API_PIP_EXTRA_ARGS: "-i {{ COMMON_PYPI_MIRROR_URL }}"
ANALYTICS_API_NGINX_PORT: "18100"
#
# vars are namespace with the module name
#
analytics_api_service_name: "analytics_api"
analytics_api_gunicorn_port: "8100"
ANALYTICS_API_DJANGO_SETTINGS_MODULE: "analyticsdataserver.settings.production"
analytics_api_environment:
ANALYTICS_API_CFG: "{{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yml"
DJANGO_SETTINGS_MODULE: "{{ ANALYTICS_API_DJANGO_SETTINGS_MODULE }}"
analytics_api_home: "{{ COMMON_APP_DIR }}/{{ analytics_api_service_name }}"
analytics_api_user: "{{ analytics_api_service_name }}"
analytics_api_code_dir: "{{ analytics_api_home }}/{{ analytics_api_service_name }}"
analytics_api_wsgi_name: "analyticsdataserver"
analytics_api_hostname: "analytics-api"
#
# OS packages
#
analytics_api_debian_pkgs:
- 'libmysqlclient-dev'
ANALYTICS_API_VERSION: "master"
ANALYTICS_API_NGINX_PORT: '1{{ analytics_api_gunicorn_port }}'
ANALYTICS_API_SSL_NGINX_PORT: '4{{ analytics_api_gunicorn_port }}'
ANALYTICS_API_REPOS:
- PROTOCOL: "{{ COMMON_GIT_PROTOCOL }}"
DOMAIN: "{{ COMMON_GIT_MIRROR }}"
PATH: "{{ COMMON_GIT_PATH }}"
REPO: edx-analytics-data-api.git
VERSION: "{{ ANALYTICS_API_VERSION }}"
DESTINATION: "{{ analytics_api_code_dir }}"
SSH_KEY: "{{ ANALYTICS_API_GIT_IDENTITY }}"
ANALYTICS_API_SECRET_KEY: 'Your secret key here'
ANALYTICS_API_AUTH_TOKEN: 'put-your-api-token-here'
ANALYTICS_API_DEFAULT_DB_NAME: 'analytics-api'
ANALYTICS_API_DEFAULT_USER: 'api001'
......@@ -57,17 +94,6 @@ ANALYTICS_API_DATABASES:
PORT: '{{ ANALYTICS_API_REPORTS_PORT }}'
OPTIONS: "{{ ANALYTICS_API_REPORTS_MYSQL_OPTIONS }}"
ANALYTICS_API_VERSION: "master"
# Default dummy user, override this!!
ANALYTICS_API_USERS:
"dummy-api-user": "changeme"
ANALYTICS_API_SECRET_KEY: 'Your secret key here'
ANALYTICS_API_TIME_ZONE: 'UTC'
ANALYTICS_API_LANGUAGE_CODE: 'en-us'
ANALYTICS_API_AUTH_TOKEN: 'put-your-api-token-here'
ANALYTICS_API_ELASTICSEARCH_LEARNERS_HOST: 'localhost'
ANALYTICS_API_ELASTICSEARCH_LEARNERS_INDEX: 'roster_1_2'
ANALYTICS_API_ELASTICSEARCH_LEARNERS_UPDATE_INDEX: 'index_updates'
......@@ -81,11 +107,6 @@ ANALYTICS_API_DEFAULT_PAGE_SIZE: 25
ANALYTICS_API_MAX_PAGE_SIZE: 100
ANALYTICS_API_AGGREGATE_PAGE_SIZE: 10
ANALYTICS_API_BASE_URL: 'http://localhost:8100'
ANALYTICS_API_DATA_DIR: '{{ COMMON_DATA_DIR }}/{{ analytics_api_service_name }}'
ANALYTICS_API_MEDIA_ROOT: '{{ ANALYTICS_API_DATA_DIR }}/static/reports'
ANALYTICS_API_MEDIA_URL: '/static/reports/'
# Example settings to use Amazon S3 as a storage backend for course reports.
#
# This storage mechanism also provides support for pre-authenticated URLs with an expiry time,
......@@ -103,21 +124,27 @@ ANALYTICS_API_MEDIA_URL: '/static/reports/'
#
# Other storage providers can be used, as long as they provide the .url() method.
ANALYTICS_API_BASE_URL: 'http://localhost:8100'
ANALYTICS_API_DATA_DIR: '{{ COMMON_DATA_DIR }}/{{ analytics_api_service_name }}'
ANALYTICS_API_MEDIA_ROOT: '{{ ANALYTICS_API_DATA_DIR }}/static/reports'
ANALYTICS_API_MEDIA_URL: '/static/reports/'
ANALYTICS_API_REPORT_DOWNLOAD_BACKEND:
DEFAULT_FILE_STORAGE: 'django.core.files.storage.FileSystemStorage'
MEDIA_ROOT: '{{ ANALYTICS_API_MEDIA_ROOT }}'
MEDIA_URL: '{{ ANALYTICS_API_BASE_URL }}{{ ANALYTICS_API_MEDIA_URL }}'
COURSE_REPORT_FILE_LOCATION_TEMPLATE: '{course_id}_{report_name}.csv'
ANALYTICS_API_SERVICE_CONFIG:
ANALYTICS_DATABASE: 'reports'
SECRET_KEY: '{{ ANALYTICS_API_SECRET_KEY }}'
TIME_ZONE: '{{ ANALYTICS_API_TIME_ZONE }}'
LANGUAGE_CODE: '{{ANALYTICS_API_LANGUAGE_CODE }}'
ANALYTICS_API_CSRF_COOKIE_SECURE: false
analytics_api_service_config_overrides:
API_AUTH_TOKEN: '{{ ANALYTICS_API_AUTH_TOKEN }}'
STATICFILES_DIRS: ['static']
STATIC_ROOT: "{{ COMMON_DATA_DIR }}/{{ analytics_api_service_name }}/staticfiles"
LMS_BASE_URL: "{{ ANALYTICS_API_LMS_BASE_URL | default('http://127.0.0.1:8000') }}"
# db config
ANALYTICS_DATABASE: ANALYTICS_API_REPORTS_DB_NAME
DATABASES: '{{ ANALYTICS_API_DATABASES }}'
ELASTICSEARCH_LEARNERS_HOST: '{{ ANALYTICS_API_ELASTICSEARCH_LEARNERS_HOST }}'
ELASTICSEARCH_LEARNERS_INDEX: '{{ ANALYTICS_API_ELASTICSEARCH_LEARNERS_INDEX }}'
......@@ -134,55 +161,6 @@ ANALYTICS_API_SERVICE_CONFIG:
REPORT_DOWNLOAD_BACKEND: '{{ ANALYTICS_API_REPORT_DOWNLOAD_BACKEND }}'
CSRF_COOKIE_SECURE: "{{ ANALYTICS_API_CSRF_COOKIE_SECURE }}"
ANALYTICS_API_REPOS:
- PROTOCOL: "{{ COMMON_GIT_PROTOCOL }}"
DOMAIN: "{{ COMMON_GIT_MIRROR }}"
PATH: "{{ COMMON_GIT_PATH }}"
REPO: edx-analytics-data-api.git
VERSION: "{{ ANALYTICS_API_VERSION }}"
DESTINATION: "{{ analytics_api_code_dir }}"
SSH_KEY: "{{ ANALYTICS_API_GIT_IDENTITY }}"
ANALYTICS_API_GUNICORN_WORKERS: "2"
ANALYTICS_API_GUNICORN_EXTRA: ""
ANALYTICS_API_GUNICORN_EXTRA_CONF: ""
ANALYTICS_API_CSRF_COOKIE_SECURE: false
#
# vars are namespace with the module name.
#
analytics_api_environment:
DJANGO_SETTINGS_MODULE: "analyticsdataserver.settings.production"
ANALYTICS_API_CFG: "{{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yml"
analytics_api_service_name: "analytics_api"
analytics_api_user: "{{ analytics_api_service_name }}"
analytics_api_home: "{{ COMMON_APP_DIR }}/{{ analytics_api_service_name }}"
analytics_api_code_dir: "{{ analytics_api_home }}/{{ analytics_api_service_name }}"
analytics_api_conf_dir: "{{ analytics_api_home }}"
analytics_api_venv_dir: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}"
analytics_api_venv_bin: "{{ analytics_api_venv_dir }}/bin"
analytics_api_gunicorn_host: "127.0.0.1"
analytics_api_gunicorn_port: "8100"
analytics_api_gunicorn_timeout: "300"
analytics_api_django_settings: "production"
analytics_api_log_dir: "{{ COMMON_LOG_DIR }}/{{ analytics_api_service_name }}"
analytics_api_requirements_base: "{{ analytics_api_code_dir }}/requirements"
analytics_api_requirements:
- base.txt
- production.txt
- optional.txt
#
# OS packages
#
analytics_api_debian_pkgs:
- 'libmysqlclient-dev'
analytics_api_redhat_pkgs: []
# Default dummy user, override this!!
ANALYTICS_API_USERS:
"dummy-api-user": "changeme"
......@@ -20,14 +20,24 @@
# }
dependencies:
- common
- supervisor
- role: edx_service
edx_service_name: "{{ analytics_api_service_name }}"
edx_service_config: "{{ ANALYTICS_API_SERVICE_CONFIG }}"
edx_service_repos: "{{ ANALYTICS_API_REPOS }}"
edx_service_user: "{{ analytics_api_user }}"
edx_service_home: "{{ analytics_api_home }}"
edx_service_packages:
debian: "{{ analytics_api_debian_pkgs }}"
redhat: "{{ analytics_api_redhat_pkgs }}"
- role: edx_django_service
edx_django_service_repos: '{{ ANALYTICS_API_REPOS }}'
edx_django_service_name: '{{ analytics_api_service_name }}'
edx_django_service_user: '{{ analytics_api_user }}'
edx_django_service_home: '{{ COMMON_APP_DIR }}/{{ analytics_api_service_name }}'
edx_django_service_config_overrides: '{{ analytics_api_service_config_overrides }}'
edx_django_service_nginx_port: '{{ ANALYTICS_API_NGINX_PORT }}'
edx_django_service_ssl_nginx_port: '{{ ANALYTICS_API_SSL_NGINX_PORT }}'
edx_django_service_default_db_host: '{{ ANALYTICS_API_DEFAULT_HOST }}'
edx_django_service_default_db_name: '{{ ANALYTICS_API_DEFAULT_DB_NAME }}'
edx_django_service_default_db_atomic_requests: false
edx_django_service_db_user: '{{ ANALYTICS_API_DEFAULT_USER }}'
edx_django_service_db_password: '{{ ANALYTICS_API_DEFAULT_PASSWORD }}'
edx_django_service_debian_pkgs_extra: '{{ analytics_api_debian_pkgs }}'
edx_django_service_gunicorn_port: '{{ analytics_api_gunicorn_port }}'
edx_django_service_django_settings_module: '{{ ANALYTICS_API_DJANGO_SETTINGS_MODULE }}'
edx_django_service_environment_extra: '{{ analytics_api_environment }}'
edx_django_service_secret_key: '{{ ANALYTICS_API_SECRET_KEY }}'
edx_django_service_use_python3: false
edx_django_service_wsgi_name: '{{ analytics_api_wsgi_name }}'
edx_django_service_hostname: '~^((stage|prod)-)?{{ analytics_api_hostname }}.*'
......@@ -9,81 +9,11 @@
#
# Tasks for role analytics_api
#
# Overview:
# Overview: Most of this role's tasks come from edx_django_service.
#
# Install the Analytics Data API server, a python
# django application that runs under gunicorn
#
# Dependencies:
#
# Example play:
# - name: Deploy Analytics API
# hosts: all
# become: True
# gather_facts: True
# vars:
# ENABLE_DATADOG: False
# ENABLE_SPLUNKFORWARDER: False
# ENABLE_NEWRELIC: False
# roles:
# - aws
# - analytics_api
#
# ansible-playbook -i 'api.example.com,' ./analyticsapi.yml -e@/ansible/vars/deployment.yml -e@/ansible/vars/env-deployment.yml
#
- name: setup the analytics_api env file
template:
src: "edx/app/analytics_api/analytics_api_env.j2"
dest: "{{ analytics_api_home }}/analytics_api_env"
owner: "{{ analytics_api_user }}"
group: "{{ analytics_api_user }}"
mode: 0644
tags:
- install
- install:configuration
- name: "add gunicorn configuration file"
template:
src: edx/app/analytics_api/analytics_api_gunicorn.py.j2
dest: "{{ analytics_api_home }}/analytics_api_gunicorn.py"
become_user: "{{ analytics_api_user }}"
tags:
- install
- install:configuration
- name: install application requirements
pip:
requirements: "{{ analytics_api_requirements_base }}/{{ item }}"
virtualenv: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}"
state: present
become_user: "{{ analytics_api_user }}"
with_items: "{{ analytics_api_requirements }}"
tags:
- install
- install:app-requirements
- name: migrate
shell: "DB_MIGRATION_USER='{{ COMMON_MYSQL_MIGRATE_USER }}' DB_MIGRATION_PASS='{{ COMMON_MYSQL_MIGRATE_PASS }}' {{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}/bin/python ./manage.py migrate --noinput"
args:
chdir: "{{ analytics_api_code_dir }}"
become_user: "{{ analytics_api_user }}"
environment: "{{ analytics_api_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
run_once: yes
tags:
- migrate
- migrate:db
- name: run collectstatic
shell: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}/bin/python manage.py collectstatic --noinput"
args:
chdir: "{{ analytics_api_code_dir }}"
become_user: "{{ analytics_api_user }}"
environment: "{{ analytics_api_environment }}"
tags:
- assets
- assets:gather
- name: create api users
shell: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}/bin/python manage.py set_api_key {{ item.key }} {{ item.value }}"
......@@ -95,78 +25,3 @@
tags:
- manage
- manage:app-users
- name: write out the supervisor wrapper
template:
src: edx/app/analytics_api/analytics_api.sh.j2
dest: "{{ analytics_api_home }}/{{ analytics_api_service_name }}.sh"
mode: 0650
owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}"
tags:
- install
- install:configuration
- name: write supervisord config
template:
src: edx/app/supervisor/conf.d.available/analytics_api.conf.j2
dest: "{{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf"
owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}"
mode: 0644
tags:
- install
- install:configuration
- name: enable supervisor script
file:
src: "{{ supervisor_available_dir }}/{{ analytics_api_service_name }}.conf"
dest: "{{ supervisor_cfg_dir }}/{{ analytics_api_service_name }}.conf"
state: link
force: yes
when: not disable_edx_services
tags:
- install
- install:configuration
- name: update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
when: not disable_edx_services
tags:
- manage
- manage:start
- name: create symlinks from the venv bin dir
file:
src: "{{ analytics_api_home }}/venvs/{{ analytics_api_service_name }}/bin/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics_api"
state: link
with_items:
- python
- pip
- django-admin.py
tags:
- install
- install:base
- name: create symlinks from the repo dir
file:
src: "{{ analytics_api_code_dir }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.analytics_api"
state: link
with_items:
- manage.py
tags:
- install
- install:base
- name: restart analytics_api
supervisorctl:
state: restarted
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
name: "{{ analytics_api_service_name }}"
when: not disable_edx_services
become_user: "{{ supervisor_service_user }}"
tags:
- manage:start
#!/usr/bin/env bash
# {{ ansible_managed }}
{% set analytics_api_venv_bin = analytics_api_home + "/venvs/" + analytics_api_service_name + "/bin/" %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = analytics_api_venv_bin + '/newrelic-admin run-program ' + analytics_api_venv_bin + '/gunicorn' %}
{% else %}
{% set executable = analytics_api_venv_bin + '/gunicorn' %}
{% endif %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
export NEW_RELIC_APP_NAME="{{ ANALYTICS_API_NEWRELIC_APPNAME }}"
export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% endif -%}
source {{ analytics_api_home }}/analytics_api_env
{{ executable }} -c {{ analytics_api_home }}/analytics_api_gunicorn.py {{ ANALYTICS_API_GUNICORN_EXTRA }} analyticsdataserver.wsgi:application
# {{ ansible_managed }}
{% for name,value in analytics_api_environment.items() -%}
{%- if value -%}
export {{ name }}="{{ value }}"
{% endif %}
{%- endfor %}
source {{ analytics_api_venv_bin }}/activate
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
timeout = {{ analytics_api_gunicorn_timeout }}
bind = "{{ analytics_api_gunicorn_host }}:{{ analytics_api_gunicorn_port }}"
pythonpath = "{{ analytics_api_code_dir }}"
workers = {{ ANALYTICS_API_GUNICORN_WORKERS }}
{{ common_close_all_caches }}
def post_fork(server, worker):
close_all_caches()
{{ ANALYTICS_API_GUNICORN_EXTRA_CONF }}
# {{ ansible_managed }}
[program:{{ analytics_api_service_name }}]
command={{ analytics_api_home }}/{{ analytics_api_service_name }}.sh
user={{ common_web_user }}
directory={{ analytics_api_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
......@@ -17,7 +17,7 @@ IFS=","
read-only-certificate-code, edx-analytics-data-api, edx-ora2, insights, ecommerce, course_discovery,
notifier, video_web_frontend, video_delivery_worker, veda_pipeline_worker, video_encode_worker, veda_ffmpeg
<version> - can be a commit or tag
<extra_vars> - specify extra_vars to any of the ansible plays with the -e switch and then ecaptulating your vars in "duoble quotes"
<extra_vars> - specify extra_vars to any of the ansible plays with the -e switch and then ecaptulating your vars in "double quotes"
example: update <repo> <version> -e "-e 'hallo=bye' -e 'bye=hallo'"
you can also specify a file as -e "-e '@/path/to/file.yml'"
......@@ -65,7 +65,7 @@ repos_to_cmd["cs_comments_service"]="$edx_ansible_cmd forum.yml -e 'forum_versio
repos_to_cmd["xserver"]="$edx_ansible_cmd xserver.yml -e 'xserver_version=$2'"
repos_to_cmd["configuration"]="$edx_ansible_cmd edx_ansible.yml -e 'configuration_version=$2'"
repos_to_cmd["read-only-certificate-code"]="$edx_ansible_cmd certs.yml -e 'certs_version=$2'"
repos_to_cmd["edx-analytics-data-api"]="$edx_ansible_cmd analyticsapi.yml -e 'ANALYTICS_API_VERSION=$2'"
repos_to_cmd["edx-analytics-data-api"]="$edx_ansible_cmd analytics_api.yml -e 'ANALYTICS_API_VERSION=$2'"
repos_to_cmd["edx-ora2"]="$edx_ansible_cmd ora2.yml -e 'ora2_version=$2'"
repos_to_cmd["insights"]="$edx_ansible_cmd insights.yml -e 'INSIGHTS_VERSION=$2'"
repos_to_cmd["ecommerce"]="$edx_ansible_cmd ecommerce.yml -e 'ECOMMERCE_VERSION=$2'"
......@@ -77,7 +77,6 @@ repos_to_cmd["veda_pipeline_worker"]="$edx_ansible_cmd veda_pipeline_worker.yml
repos_to_cmd["video_encode_worker"]="$edx_ansible_cmd veda_encode_worker.yml -e 'VEDA_ENCODE_WORKER_VERSION=$2'"
repos_to_cmd["veda_ffmpeg"]="$edx_ansible_cmd veda_ffmpeg.yml -e 'VEDA_FFMPEG_VERSION=$2'"
if [[ -z $1 || -z $2 ]]; then
echo
echo "ERROR: You must specify a repo and commit"
......
......@@ -38,17 +38,17 @@
- name: create api user for the analytics api
mysql_user:
name: "api001"
name: "{{ ANALYTICS_API_DATABASES.default.USER }}"
password: "{{ ANALYTICS_API_DATABASES.default.PASSWORD }}"
priv: '{{ ANALYTICS_API_DATABASES.default.NAME }}.*:ALL/reports.*:SELECT'
when: ANALYTICS_API_SERVICE_CONFIG is defined
when: ANALYTICS_API_DATABASES.default is defined
- name: create read-only reports user for the analytics-api
mysql_user:
name: reports001
name: "{{ ANALYTICS_API_DATABASES.reports.USER }}"
password: "{{ ANALYTICS_API_DATABASES.reports.PASSWORD }}"
priv: '{{ ANALYTICS_API_DATABASES.reports.NAME }}.*:SELECT'
when: ANALYTICS_API_SERVICE_CONFIG is defined
when: ANALYTICS_API_DATABASES.reports is defined
- name: create a database for the hive metastore
mysql_db:
......
......@@ -89,7 +89,7 @@
delay: 30
with_nested:
- "{{ ec2.instances }}"
- ['studio', 'ecommerce', 'preview', 'discovery', 'credentials', 'veda']
- ['studio', 'ecommerce', 'preview', 'discovery', 'credentials', 'veda', 'analytics-api']
- name: Add DNS name for whitelabel sites
local_action:
......
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;
# Nginx does not support nested condition or or conditions so
# there is an unfortunate mix of conditonals here.
{% if NGINX_REDIRECT_TO_HTTPS %}
{% if NGINX_HTTPS_REDIRECT_STRATEGY == "scheme" %}
# Redirect http to https over single instance
if ($scheme != "https")
{
set $do_redirect_to_https "true";
}
{% elif NGINX_HTTPS_REDIRECT_STRATEGY == "forward_for_proto" %}
# Forward to HTTPS if we're an HTTP request... and the server is behind ELB
if ($http_x_forwarded_proto = "http")
{
set $do_redirect_to_https "true";
}
{% endif %}
# Execute the actual redirect
if ($do_redirect_to_https = "true")
{
return 301 https://$host$request_uri;
}
{% endif %}
location ~ ^/static/(?P<file>.*) {
root {{ COMMON_DATA_DIR }}/{{ analytics_api_service_name }};
try_files /staticfiles/$file =404;
}
location / {
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;
# newrelic-specific header records the time when nginx handles a request.
proxy_set_header X-Queue-Start "t=${msec}";
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://analytics_api_app_server;
}
}
......@@ -208,6 +208,10 @@ CREDENTIALS_NGINX_PORT: 80
CREDENTIALS_SSL_NGINX_PORT: 443
CREDENTIALS_VERSION: $credentials_version
ANALYTICS_API_NGINX_PORT: 80
ANALYTICS_API_SSL_NGINX_PORT: 443
ANALYTICS_API_VERSION: $analytics_api_version
VIDEO_PIPELINE_BASE_NGINX_PORT: 80
VIDEO_PIPELINE_BASE_SSL_NGINX_PORT: 443
......@@ -295,6 +299,8 @@ EDXAPP_ECOMMERCE_PUBLIC_URL_ROOT: "https://ecommerce-${deploy_host}"
EDXAPP_ECOMMERCE_API_URL: "https://ecommerce-${deploy_host}/api/v2"
EDXAPP_COURSE_CATALOG_API_URL: "https://catalog-${deploy_host}/api/v1"
ANALYTICS_API_LMS_BASE_URL: "https://{{ EDXAPP_LMS_BASE }}"
# NOTE: This is the same as DISCOVERY_URL_ROOT below
ECOMMERCE_DISCOVERY_SERVICE_URL: "https://discovery-${deploy_host}"
ECOMMERCE_ECOMMERCE_URL_ROOT: "https://ecommerce-${deploy_host}"
......@@ -371,7 +377,7 @@ veda_encode_worker=${video_encode_worker:-false}
video_pipeline_integration=${video_pipeline:-false}
declare -A deploy
roles="edxapp forum ecommerce credentials discovery veda_web_frontend veda_pipeline_worker veda_encode_worker video_pipeline_integration notifier xqueue xserver certs demo testcourses"
roles="edxapp forum ecommerce credentials discovery analytics_api veda_web_frontend veda_pipeline_worker veda_encode_worker video_pipeline_integration notifier xqueue xserver certs demo testcourses"
for role in $roles; do
deploy[$role]=${!role}
......
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