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
fa045f01
Commit
fa045f01
authored
Dec 10, 2014
by
Carson Gee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1717 from mitodl/cg/gunicorn_conf_files
Convert active gunicorn services to use configuration file
parents
cbd12247
36348a44
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
159 additions
and
44 deletions
+159
-44
CHANGELOG.md
+6
-0
playbooks/roles/analytics-api/defaults/main.yml
+1
-0
playbooks/roles/analytics-api/tasks/deploy.yml
+7
-0
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics-api.sh.j2
+1
-1
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics_api_gunicorn.py.j2
+12
-0
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
playbooks/roles/ora/defaults/main.yml
+1
-0
playbooks/roles/ora/tasks/deploy.yml
+7
-0
playbooks/roles/ora/templates/ora.conf.j2
+1
-1
playbooks/roles/ora/templates/ora_gunicorn.py.j2
+13
-0
playbooks/roles/xqueue/defaults/main.yml
+1
-1
playbooks/roles/xqueue/tasks/deploy.yml
+6
-0
playbooks/roles/xqueue/templates/xqueue.conf.j2
+1
-9
playbooks/roles/xqueue/templates/xqueue_gunicorn.py.j2
+19
-0
playbooks/roles/xserver/defaults/main.yml
+1
-0
playbooks/roles/xserver/tasks/deploy.yml
+7
-0
playbooks/roles/xserver/templates/xserver.conf.j2
+1
-1
playbooks/roles/xserver/templates/xserver_gunicorn.py.j2
+13
-0
No files found.
CHANGELOG.md
View file @
fa045f01
-
Role: analytics-api, edxapp, ora, xqueue, xserver
-
Switched gunicorn from using an entirely command argument based
configuration to usign python configuration files. Variables for
extra configuration in the configuration file template, and
command line argument overrides are available.
-
Role: analytics-api, insights
-
Using Django 1.7 migrate command.
...
...
playbooks/roles/analytics-api/defaults/main.yml
View file @
fa045f01
...
...
@@ -71,6 +71,7 @@ ANALYTICS_API_CONFIG:
ANALYTICS_API_GUNICORN_WORKERS
:
"
2"
ANALYTICS_API_GUNICORN_EXTRA
:
"
"
ANALYTICS_API_GUNICORN_EXTRA_CONF
:
"
"
#
# vars are namespace with the module name.
#
...
...
playbooks/roles/analytics-api/tasks/deploy.yml
View file @
fa045f01
...
...
@@ -22,6 +22,13 @@
notify
:
"
restart
the
analytics
service"
sudo_user
:
"
{{
analytics_api_user
}}"
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=edx/app/analytics-api/analytics_api_gunicorn.py.j2
dest={{ analytics_api_app_dir }}/analytics_api_gunicorn.py
sudo_user
:
"
{{
analytics_api_user
}}"
notify
:
"
restart
the
analytics
service"
-
name
:
write out app config file
template
:
>
src=edx/app/analytics-api/analytics-api.yaml.j2
...
...
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics-api.sh.j2
View file @
fa045f01
...
...
@@ -15,4 +15,4 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
source
{{
analytics_api_app_dir
}}
/analytics_api_env
{{
executable
}}
-
-pythonpath
={{
analytics_api_code_dir
}}
-b
{{
analytics_api_gunicorn_host
}}
:
{{
analytics_api_gunicorn_port
}}
-w
{{
ANALYTICS_API_GUNICORN_WORKERS
}}
--timeout
={{
analytics_api_gunicorn_timeout
}}
{{
ANALYTICS_API_GUNICORN_EXTRA
}}
analyticsdataserver.wsgi:application
{{
executable
}}
-
c
{{
analytics_api_app_dir
}}
/analytics_api_gunicorn.py
{{
ANALYTICS_API_GUNICORN_EXTRA
}}
analyticsdataserver.wsgi:application
playbooks/roles/analytics-api/templates/edx/app/analytics-api/analytics_api_gunicorn.py.j2
0 → 100644
View file @
fa045f01
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
timeout = {{ analytics_api_gunicorn_timeout }}
bind = "{{ analytics_api_gunicorn_host }}:{{ analytics_api_gunicorn_port }}"
pythonpath = "{{ analytics_api_code_dir }}"
workers = {{ ANALYTICS_API_GUNICORN_WORKERS }}
{{ ANALYTICS_API_GUNICORN_EXTRA_CONF }}
playbooks/roles/edxapp/defaults/main.yml
View file @
fa045f01
...
...
@@ -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 @
fa045f01
...
...
@@ -60,6 +60,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 @
fa045f01
...
...
@@ -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 @
fa045f01
"""
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 @
fa045f01
...
...
@@ -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 @
fa045f01
"""
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 }}
playbooks/roles/ora/defaults/main.yml
View file @
fa045f01
...
...
@@ -2,6 +2,7 @@
---
ORA_NGINX_PORT
:
18060
ORA_GUNICORN_EXTRA
:
"
"
ORA_GUNICORN_EXTRA_CONF
:
"
"
ora_app_dir
:
"
{{
COMMON_APP_DIR
}}/ora"
ora_code_dir
:
"
{{
ora_app_dir
}}/ora"
...
...
playbooks/roles/ora/tasks/deploy.yml
View file @
fa045f01
...
...
@@ -19,6 +19,13 @@
with_items
:
[
'
ora'
,
'
ora_celery'
]
when
:
not disable_edx_services
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=ora_gunicorn.py.j2 dest={{ ora_app_dir }}/ora_gunicorn.py
sudo_user
:
"
{{
ora_user
}}"
notify
:
-
restart ora
-
include
:
ease.yml
-
name
:
create ora application config
...
...
playbooks/roles/ora/templates/ora.conf.j2
View file @
fa045f01
[program:ora]
command={{ ora_venv_bin }}/gunicorn -
-preload -b {{ ora_gunicorn_host }}:{{ ora_gunicorn_port }} -w {{ ora_gunicorn_workers }} --timeout=90 --pythonpath={{ ora_code_dir}}
{{ ORA_GUNICORN_EXTRA }} edx_ora.wsgi
command={{ ora_venv_bin }}/gunicorn -
c {{ ora_app_dir }}/ora_gunicorn.py
{{ ORA_GUNICORN_EXTRA }} edx_ora.wsgi
user={{ common_web_user }}
directory={{ ora_code_dir }}
...
...
playbooks/roles/ora/templates/ora_gunicorn.py.j2
0 → 100644
View file @
fa045f01
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
preload_app = True
timeout = 90
bind = "{{ ora_gunicorn_host }}:{{ ora_gunicorn_port }}"
pythonpath = "{{ ora_code_dir }}"
workers = {{ ora_gunicorn_workers }}
{{ ORA_GUNICORN_EXTRA_CONF }}
playbooks/roles/xqueue/defaults/main.yml
View file @
fa045f01
...
...
@@ -3,7 +3,7 @@
---
XQUEUE_NGINX_PORT
:
18040
XQUEUE_GUNICORN_WORKERS_EXTRA
:
"
"
XQUEUE_GUNICORN_
EXTRA
:
"
"
XQUEUE_GUNICORN_
WORKERS_EXTRA_CONF
:
"
"
XQUEUE_QUEUES
:
# push queue
'
edX-Open_DemoX'
:
'
http://localhost:18050'
...
...
playbooks/roles/xqueue/tasks/deploy.yml
View file @
fa045f01
...
...
@@ -13,6 +13,12 @@
with_items
:
[
'
xqueue'
,
'
xqueue_consumer'
]
when
:
not disable_edx_services
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=xqueue_gunicorn.py.j2 dest={{ xqueue_app_dir }}/xqueue_gunicorn.py
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
restart xqueue
-
name
:
create xqueue application config
template
:
src=xqueue.env.json.j2 dest={{ xqueue_app_dir }}/xqueue.env.json mode=0644
...
...
playbooks/roles/xqueue/templates/xqueue.conf.j2
View file @
fa045f01
...
...
@@ -6,15 +6,7 @@
{% set executable = xqueue_venv_bin + '/gunicorn' %}
{% endif %}
{% if XQUEUE_WORKERS -%}
command={{ executable }} --preload -b {{ xqueue_gunicorn_host }}:{{ xqueue_gunicorn_port }} -w {{ XQUEUE_WORKERS }} --timeout=300 --pythonpath={{ xqueue_code_dir }} {{ XQUEUE_GUNICORN_WORKERS_EXTRA }} xqueue.wsgi
{% else -%}
{% if ansible_processor|length > 0 %}
command={{ executable }} --preload -b {{ xqueue_gunicorn_host }}:{{ xqueue_gunicorn_port }} -w {{ ansible_processor|length * 2 }} --timeout=300 --pythonpath={{ xqueue_code_dir }} {{ XQUEUE_GUNICORN_EXTRA }} xqueue.wsgi
{% else -%}
command={{ executable }} --preload -b {{ xqueue_gunicorn_host }}:{{ xqueue_gunicorn_port }} -w 2 --timeout=300 --pythonpath={{ xqueue_code_dir }} {{ XQUEUE_GUNICORN_EXTRA }} xqueue.wsgi
{% endif -%}
{% endif -%}
command={{ executable }} -c {{ xqueue_app_dir }}/xqueue_gunicorn.py {{ XQUEUE_GUNICORN_WORKERS_EXTRA }} xqueue.wsgi
user={{ common_web_user }}
directory={{ xqueue_code_dir }}
...
...
playbooks/roles/xqueue/templates/xqueue_gunicorn.py.j2
0 → 100644
View file @
fa045f01
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
import multiprocessing
preload_app = True
timeout = 300
bind = "{{ xqueue_gunicorn_host }}:{{ xqueue_gunicorn_port }}"
pythonpath = "{{ xqueue_code_dir }}"
{% if XQUEUE_WORKERS %}
workers = {{ XQUEUE_WORKERS }}
{% else %}
workers = (multiprocessing.cpu_count()-1) * 2 + 2
{% endif %}
{{ XQUEUE_GUNICORN_WORKERS_EXTRA_CONF }}
playbooks/roles/xserver/defaults/main.yml
View file @
fa045f01
...
...
@@ -4,6 +4,7 @@
XSERVER_NGINX_PORT
:
18050
XSERVER_GUNICORN_EXTRA
:
"
"
XSERVER_GUNICORN_EXTRA_CONF
:
"
"
XSERVER_RUN_URL
:
'
'
XSERVER_LOGGING_ENV
:
'
sandbox'
XSERVER_SYSLOG_SERVER
:
'
'
...
...
playbooks/roles/xserver/tasks/deploy.yml
View file @
fa045f01
...
...
@@ -11,6 +11,13 @@
state=link force=yes
when
:
not disable_edx_services
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=xserver_gunicorn.py.j2 dest={{ xserver_app_dir }}/xserver_gunicorn.py
sudo_user
:
"
{{
xserver_user
}}"
notify
:
-
restart xserver
-
name
:
checkout code
git
:
>
dest={{ xserver_code_dir }} repo={{ xserver_source_repo }} version={{xserver_version}}
...
...
playbooks/roles/xserver/templates/xserver.conf.j2
View file @
fa045f01
[program:xserver]
command={{ xserver_venv_bin }}/gunicorn -
-preload -b {{ xserver_gunicorn_host }}:{{ xserver_gunicorn_port }} -w {{ xserver_gunicorn_workers }} --timeout=30 --pythonpath={{ xserver_code_dir }}
{{ XSERVER_GUNICORN_EXTRA }} pyxserver_wsgi:application
command={{ xserver_venv_bin }}/gunicorn -
c {{ xserver_app_dir }}/xserver_gunicorn.py
{{ XSERVER_GUNICORN_EXTRA }} pyxserver_wsgi:application
user={{ common_web_user }}
directory={{ xserver_code_dir }}
...
...
playbooks/roles/xserver/templates/xserver_gunicorn.py.j2
0 → 100644
View file @
fa045f01
"""
gunicorn configuration file: http://docs.gunicorn.org/en/develop/configure.html
{{ ansible_managed }}
"""
preload_app = True
timeout = 30
bind = "{{ xserver_gunicorn_host }}:{{ xserver_gunicorn_port }}"
pythonpath = "{{ xserver_code_dir }}"
workers = {{ xserver_gunicorn_workers }}
{{ XSERVER_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