Commit b54ea9b0 by Feanil Patel

Fixes and updates to get the role running.

Mostly from wiring issues I discovered while testing this vagrant
image.
parent 92af97e0
......@@ -31,7 +31,7 @@ EDX_ECOMMERCE_DATABASES:
EDX_ECOMMERCE_VERSION: "master"
EDX_DJANGO_OSCAR_VERSION: "master"
EDX_DJANGO_OSCAR_EXTENSION_VERSION: "master"
EDX_DJANGO_OSCAR_EXTENSIONS_VERSION: "master"
# Default dummy user, override this!!
EDX_ECOMMERCE_USERS:
......@@ -57,7 +57,8 @@ EDX_ECOMMERCE_SERVICE_CONFIG:
EMAIL_HOST_USER: '{{ EDX_ECOMMERCE_EMAIL_HOST_USER }}'
EMAIL_PORT: $EDX_ECOMMERCE_EMAIL_PORT
API_AUTH_TOKEN: '{{ EDX_ECOMMERCE_AUTH_TOKEN }}'
STATICFILES_DIRS: ['static']
STATICFILES_DIRS: []
# STATICFILES_DIRS: ['{{ edx_ecommerce_static_path }}']
STATIC_ROOT: "{{ COMMON_DATA_DIR }}/{{ edx_ecommerce_service_name }}/staticfiles"
# db config
DATABASE_OPTIONS:
......@@ -96,25 +97,23 @@ EDX_ECOMMERCE_GUNICORN_EXTRA_CONF: ""
# vars are namespace with the module name.
#
edx_ecommerce_environment:
DJANGO_SETTINGS_MODULE: "settings.production"
EDX_ECOMMERCE_SERVICE_CONFIG: "{{ COMMON_CFG_DIR }}/{{ edx_ecommerce_service_name }}.yml"
DJANGO_SETTINGS_MODULE: "ecommerce.settings.production"
EDX_ECOMMERCE_CFG: "{{ COMMON_CFG_DIR }}/{{ edx_ecommerce_service_name }}.yml"
edx_ecommerce_service_name: "edx_ecommerce"
edx_ecommerce_user: "{{ edx_ecommerce_service_name }}"
edx_ecommerce_home: "{{ COMMON_APP_DIR }}/{{ edx_ecommerce_service_name }}"
edx_ecommerce_code_dir: "{{ edx_ecommerce_home }}/{{ edx_ecommerce_service_name }}"
edx_ecommerce_static_path: "{{ edx_ecommerce_code_dir }}/ecommerce/static"
edx_ecommerce_gunicorn_host: "127.0.0.1"
edx_ecommerce_gunicorn_port: "8130"
edx_ecommerce_gunicorn_timeout: "300"
edx_ecommerce_django_settings: "production"
edx_ecommerce_log_dir: "{{ COMMON_LOG_DIR }}/{{ edx_ecommerce_service_name }}"
edx_ecommerce_requirements_base: "{{ edx_ecommerce_code_dir }}/requirements"
edx_ecommerce_requirements:
- base.txt
- production.txt
#- optional.txt
......@@ -126,4 +125,4 @@ edx_ecommerce_debian_pkgs:
- 'libmysqlclient-dev'
- 'libjpeg-dev'
edx_ecommerce_redhat_pkgs: []
\ No newline at end of file
edx_ecommerce_redhat_pkgs: []
......@@ -45,12 +45,12 @@
environment: "{{ edx_ecommerce_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes"
# - name: run collectstatic
# shell: >
# chdir={{ edx_ecommerce_code_dir }}
# {{ edx_ecommerce_home }}/venvs/{{ edx_ecommerce_service_name }}/bin/python manage.py collectstatic --noinput
# sudo_user: "{{ edx_ecommerce_user }}"
# environment: "{{ edx_ecommerce_environment }}"
- name: run collectstatic
shell: >
chdir={{ edx_ecommerce_code_dir }}
{{ edx_ecommerce_home }}/venvs/{{ edx_ecommerce_service_name }}/bin/python manage.py collectstatic --noinput
sudo_user: "{{ edx_ecommerce_user }}"
environment: "{{ edx_ecommerce_environment }}"
- name: write out the supervisor wrapper
template: >
......@@ -64,6 +64,14 @@
dest="{{ supervisor_available_dir }}/{{ edx_ecommerce_service_name }}.conf"
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
- name: setup the ecommence env file
template: >
src="./{{ edx_ecommerce_home }}/{{ edx_ecommerce_service_name }}_env.j2"
dest="{{ edx_ecommerce_home }}/edx_ecommerce_env"
owner={{ edx_ecommerce_user }}
group={{ edx_ecommerce_user }}
mode=0644
- name: enable supervisor script
file: >
src={{ supervisor_available_dir }}/{{ edx_ecommerce_service_name }}.conf
......
......@@ -2,7 +2,7 @@
{{ ansible_managed }}
{% set edx_ecommerce_venv_bin = edx_ecommerce_home + "/venvs/" + edx_ecommerce_service_name + "/bin/" %}
{% set edx_ecommerce_venv_bin = edx_ecommerce_home + "/venvs/" + edx_ecommerce_service_name + "/bin" %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edx_ecommerce_venv_bin + '/newrelic-admin run-program ' + edx_ecommerce_venv_bin + '/gunicorn' %}
{% else %}
......@@ -16,4 +16,4 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
source {{ edx_ecommerce_home }}/edx_ecommerce_env
# TODO fix application
{{ executable }} -c {{ edx_ecommerce_home }}/edx_ecommerce_gunicorn.py {{ EDX_ECOMMERCE_GUNICORN_EXTRA }} wsgi:application
{{ executable }} -c {{ edx_ecommerce_home }}/edx_ecommerce_gunicorn.py {{ EDX_ECOMMERCE_GUNICORN_EXTRA }} ecommerce.wsgi:application
# {{ ansible_managed }}
{% for name,value in edx_ecommerce_environment.items() -%}
{%- if value -%}
export {{ name }}="{{ value }}"
{% endif %}
{%- endfor %}
......@@ -6,7 +6,7 @@
command={{ edx_ecommerce_home }}/{{ edx_ecommerce_service_name }}.sh
user={{ common_web_user }}
directory={{ edx_ecommerce_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)-stderr.log
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
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