Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
7b986cee
Commit
7b986cee
authored
Jun 24, 2014
by
John Jarvis
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1234 from edx/jarv/add-nginx
add nginx for analytics-api
parents
1f136b42
c73eec0d
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
4 deletions
+100
-4
playbooks/edx-east/analyticsapi.yml
+3
-0
playbooks/edx-east/edx_continuous_integration.yml
+1
-0
playbooks/roles/analytics-api/defaults/main.yml
+5
-2
playbooks/roles/analytics-api/handlers/main.yml
+23
-0
playbooks/roles/analytics-api/tasks/deploy.yml
+15
-0
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics-api.sh.j2
+1
-0
playbooks/roles/edx_service/tasks/main.yml
+13
-2
playbooks/roles/nginx/defaults/main.yml
+2
-0
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/analytics-api.j2
+37
-0
No files found.
playbooks/edx-east/analyticsapi.yml
View file @
7b986cee
...
...
@@ -7,6 +7,9 @@
ENABLE_SPLUNKFORWARDER
:
False
ENABLE_NEWRELIC
:
False
roles
:
-
role
:
nginx
nginx_sites
:
-
analytics-api
-
aws
-
analytics-api
-
role
:
datadog
...
...
playbooks/edx-east/edx_continuous_integration.yml
View file @
7b986cee
...
...
@@ -16,6 +16,7 @@
-
xqueue
-
xserver
-
certs
-
analytics-api
nginx_default_sites
:
-
lms
-
edxlocal
...
...
playbooks/roles/analytics-api/defaults/main.yml
View file @
7b986cee
...
...
@@ -17,6 +17,7 @@ ANALYTICS_API_GIT_IDENTITY: !!null
# and a key being provided via NEWRELIC_LICENSE_KEY
ANALYTICS_API_NEWRELIC_APPNAME
:
"
your
Newrelic
appname"
ANALYTICS_API_PIP_EXTRA_ARGS
:
"
-i
{{
COMMON_PYPI_MIRROR_URL
}}"
ANALYTICS_API_NGINX_PORT
:
"
18100"
#
# vars are namespace with the module name.
...
...
@@ -32,8 +33,8 @@ analytics_api_venv_dir: "{{ analytics_api_venv_base }}/{{ analytics_api_service_
analytics_api_venv_bin
:
"
{{
analytics_api_venv_dir
}}/bin"
analytics_api_code_dir
:
"
{{
analytics_api_app_dir
}}/edx-analytics-data-api"
analytics_api_conf_dir
:
"
{{
analytics_api_home
}}"
analytics_api_gunicorn_host
:
"
0.0.0.0
"
analytics_api_gunicorn_port
:
"
8
08
0"
analytics_api_gunicorn_host
:
"
127.0.0.1
"
analytics_api_gunicorn_port
:
"
8
10
0"
analytics_api_gunicorn_workers
:
"
8"
analytics_api_gunicorn_timeout
:
"
300"
...
...
@@ -61,6 +62,8 @@ ANALYTICS_API_CONFIG:
EMAIL_HOST_USER
:
"
"
EMAIL_PORT
:
587
API_AUTH_TOKEN
:
'
put-your-api-token-here'
STATICFILES_DIRS
:
[]
STATIC_ROOT
:
"
{{
COMMON_DATA_DIR
}}/{{
analytics_api_service_name
}}/staticfiles"
# db config
DATABASE_OPTIONS
:
connect_timeout
:
10
...
...
playbooks/roles/analytics-api/handlers/main.yml
0 → 100644
View file @
7b986cee
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Handlers for role analytics-api
#
# Overview:
#
#
-
name
:
"
restart
the
analytics
service"
supervisorctl_local
:
>
name={{ analytics_api_service_name }}
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
playbooks/roles/analytics-api/tasks/deploy.yml
View file @
7b986cee
...
...
@@ -10,13 +10,24 @@
dest={{ analytics_api_code_dir }} repo={{ analytics_api_source_repo }} version={{ ANALYTICS_API_VERSION }}
accept_hostkey=yes
ssh_opts="{{ analytics_api_git_ssh_opts }}"
register
:
analytics_api_code_checkout
notify
:
"
restart
the
analytics
service"
sudo_user
:
"
{{
analytics_api_user
}}"
-
name
:
run collectstatic
shell
:
>
chdir={{ analytics_api_code_dir }}
{{ analytics_api_venv_bin }}/python manage.py collectstatic --settings analyticsdataserver.settings.production --noinput --settings analyticsdataserver.settings.production
sudo_user
:
"
{{
analytics_api_user
}}"
environment
:
ANALYTICS_API_CFG
:
"
{{
COMMON_CFG_DIR
}}/{{
analytics_api_service_name
}}.yaml"
-
name
:
install application requirements
pip
:
>
requirements="{{ analytics_api_requirements_base }}/{{ item }}"
virtualenv="{{ analytics_api_venv_dir }}" state=present
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
restart the analytics service
with_items
:
analytics_api_requirements
-
name
:
write out app config file
...
...
@@ -24,18 +35,21 @@
src=edx/app/analytics-api/analytics-api.yaml.j2
dest={{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yaml
mode=0644 owner={{ analytics_api_user }} group={{ analytics_api_user }}
notify
:
restart the analytics service
-
name
:
write out the supervisior wrapper
template
:
>
src=edx/app/analytics-api/analytics-api.sh.j2
dest={{ analytics_api_app_dir }}/{{ analytics_api_service_name }}.sh
mode=0650 owner={{ supervisor_user }} group={{ common_web_user }}
notify
:
restart the analytics service
-
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
notify
:
restart the analytics service
-
name
:
enable supervisor script
file
:
>
...
...
@@ -43,6 +57,7 @@
dest={{ supervisor_cfg_dir }}/{{ analytics_api_service_name }}.conf
state=link
force=yes
notify
:
restart the analytics service
when
:
not disable_edx_services
-
name
:
update supervisor configuration
...
...
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics-api.sh.j2
View file @
7b986cee
...
...
@@ -13,6 +13,7 @@ export NEW_RELIC_APP_NAME="{{ ANALYTICS_API_NEWRELIC_APPNAME }}"
export
NEW_RELIC_LICENSE_KEY
=
"{{ NEWRELIC_LICENSE_KEY }}"
{
% endif -%
}
export
SERVICE_VARIANT
={{
analytics_api_service_name
}}
export
DJANGO_SETTINGS_MODULE
=
"analyticsdataserver.settings.production"
export
ANALYTICS_API_CFG
=
"{{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yaml"
...
...
playbooks/roles/edx_service/tasks/main.yml
View file @
7b986cee
...
...
@@ -44,13 +44,24 @@
-
"
{{
COMMON_APP_DIR
}}/{{
edx_service_name
}}"
-
"
{{
COMMON_APP_DIR
}}/{{
edx_service_name
}}/venvs"
-
name
:
create edx_service
log
dir
-
name
:
create edx_service
data and staticfiles
dir
file
:
>
path="{{ item }}"
state=directory
owner="{{
common_web_user
}}"
owner="{{
edx_service_name
}}"
group="{{ common_web_group }}"
with_items
:
-
"
{{
COMMON_DATA_DIR
}}/{{
edx_service_name
}}/data"
-
"
{{
COMMON_DATA_DIR
}}/{{
edx_service_name
}}/staticfiles"
-
name
:
create edx_service log dir
file
:
>
path="{{ item }}"
state=directory
owner="syslog"
group="syslog"
with_items
:
-
"
{{
COMMON_LOG_DIR
}}/{{
edx_service_name
}}"
# Replace dashes with underscores to support roles that use
...
...
playbooks/roles/nginx/defaults/main.yml
View file @
7b986cee
...
...
@@ -51,6 +51,8 @@ nginx_lms_preview_gunicorn_hosts:
-
127.0.0.1
nginx_cms_gunicorn_hosts
:
-
127.0.0.1
nginx_analytics_api_gunicorn_hosts
:
-
127.0.0.1
nginx_cfg
:
# - link - turn on
...
...
playbooks/roles/nginx/templates/edx/app/nginx/sites-available/analytics-api.j2
0 → 100644
View file @
7b986cee
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 ~ ^/static/(?P<file>.*) {
root {{ COMMON_DATA_DIR }}/{{ analytics_api_service_name }};
try_files /staticfiles/$file =404;
}
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;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment