Commit 14db9ed8 by John Jarvis

read config from yaml

parent 9c8baf9d
......@@ -8,6 +8,7 @@
ENABLE_NEWRELIC: False
roles:
- aws
- edxlocal
- analytics-api
- role: datadog
when: COMMON_ENABLE_DATADOG
......
......@@ -30,7 +30,7 @@ analytics_api_home: "{{ COMMON_APP_DIR }}/{{ analytics_api_service_name }}"
analytics_api_venv_base: "{{ analytics_api_home }}/venvs"
analytics_api_venv_dir: "{{ analytics_api_venv_base }}/{{ analytics_api_service_name }}"
analytics_api_venv_bin: "{{ analytics_api_venv_dir }}/bin"
analytics_api_code_dir: "{{ analytics_api_app_dir }}/src/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_gunicorn_host: "0.0.0.0"
analytics_api_gunicorn_port: "8080"
......@@ -63,22 +63,22 @@ ANALYTICS_API_CONFIG:
API_AUTH_TOKEN: 'put-your-api-token-here'
# db config
DATABASES:
# rw user
default:
ENGINE: 'django.db.backends.mysql'
NAME: 'reports'
USER: 'pipeline'
NAME: 'analytics-api'
USER: 'api001'
PASSWORD: 'password'
HOST: 'localhost'
PORT: '3306'
analytics:
# read-only user
reports:
ENGINE: 'django.db.backends.mysql'
NAME: 'analytics-api'
USER: 'api'
NAME: 'reports'
USER: 'reports001'
PASSWORD: 'password'
HOST: 'localhost'
PORT: '3306'
#
# OS packages
#
......
......@@ -10,6 +10,7 @@
dest={{ analytics_api_code_dir }} repo={{ analytics_api_source_repo }} version={{ ANALYTICS_API_VERSION }}
accept_hostkey=yes
ssh_opts="{{ analytics_api_git_ssh_opts }}"
sudo_user: "{{ analytics_api_user }}"
- name: install application requirements
pip: >
......
......@@ -13,6 +13,7 @@ export NEW_RELIC_APP_NAME="{{ ANALYTICS_API_NEWRELIC_APPNAME }}"
export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% endif -%}
export DJANGO_SETTINGS_MODULE="analyticsdataserver.settings.production"
export ANALYTICS_API_CFG="{{ COMMON_CFG_DIR }}/{{ analytics_api_service_name }}.yaml"
{{ executable }} -b {{ analytics_api_gunicorn_host }}:{{ analytics_api_gunicorn_port }} -w {{ analytics_api_gunicorn_workers }} --timeout={{ analytics_api_gunicorn_timeout }} analyticsdataserver.wsgi:application
{{ executable }} --pythonpath={{ analytics_api_code_dir }} -b {{ analytics_api_gunicorn_host }}:{{ analytics_api_gunicorn_port }} -w {{ analytics_api_gunicorn_workers }} --timeout={{ analytics_api_gunicorn_timeout }} analyticsdataserver.wsgi:application
......@@ -43,7 +43,6 @@
with_items:
- "{{ COMMON_APP_DIR }}/{{ edx_service_name }}"
- "{{ COMMON_APP_DIR }}/{{ edx_service_name }}/venvs"
- "{{ COMMON_APP_DIR }}/{{ edx_service_name }}/data"
- name: create edx_service log dir
file: >
......
......@@ -18,12 +18,14 @@
name={{ EDXAPP_MYSQL_USER_MIGRATE }}
password={{ EDXAPP_MYSQL_PASSWORD_MIGRATE}}
priv='{{EDXAPP_MYSQL_DB_NAME}}.*:ALL'
when: EDXAPP_MYSQL_USER_MIGRATE is defined
- name: setup the edxapp db user
mysql_user: >
name={{ EDXAPP_MYSQL_USER }}
password={{ EDXAPP_MYSQL_PASSWORD }}
priv='{{EDXAPP_MYSQL_DB_NAME}}.*:ALL'
when: EDXAPP_MYSQL_USER is defined
- name: create a database for edxapp
mysql_db: >
......@@ -51,6 +53,7 @@
name={{ ORA_MYSQL_USER }}
password={{ ORA_MYSQL_PASSWORD }}
priv='{{ORA_MYSQL_DB_NAME}}.*:ALL'
when: ORA_MYSQL_USER is defined
- name: create a database for ora
mysql_db: >
......@@ -84,18 +87,18 @@
- 'analytics-api'
when: analytics_api_role_name is defined
- name: create database users analytics api
- name: create api user for the analytics api
mysql_user: >
name=reports
name=api001
password=password
priv='reports.*:ALL'
priv='analytics-api.*:ALL'
when: analytics_api_role_name is defined
- name: create database users analytics api
- name: create read-only reports user for the analytics-api
mysql_user: >
name=api
name=reports001
password=password
priv='analytics-api.*:ALL'
priv='reports.*:SELECT'
when: analytics_api_role_name is defined
- name: install memcached
......
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