Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Redirect edxapp Gunicorn logs to dedicated files #146

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions playbooks/roles/edxapp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ EDXAPP_CMS_GUNICORN_EXTRA: ""
EDXAPP_CMS_GUNICORN_EXTRA_CONF: ""
EDXAPP_CMS_GUNICORN_TIMEOUT: 300

EDXAPP_USE_GUNICORN_SEPARATE_LOG_FILE: False

# Set this to the maximum number
# of requests for gunicorn for the lms and cms
# gunicorn --max-requests <num>
Expand Down Expand Up @@ -1113,6 +1115,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_web_user }}"
group: "{{ common_web_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
4 changes: 4 additions & 0 deletions 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,8 @@ 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
{% if EDXAPP_USE_GUNICORN_SEPARATE_LOG_FILE %}
exec {{ executable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi --log-file {{ edxapp_gunicorn_log_dir[1] }}/edx.log
{% else %}
exec {{ executable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
{% endif %}
4 changes: 4 additions & 0 deletions 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,8 @@ 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
{% if EDXAPP_USE_GUNICORN_SEPARATE_LOG_FILE %}
exec {{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi --log-file {{ edxapp_gunicorn_log_dir[0] }}/edx.log
{% else %}
exec {{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi
{% endif %}
Loading