Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
2e647ece
Commit
2e647ece
authored
Nov 24, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert edxapp gunicorn to configuration file
parent
6a4e586f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
31 deletions
+61
-31
playbooks/roles/edxapp/defaults/main.yml
+3
-0
playbooks/roles/edxapp/tasks/service_variant_config.yml
+8
-0
playbooks/roles/edxapp/templates/cms.conf.j2
+1
-15
playbooks/roles/edxapp/templates/cms_gunicorn.py.j2
+24
-0
playbooks/roles/edxapp/templates/lms.conf.j2
+1
-16
playbooks/roles/edxapp/templates/lms_gunicorn.py.j2
+24
-0
No files found.
playbooks/roles/edxapp/defaults/main.yml
View file @
2e647ece
...
...
@@ -28,7 +28,10 @@ EDXAPP_PREVIEW_LMS_BASE: ""
EDXAPP_CMS_BASE
:
"
"
EDXAPP_LMS_GUNICORN_EXTRA
:
"
"
EDXAPP_LMS_GUNICORN_EXTRA_CONF
:
"
"
EDXAPP_CMS_GUNICORN_EXTRA
:
"
"
EDXAPP_CMS_GUNICORN_EXTRA_CONF
:
"
"
# Set this to the maximum number
# of requests for gunicorn for the lms and cms
...
...
playbooks/roles/edxapp/tasks/service_variant_config.yml
View file @
2e647ece
...
...
@@ -37,6 +37,14 @@
group={{ supervisor_user }}
sudo_user
:
"
{{
supervisor_user
}}"
-
name
:
"
add
gunicorn
configuration
files"
template
:
>
src={{ item }}_gunicorn.py.j2 dest={{ edxapp_app_dir }}/{{ item }}_gunicorn.py
with_items
:
service_variants_enabled
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
restart edxapp
# write the supervisor script for celery workers
-
name
:
writing celery worker supervisor script
...
...
playbooks/roles/edxapp/templates/cms.conf.j2
View file @
2e647ece
...
...
@@ -5,22 +5,8 @@
{% else -%}
{% set executable = edxapp_venv_dir + '/bin/gunicorn' -%}
{% endif -%}
{% if EDXAPP_CMS_MAX_REQ -%}
{% set max_req = '--max-requests ' + EDXAPP_CMS_MAX_REQ|string -%}
{% else -%}
{% set max_req = '' -%}
{% endif -%}
{% if EDXAPP_WORKERS -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_cms_gunicorn_host }}:{{ edxapp_cms_gunicorn_port }} -w {{ EDXAPP_WORKERS.cms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} cms.wsgi
{% else -%}
{# This is for backwards compatibility, set workers explicitely using EDXAPP_WORKERS #}
{% if ansible_processor|length > 0 -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_cms_gunicorn_host }}:{{ edxapp_cms_gunicorn_port }} -w {{ ansible_processor|length * worker_core_mult.cms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
{% else -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_cms_gunicorn_host }}:{{ edxapp_cms_gunicorn_port }} -w {{ worker_core_mult.cms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
{% endif -%}
{% endif -%}
command={{ executable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
user={{ common_web_user }}
directory={{ edxapp_code_dir }}
...
...
playbooks/roles/edxapp/templates/cms_gunicorn.py.j2
0 → 100644
View file @
2e647ece
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
import multiprocessing
preload_app = True
timeout = 300
bind = "{{ edxapp_cms_gunicorn_host }}:{{ edxapp_cms_gunicorn_port }}"
pythonpath = "{{ edxapp_code_dir }}"
{% if EDXAPP_CMS_MAX_REQ -%}
max_requests = {{ EDXAPP_CMS_MAX_REQ }}
{% endif -%}
{% if EDXAPP_WORKERS %}
workers = {{ EDXAPP_WORKERS }}
{% else %}
workers = (multiprocessing.cpu_count()-1) * {{ worker_core_mult.cms }} + {{ worker_core_mult.cms }}
{% endif %}
{{ EDXAPP_CMS_GUNICORN_EXTRA_CONF }}
playbooks/roles/edxapp/templates/lms.conf.j2
View file @
2e647ece
...
...
@@ -6,22 +6,7 @@
{% set executable = edxapp_venv_dir + '/bin/gunicorn' -%}
{% endif -%}
{% if EDXAPP_LMS_MAX_REQ -%}
{% set max_req = '--max-requests ' + EDXAPP_LMS_MAX_REQ|string -%}
{% else -%}
{% set max_req = '' -%}
{% endif -%}
{% if EDXAPP_WORKERS -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_lms_gunicorn_host }}:{{ edxapp_lms_gunicorn_port }} -w {{ EDXAPP_WORKERS.lms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} lms.wsgi
{% else -%}
{# This is for backwards compatibility, set workers explicitely using EDXAPP_WORKERS #}
{% if ansible_processor|length > 0 -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_lms_gunicorn_host }}:{{ edxapp_lms_gunicorn_port }} -w {{ ansible_processor|length * worker_core_mult.lms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} {{ EDXAPP_LMS_GUNICORN_EXTRA }} lms.wsgi
{% else -%}
command={{ executable }} {{ max_req }} --preload -b {{ edxapp_lms_gunicorn_host }}:{{ edxapp_lms_gunicorn_port }} -w {{ worker_core_mult.lms }} --timeout=300 --pythonpath={{ edxapp_code_dir }} {{ EDXAPP_LMS_GUNICORN_EXTRA }} lms.wsgi
{% endif %}
{% endif %}
command={{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi
user={{ common_web_user }}
directory={{ edxapp_code_dir }}
...
...
playbooks/roles/edxapp/templates/lms_gunicorn.py.j2
0 → 100644
View file @
2e647ece
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
import multiprocessing
preload_app = True
timeout = 300
bind = "{{ edxapp_lms_gunicorn_host }}:{{ edxapp_lms_gunicorn_port }}"
pythonpath = "{{ edxapp_code_dir }}"
{% if EDXAPP_LMS_MAX_REQ -%}
max_requests = {{ EDXAPP_LMS_MAX_REQ }}
{% endif -%}
{% if EDXAPP_WORKERS %}
workers = {{ EDXAPP_WORKERS }}
{% else %}
workers = (multiprocessing.cpu_count()-1) * {{ worker_core_mult.lms }} + {{ worker_core_mult.lms }}
{% endif %}
{{ EDXAPP_LMS_GUNICORN_EXTRA_CONF }}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment