Commit 906b414f by Clinton Blackburn Committed by Clinton Blackburn

Updates for ecommerce in devstack

- Added explicit values for variables that must be shared between ecommerce and edxapp
- Added ecommerce virtualenv bin directory to PATH for ecommerce user
- Using local Django settings (instead of production)
- Disabled static file compilation for devstack
- Allowing ecommerce version to be specified via environment variable

ECOM-2185
parent fad25d51
......@@ -35,6 +35,7 @@ ECOMMERCE_DATABASES:
CONN_MAX_AGE: 60
ECOMMERCE_VERSION: "master"
ECOMMERCE_DJANGO_SETTINGS_MODULE: "ecommerce.settings.production"
ECOMMERCE_SECRET_KEY: 'Your secret key here'
ECOMMERCE_TIME_ZONE: 'UTC'
......@@ -163,14 +164,11 @@ ECOMMERCE_GUNICORN_WORKER_CLASS: "gevent"
#
# vars are namespace with the module name.
#
ecommerce_environment:
DJANGO_SETTINGS_MODULE: "ecommerce.settings.production"
ECOMMERCE_CFG: "{{ COMMON_CFG_DIR }}/{{ ecommerce_service_name }}.yml"
ecommerce_service_name: "ecommerce"
ecommerce_user: "{{ ecommerce_service_name }}"
ecommerce_home: "{{ COMMON_APP_DIR }}/{{ ecommerce_service_name }}"
ecommerce_code_dir: "{{ ecommerce_home }}/{{ ecommerce_service_name }}"
ecommerce_venv_dir: "{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}"
ecommerce_nodeenv_dir: "{{ ecommerce_home }}/nodeenvs/{{ ecommerce_service_name }}"
ecommerce_nodeenv_bin: "{{ ecommerce_nodeenv_dir }}/bin"
......@@ -188,6 +186,11 @@ ecommerce_requirements:
- production.txt
- optional.txt
ecommerce_environment:
DJANGO_SETTINGS_MODULE: "{{ ECOMMERCE_DJANGO_SETTINGS_MODULE }}"
ECOMMERCE_CFG: "{{ COMMON_CFG_DIR }}/{{ ecommerce_service_name }}.yml"
PATH: "{{ ecommerce_venv_dir }}/bin:${PATH}"
#
# OS packages
#
......
......@@ -30,7 +30,7 @@
- name: install application requirements
pip: >
requirements="{{ ecommerce_requirements_base }}/{{ item }}"
virtualenv="{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}"
virtualenv="{{ ecommerce_venv_dir }}"
state=present
sudo_user: "{{ ecommerce_user }}"
with_items: ecommerce_requirements
......@@ -38,7 +38,7 @@
- name: create nodeenv
shell: >
creates={{ ecommerce_nodeenv_dir }}
{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}/bin/nodeenv {{ ecommerce_nodeenv_dir }} --prebuilt
{{ ecommerce_venv_dir }}/bin/nodeenv {{ ecommerce_nodeenv_dir }} --prebuilt
sudo_user: "{{ ecommerce_user }}"
- name: install node dependencies
......@@ -56,7 +56,7 @@
chdir={{ ecommerce_code_dir }}
DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }}
DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }}
{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}/bin/python ./manage.py migrate --noinput
{{ ecommerce_venv_dir }}/bin/python ./manage.py migrate --noinput
sudo_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
......@@ -66,7 +66,7 @@
chdir={{ ecommerce_code_dir }}
DB_MIGRATION_USER={{ COMMON_MYSQL_MIGRATE_USER }}
DB_MIGRATION_PASS={{ COMMON_MYSQL_MIGRATE_PASS }}
{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}/bin/python ./manage.py oscar_populate_countries
{{ ecommerce_venv_dir }}/bin/python ./manage.py oscar_populate_countries
sudo_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
......@@ -83,16 +83,18 @@
chdir={{ ecommerce_code_dir }}
. {{ ecommerce_nodeenv_bin }}/activate && {{ ecommerce_node_bin }}/r.js -o build.js
sudo_user: "{{ ecommerce_user }}"
when: not devstack
- name: run collectstatic
shell: >
chdir={{ ecommerce_code_dir }}
{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}/bin/python manage.py {{ item }}
{{ ecommerce_venv_dir }}/bin/python manage.py {{ item }}
sudo_user: "{{ ecommerce_user }}"
environment: "{{ ecommerce_environment }}"
with_items:
- "collectstatic --noinput"
- "compress"
when: not devstack
- name: write out the supervisor wrapper
template: >
......@@ -128,7 +130,7 @@
- name: create symlinks from the-er venv bin dir
file: >
src="{{ ecommerce_home }}/venvs/{{ ecommerce_service_name }}/bin/{{ item }}"
src="{{ ecommerce_venv_dir }}/bin/{{ item }}"
dest="{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.ecommerce"
state=link
with_items:
......
......@@ -476,8 +476,8 @@ CDN_VIDEO_URLS: {}
PERFORMANCE_GRAPHITE_URL: 'SetPerformanceGraphiteHostName'
# E-Commerce Related Settings
EDXAPP_ECOMMERCE_PUBLIC_URL_ROOT: 'https://www.example.com'
EDXAPP_ECOMMERCE_API_URL: 'https://www-internal.example.com/api/v2'
EDXAPP_ECOMMERCE_PUBLIC_URL_ROOT: "http://localhost:8002"
EDXAPP_ECOMMERCE_API_URL: "http://localhost:8002/api/v2"
EDXAPP_ECOMMERCE_API_SIGNING_KEY: 'SET-ME-PLEASE'
#To use AWS S3 as your backend, you need different kwargs:
......
......@@ -148,5 +148,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if ENV['EDX_PLATFORM_VERSION']
ansible.extra_vars['edx_platform_version'] = ENV['EDX_PLATFORM_VERSION']
end
if ENV['ECOMMERCE_VERSION']
ansible.extra_vars['ECOMMERCE_VERSION'] = ENV['ECOMMERCE_VERSION']
end
end
end
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