Skip to content

Commit

Permalink
feat: Redirect edxapp Gunicorn logs to dedicated files
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeemshahzad committed Jan 2, 2025
1 parent 58f6936 commit 64f031c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions playbooks/roles/edxapp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,9 @@ EDXAPP_COMPLETION_AGGREGATOR_URL: null
edxapp_data_dir: "{{ COMMON_DATA_DIR }}/edxapp"
edxapp_app_dir: "{{ COMMON_APP_DIR }}/edxapp"
edxapp_log_dir: "{{ COMMON_LOG_DIR }}/edx"
edxapp_gunicorn_log_dir:
- "{{ COMMON_LOG_DIR }}/gunicorn-lms"
- "{{ COMMON_LOG_DIR }}/gunicorn-cms"
edxapp_venvs_dir: "{{ edxapp_app_dir }}/venvs"
edxapp_venv_dir: "{{ edxapp_venvs_dir }}/edxapp"
edxapp_venv_bin: "{{ edxapp_venv_dir }}/bin"
Expand Down
12 changes: 12 additions & 0 deletions playbooks/roles/edxapp/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
- install
- install:base

- name: create edxapp gunicorn log dirs
file:
path: "{{ item }}"
state: directory
owner: "{{ common_log_user }}"
group: "{{ common_log_user }}"
with_items:
- "{{ edxapp_gunicorn_log_dir }}"
tags:
- install
- install:base

- name: Ensure the tracking folder exists
file:
path: "{{ COMMON_LOG_DIR }}/tracking"
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ export EDX_REST_API_CLIENT_NAME="{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }

source {{ edxapp_app_dir }}/edxapp_env
# We exec so that gunicorn is the child of supervisor and can be managed properly
exec {{ executable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
exec {{ executable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi --log-file {{ edxapp_gunicorn_log_dir[1] }}/edx.log
2 changes: 1 addition & 1 deletion playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export EDX_REST_API_CLIENT_NAME="{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }

source {{ edxapp_app_dir }}/edxapp_env
# We exec so that gunicorn is the child of supervisor and can be managed properly
exec {{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi
exec {{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi --log-file {{ edxapp_gunicorn_log_dir[0] }}/edx.log

0 comments on commit 64f031c

Please sign in to comment.