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
edx
configuration
Commits
bb70c002
Unverified
Commit
bb70c002
authored
May 24, 2018
by
Fred Smith
Committed by
GitHub
May 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4561 from edx/derf/update_nr_display_name_to_instanceid_on_aws
update nr display name to instanceid on aws
parents
5a065778
02874323
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
142 additions
and
19 deletions
+142
-19
playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2
+5
-0
playbooks/roles/edxapp/tasks/deploy.yml
+15
-0
playbooks/roles/edxapp/tasks/service_variant_config.yml
+2
-2
playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
+32
-0
playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
+33
-0
playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
+18
-0
playbooks/roles/edxapp/templates/edx/app/supervisor/conf.d.available/cms.conf.j2
+1
-7
playbooks/roles/edxapp/templates/edx/app/supervisor/conf.d.available/edxapp.conf.j2
+0
-0
playbooks/roles/edxapp/templates/edx/app/supervisor/conf.d.available/lms.conf.j2
+1
-8
playbooks/roles/edxapp/templates/edx/app/supervisor/conf.d.available/workers.conf.j2
+2
-2
playbooks/roles/newrelic_infrastructure/files/edx/bin/write_nr_display_name_config.sh
+18
-0
playbooks/roles/newrelic_infrastructure/tasks/main.yml
+15
-0
No files found.
playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2
View file @
bb70c002
...
...
@@ -12,6 +12,11 @@
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
export
NEW_RELIC_APP_NAME
=
"{{ edx_django_service_newrelic_appname }}"
if
command
-v
ec2metadata
>
/dev/null 2>&1
;
then
INSTANCEID
=
$(
ec2metadata
--instance-id
)
;
HOSTNAME
=
$(
hostname
)
export
NEW_RELIC_PROCESS_HOST_DISPLAY_NAME
=
"
$HOSTNAME
-
$INSTANCEID
"
fi
export
NEW_RELIC_LICENSE_KEY
=
"{{ NEWRELIC_LICENSE_KEY }}"
{
% endif -%
}
...
...
playbooks/roles/edxapp/tasks/deploy.yml
View file @
bb70c002
...
...
@@ -310,6 +310,21 @@
-
install
-
install:code
-
name
:
"
create
service
wrapper
scripts
-
{{item}}"
template
:
dest
:
"
{{
edxapp_app_dir
}}/{{item}}"
src
:
"
edx/app/edxapp/{{item}}.j2"
owner
:
"
{{
edxapp_user
}}"
group
:
"
{{
common_web_group
}}"
mode
:
"
og+rx"
with_items
:
-
"
lms.sh"
-
"
cms.sh"
-
"
worker.sh"
tags
:
-
install
-
install:configuration
# creates the supervisor jobs for the
# service variants configured, runs
# gather_assets and db migrations
...
...
playbooks/roles/edxapp/tasks/service_variant_config.yml
View file @
bb70c002
...
...
@@ -19,7 +19,7 @@
# write the supervisor scripts for the service variants
-
name
:
"
writing
{{
item
}}
supervisor
script"
template
:
src
:
"
{{
item
}}.conf.j2"
src
:
"
edx/app/supervisor/conf.d.available/
{{
item
}}.conf.j2"
dest
:
"
{{
supervisor_available_dir
}}/{{
item
}}.conf"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
supervisor_user
}}"
...
...
@@ -33,7 +33,7 @@
# write the supervisor script for edxapp and celery workers
-
name
:
writing edxapp and celery supervisor scripts
template
:
src
:
"
{{
item
}}.j2"
src
:
"
edx/app/supervisor/conf.d.available/
{{
item
}}.j2"
dest
:
"
{{
supervisor_available_dir
}}/{{
item
}}"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
supervisor_user
}}"
...
...
playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
0 → 100644
View file @
bb70c002
#!/usr/bin/env bash
# {{ ansible_managed }}
{
%
set
edxapp_venv_bin
=
edxapp_venv_dir +
"/bin"
%
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
{
%
set
executable
=
edxapp_venv_bin +
'/newrelic-admin run-program '
+ edxapp_venv_bin +
'/gunicorn'
%
}
export
NEW_RELIC_APP_NAME
=
"{{ EDXAPP_NEWRELIC_CMS_APPNAME }}"
export
NEW_RELIC_CONFIG_FILE
=
"{{ edxapp_app_dir }}/newrelic.ini"
if
command
-v
ec2metadata
>
/dev/null 2>&1
;
then
INSTANCEID
=
$(
ec2metadata
--instance-id
)
;
HOSTNAME
=
$(
hostname
)
export
NEW_RELIC_PROCESS_HOST_DISPLAY_NAME
=
"
$HOSTNAME
-
$INSTANCEID
"
fi
export
NEW_RELIC_LICENSE_KEY
=
"{{ NEWRELIC_LICENSE_KEY }}"
{
%
else
%
}
{
%
set
executable
=
edxapp_venv_bin +
'/gunicorn'
%
}
{
% endif %
}
export
PORT
=
"{{ edxapp_cms_gunicorn_port }}"
export
ADDRESS
=
"{{ edxapp_cms_gunicorn_host }}"
export
LANG
=
"{{ EDXAPP_LANG }}"
export
DJANGO_SETTINGS_MODULE
=
"{{ EDXAPP_CMS_ENV }}"
export
SERVICE_VARIANT
=
"cms"
export
PATH
=
"{{ edxapp_deploy_path }}"
export
BOTO_CONFIG
=
"{{ edxapp_app_dir }}/.boto"
source
{{
edxapp_app_dir
}}
/edxapp_env
{{
executable
}}
-c
{{
edxapp_app_dir
}}
/cms_gunicorn.py
{{
EDXAPP_CMS_GUNICORN_EXTRA
}}
cms.wsgi
playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
0 → 100644
View file @
bb70c002
#!/usr/bin/env bash
# {{ ansible_managed }}
{
%
set
edxapp_venv_bin
=
edxapp_venv_dir +
"/bin"
%
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
{
%
set
executable
=
edxapp_venv_bin +
'/newrelic-admin run-program '
+ edxapp_venv_bin +
'/gunicorn'
%
}
export
NEW_RELIC_APP_NAME
=
"{{ EDXAPP_NEWRELIC_LMS_APPNAME }}"
export
NEW_RELIC_CONFIG_FILE
=
"{{ edxapp_app_dir }}/newrelic.ini"
if
command
-v
ec2metadata
>
/dev/null 2>&1
;
then
INSTANCEID
=
$(
ec2metadata
--instance-id
)
;
HOSTNAME
=
$(
hostname
)
export
NEW_RELIC_PROCESS_HOST_DISPLAY_NAME
=
"
$HOSTNAME
-
$INSTANCEID
"
fi
export
NEW_RELIC_LICENSE_KEY
=
"{{ NEWRELIC_LICENSE_KEY }}"
{
%
else
%
}
{
%
set
executable
=
edxapp_venv_bin +
'/gunicorn'
%
}
{
% endif -%
}
export
PORT
=
"{{ edxapp_lms_gunicorn_port }}"
export
ADDRESS
=
"{{ edxapp_lms_gunicorn_host }}"
export
LANG
=
"{{ EDXAPP_LANG }}"
export
DJANGO_SETTINGS_MODULE
=
"{{ EDXAPP_LMS_ENV }}"
export
SERVICE_VARIANT
=
"lms"
export
PATH
=
"{{ edxapp_deploy_path }}"
export
BOTO_CONFIG
=
"{{ edxapp_app_dir }}/.boto"
source
{{
edxapp_app_dir
}}
/edxapp_env
{{
executable
}}
-c
{{
edxapp_app_dir
}}
/lms_gunicorn.py lms.wsgi
playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
0 → 100644
View file @
bb70c002
#!/usr/bin/env bash
# {{ ansible_managed }}
{
%
set
edxapp_venv_bin
=
edxapp_venv_dir +
"/bin"
%
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
{
%
set
executable
=
edxapp_venv_bin +
'/newrelic-admin run-program '
+ edxapp_venv_bin +
'/python'
%
}
export
NEW_RELIC_CONFIG_FILE
=
"{{ edxapp_app_dir }}/newrelic.ini"
if
command
-v
ec2metadata
>
/dev/null 2>&1
;
then
INSTANCEID
=
$(
ec2metadata
--instance-id
)
;
HOSTNAME
=
$(
hostname
)
export
NEW_RELIC_PROCESS_HOST_DISPLAY_NAME
=
"
$HOSTNAME
-
$INSTANCEID
"
fi
{
%
else
%
}
{
%
set
executable
=
edxapp_venv_bin +
'/python'
%
}
{
% endif %
}
{{
executable
}}
{{
edxapp_code_dir
}}
/manage.py
$@
playbooks/roles/edxapp/templates/cms.conf.j2
→
playbooks/roles/edxapp/templates/
edx/app/supervisor/conf.d.available/
cms.conf.j2
View file @
bb70c002
[program:cms]
{% if COMMON_ENABLE_NEWRELIC_APP -%}
{% set executable = edxapp_venv_dir + '/bin/newrelic-admin run-program ' + edxapp_venv_dir + '/bin/gunicorn' -%}
{% else -%}
{% set executable = edxapp_venv_dir + '/bin/gunicorn' -%}
{% endif -%}
command={{ e
xecutable }} -c {{ edxapp_app_dir }}/cms_gunicorn.py {{ EDXAPP_CMS_GUNICORN_EXTRA }} cms.wsgi
command={{ e
dxapp_app_dir }}/cms.sh
user={{ common_web_user }}
directory={{ edxapp_code_dir }}
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_CMS_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}PORT={{ edxapp_cms_gunicorn_port }},ADDRESS={{ edxapp_cms_gunicorn_host }},LANG={{ EDXAPP_LANG }},DJANGO_SETTINGS_MODULE={{ EDXAPP_CMS_ENV }},SERVICE_VARIANT="cms",BOTO_CONFIG="{{ edxapp_app_dir }}/.boto"
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
...
...
playbooks/roles/edxapp/templates/edxapp.conf.j2
→
playbooks/roles/edxapp/templates/edx
/app/supervisor/conf.d.available/edx
app.conf.j2
View file @
bb70c002
File moved
playbooks/roles/edxapp/templates/lms.conf.j2
→
playbooks/roles/edxapp/templates/
edx/app/supervisor/conf.d.available/
lms.conf.j2
View file @
bb70c002
[program:lms]
{% if COMMON_ENABLE_NEWRELIC_APP -%}
{% set executable = edxapp_venv_dir + '/bin/newrelic-admin run-program ' + edxapp_venv_dir + '/bin/gunicorn' -%}
{% else -%}
{% set executable = edxapp_venv_dir + '/bin/gunicorn' -%}
{% endif -%}
command={{ executable }} -c {{ edxapp_app_dir }}/lms_gunicorn.py lms.wsgi
command={{ edxapp_app_dir }}/lms.sh
user={{ common_web_user }}
directory={{ edxapp_code_dir }}
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_LMS_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},NEW_RELIC_CONFIG_FILE={{ edxapp_app_dir }}/newrelic.ini,{% endif -%} PORT={{ edxapp_lms_gunicorn_port }},ADDRESS={{ edxapp_lms_gunicorn_host }},LANG={{ EDXAPP_LANG }},DJANGO_SETTINGS_MODULE={{ EDXAPP_LMS_ENV }},SERVICE_VARIANT="lms",PATH="{{ edxapp_deploy_path }}",BOTO_CONFIG="{{ edxapp_app_dir }}/.boto"
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
...
...
playbooks/roles/edxapp/templates/workers.conf.j2
→
playbooks/roles/edxapp/templates/
edx/app/supervisor/conf.d.available/
workers.conf.j2
View file @
bb70c002
{% for w in edxapp_workers %}
[program:{{ w.service_variant }}_{{ w.queue }}_{{ w.concurrency }}]
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_WORKERS_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}CONCURRENCY={{ w.concurrency }},LOGLEVEL=info,DJANGO_SETTINGS_MODULE={{ worker_django_settings_module }},LANG={{ EDXAPP_LANG }},PYTHONPATH={{ edxapp_code_dir }},SERVICE_VARIANT={{ w.service_variant }},BOTO_CONFIG="{{ edxapp_app_dir }}/.boto"
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ EDXAPP_NEWRELIC_WORKERS_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}CONCURRENCY={{ w.concurrency }},LOGLEVEL=info,DJANGO_SETTINGS_MODULE={{ worker_django_settings_module }},LANG={{ EDXAPP_LANG }},PYTHONPATH={{ edxapp_code_dir }},SERVICE_VARIANT={{ w.service_variant }},BOTO_CONFIG="{{ edxapp_app_dir }}/.boto
,
"
user={{ common_web_user }}
directory={{ edxapp_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
command={{ edxapp_
venv_dir + '/bin/newrelic-admin run-program ' if w.monitor and COMMON_ENABLE_NEWRELIC_APP else ''}}{{ edxapp_venv_bin }}/python {{ edxapp_code_dir }}/manage.py
{{ w.service_variant }} --settings={{ worker_django_settings_module }} celery worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--maxtasksperchild ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }}
command={{ edxapp_
app_dir }}/worker.sh
{{ w.service_variant }} --settings={{ worker_django_settings_module }} celery worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--maxtasksperchild ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }}
killasgroup=true
stopwaitsecs={{ w.stopwaitsecs | default(EDXAPP_WORKER_DEFAULT_STOPWAITSECS) }}
; Set autorestart to `true`. The default value for autorestart is `unexpected`, but celery < 4.x will exit
...
...
playbooks/roles/newrelic_infrastructure/files/edx/bin/write_nr_display_name_config.sh
0 → 100644
View file @
bb70c002
#! /usr/bin/env bash
if
command
-v
ec2metadata
>
/dev/null 2>&1
;
then
INSTANCEID
=
$(
ec2metadata
--instance-id
)
;
HOSTNAME
=
$(
hostname
)
DISPLAY_NAME
=
"
$HOSTNAME
-
$INSTANCEID
"
if
[[
-f
/etc/newrelic/nrsysmond.cfg
]]
;
then
sudo
sed
-i
's/^hostname=.*//g'
/etc/newrelic/nrsysmond.cfg
echo
"hostname=
\"
$DISPLAY_NAME
\"
"
|
sudo
tee
-a
/etc/newrelic/nrsysmond.cfg
sudo
service newrelic-sysmond restart
fi
if
[[
-f
/etc/newrelic-infra.yml
]]
;
then
sudo
sed
-i
's/^display_name: .*//g'
/etc/newrelic-infra.yml
echo
"display_name:
\"
$DISPLAY_NAME
\"
"
|
sudo
tee
-a
/etc/newrelic-infra.yml
sudo
service newrelic-infra restart
fi
fi
playbooks/roles/newrelic_infrastructure/tasks/main.yml
View file @
bb70c002
...
...
@@ -81,6 +81,21 @@
-
install:app-requirements
when
:
ansible_distribution == 'Amazon'
-
name
:
Install newrelic display name script
copy
:
src
:
"
edx/bin/write_nr_display_name_config.sh"
dest
:
"
/edx/bin/write_nr_display_name_config.sh"
owner
:
root
group
:
root
mode
:
u=rwx,g=r,o=r
-
name
:
Run newrelic display name script on boot
lineinfile
:
path
:
"
/etc/rc.local"
line
:
"
/edx/bin/write_nr_display_name_config.sh"
insertbefore
:
"
exit
0"
mode
:
"
u+x,g+x"
-
name
:
Restart the infrastructure agent if the license key changes
service
:
name
:
newrelic-infra
...
...
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