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
1f0ae246
Commit
1f0ae246
authored
Oct 16, 2017
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more video worker role changes
parent
cb0ada46
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
78 deletions
+69
-78
playbooks/roles/video_worker/defaults/main.yml
+20
-25
playbooks/roles/video_worker/meta/main.yml
+6
-8
playbooks/roles/video_worker/tasks/main.yml
+20
-22
playbooks/roles/video_worker/templates/edx/app/ecomworker/ecomworker.sh.j2
+0
-18
playbooks/roles/video_worker/templates/edx/app/supervisor/conf.d.available/video_worker.conf.j2
+4
-4
playbooks/roles/video_worker/templates/edx/app/video_worker/video_worker.sh.j2
+18
-0
playbooks/roles/video_worker/templates/edx/app/video_worker/video_worker_env.j2
+1
-1
No files found.
playbooks/roles/video_worker/defaults/main.yml
View file @
1f0ae246
...
...
@@ -10,6 +10,20 @@
# Defaults for role video_worker.
#
video_worker_service_name
:
'
video_worker'
video_worker_user
:
'
{{
video_worker_service_name
}}'
video_worker_home
:
'
{{
COMMON_APP_DIR
}}/{{
video_worker_service_name
}}'
video_worker_code_dir
:
'
{{
video_worker_home
}}/{{
video_worker_service_name
}}'
video_worker_venv
:
'
{{
video_worker_home
}}/venvs/{{
video_worker_service_name
}}'
video_worker_venv_bin
:
'
{{
video_worker_home
}}/venvs/{{
video_worker_service_name
}}/bin'
video_worker_log_dir
:
'
{{
COMMON_LOG_DIR
}}/{{
video_worker_service_name
}}'
video_worker_environment
:
PATH
:
'
{{
video_worker_venv_bin
}}:{{
ansible_env.PATH
}}'
VIDEO_WORKER_CFG
:
"
{{
COMMON_CFG_DIR
}}/{{
video_worker_service_name
}}.yml"
PYTHONPATH
:
"
{{
video_worker_code_dir
}}"
VIDEO_WORKER_GIT_IDENTITY
:
!!null
VIDEO_WORKER_VERSION
:
'
master'
...
...
@@ -26,31 +40,12 @@ VIDEO_WORKER_REPOS:
# a key be provided via NEWRELIC_LICENSE_KEY.
VIDEO_WORKER_NEWRELIC_APPNAME
:
'
{{
COMMON_ENVIRONMENT
}}-{{
COMMON_DEPLOYMENT
}}-{{
video_worker_service_name
}}'
VIDEO_WORKER_BROKER_USERNAME
:
'
celery'
VIDEO_WORKER_BROKER_PASSWORD
:
'
celery'
# Used as the default RabbitMQ IP.
VIDEO_WORKER_BROKER_HOST
:
'
{{
ansible_default_ipv4.address
}}'
# Used as the default RabbitMQ port.
VIDEO_WORKER_BROKER_PORT
:
5672
VIDEO_WORKER_BROKER_URL
:
'
amqp://{{
VIDEO_WORKER_BROKER_USERNAME
}}:{{
VIDEO_WORKER_BROKER_PASSWORD
}}@{{
VIDEO_WORKER_BROKER_HOST
}}:{{
VIDEO_WORKER_BROKER_PORT
}}'
VIDEO_WORKER_CONCURRENCY
:
4
video_worker_environment
:
WORKER_CONFIGURATION_MODULE
:
'
video_worker.configuration.production'
video_worker_cfg
:
'
{{
COMMON_CFG_DIR
}}/{{
video_worker_service_name
}}.yml'
video_worker_service_name
:
'
video_worker'
video_worker_user
:
'
{{
video_worker_service_name
}}'
video_worker_home
:
'
{{
COMMON_APP_DIR
}}/{{
video_worker_service_name
}}'
video_worker_code_dir
:
'
{{
video_worker_home
}}/{{
video_worker_service_name
}}'
video_worker_log_dir
:
'
{{
COMMON_LOG_DIR
}}/{{
video_worker_service_name
}}'
VIDEO_WORKER_BROKER_USERNAME
:
'
video-worker'
VIDEO_WORKER_BROKER_PASSWORD
:
'
video-worker'
VIDEO_WORKER_BROKER_HOST
:
'
localhost'
video_worker_requirements_base
:
'
{{
video_worker_code_dir
}}/requirements'
video_worker_requirements
:
-
production.txt
-
optional.txt
VIDEO_WORKER_CONCURRENCY
:
'
SET-ME-PLEASE'
VIDEO_WORKER_QUEUES
:
'
SET-ME-PLEASE'
# OS packages
video_worker_debian_pkgs
:
[]
oe
video_worker_redhat_pkgs
:
[]
VIDEO_WORKER_DEBIAN_PKGS
:
[
'
ffmpeg'
]
playbooks/roles/video_worker/meta/main.yml
View file @
1f0ae246
...
...
@@ -14,12 +14,10 @@ dependencies:
-
common
-
supervisor
-
role
:
edx_service
edx_service_name
:
"
{{
ecommerce
_worker_service_name
}}"
edx_service_config
:
"
{{
ECOMMERCE
_WORKER_SERVICE_CONFIG
}}"
edx_service_repos
:
"
{{
ECOMMERCE
_WORKER_REPOS
}}"
edx_service_user
:
"
{{
ecommerce
_worker_user
}}"
edx_service_home
:
"
{{
ecommerce
_worker_home
}}"
edx_service_name
:
"
{{
video
_worker_service_name
}}"
edx_service_config
:
"
{{
VIDEO
_WORKER_SERVICE_CONFIG
}}"
edx_service_repos
:
"
{{
VIDEO
_WORKER_REPOS
}}"
edx_service_user
:
"
{{
video
_worker_user
}}"
edx_service_home
:
"
{{
video
_worker_home
}}"
edx_service_packages
:
debian
:
"
{{
ecommerce_worker_debian_pkgs
}}"
redhat
:
"
{{
ecommerce_worker_redhat_pkgs
}}"
debian
:
"
{{
video_worker_debian_pkgs
}}"
playbooks/roles/video_worker/tasks/main.yml
View file @
1f0ae246
...
...
@@ -7,24 +7,23 @@
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
# Tasks for role
ecommerce
_worker.
#
# Tasks for role
video
_worker.
#
-
name
:
install application requirements
pip
:
requirements
:
'
{{
ecommerce_worker_requirements_base
}}/{{
item
}}
'
virtualenv
:
'
{{
ecommerce_worker_home
}}/venvs/{{
ecommerce_worker_service_name
}}'
requirements
:
'
{{
video_worker_code_dir
}}/requirements.txt
'
virtualenv
:
'
{{
video_worker_venv
}}'
state
:
present
become_user
:
'
{{
ecommerce_worker_user
}}'
with_items
:
"
{{
ecommerce_worker_requirements
}}"
become_user
:
'
{{
video_worker_user
}}'
tags
:
-
install
-
install:app-requirements
-
name
:
write out the supervisor wrapper
template
:
src
:
edx/app/
ecomworker/ecom
worker.sh.j2
dest
:
'
{{
ecommerce_worker_home
}}/{{
ecommerce
_worker_service_name
}}.sh'
src
:
edx/app/
video_worker/video_
worker.sh.j2
dest
:
'
{{
video_worker_home
}}/{{
video
_worker_service_name
}}.sh'
mode
:
0650
owner
:
'
{{
supervisor_user
}}'
group
:
'
{{
common_web_user
}}'
...
...
@@ -32,10 +31,10 @@
-
install
-
install:configuration
-
name
:
write supervisord config
-
name
:
write
video worker
supervisord config
template
:
src
:
edx/app/supervisor/conf.d.available/
ecom
worker.conf.j2
dest
:
'
{{
supervisor_available_dir
}}/{{
ecommerce
_worker_service_name
}}.conf'
src
:
edx/app/supervisor/conf.d.available/
video_
worker.conf.j2
dest
:
'
{{
supervisor_available_dir
}}/{{
video
_worker_service_name
}}.conf'
owner
:
'
{{
supervisor_user
}}'
group
:
'
{{
common_web_user
}}'
mode
:
0644
...
...
@@ -43,12 +42,12 @@
-
install
-
install:configuration
-
name
:
setup the
ecommerce
_worker env file
-
name
:
setup the
video
_worker env file
template
:
src
:
'
./{{
ecommerce_worker_home
}}/ecomworker_env.j2'
dest
:
'
{{
ecommerce_worker_home
}}/ecomworker_env'
owner
:
'
{{
ecommerce_worker_user
}}'
group
:
'
{{
ecommerce_worker_user
}}'
src
:
"
edx/app/video_worker/video_worker_env.j2"
dest
:
"
{{
edx_django_service_home
}}/{{
edx_django_service_name
}}_env"
owner
:
"
{{
edx_django_service_user
}}"
group
:
"
{{
edx_django_service_user
}}"
mode
:
0644
tags
:
-
install
...
...
@@ -56,8 +55,8 @@
-
name
:
enable supervisor script
file
:
src
:
'
{{
supervisor_available_dir
}}/{{
ecommerce
_worker_service_name
}}.conf'
dest
:
'
{{
supervisor_cfg_dir
}}/{{
ecommerce
_worker_service_name
}}.conf'
src
:
'
{{
supervisor_available_dir
}}/{{
video
_worker_service_name
}}.conf'
dest
:
'
{{
supervisor_cfg_dir
}}/{{
video
_worker_service_name
}}.conf'
state
:
link
force
:
yes
when
:
not disable_edx_services
...
...
@@ -72,11 +71,10 @@
-
manage
-
manage:start
-
name
:
create symlinks from the venv bin dir
file
:
src
:
'
{{
ecommerce_worker_home
}}/venvs/{{
ecommerce_worker_service_name
}}/bin
/{{
item
}}'
dest
:
'
{{
COMMON_BIN_DIR
}}/{{
item
}}.
ecommerce
_worker'
src
:
'
{{
video_worker_venv_bin
}}
/{{
item
}}'
dest
:
'
{{
COMMON_BIN_DIR
}}/{{
item
}}.
video
_worker'
state
:
link
with_items
:
-
python
...
...
@@ -90,7 +88,7 @@
state
:
restarted
supervisorctl_path
:
'
{{
supervisor_ctl
}}'
config
:
'
{{
supervisor_cfg
}}'
name
:
'
{{
ecommerce
_worker_service_name
}}'
name
:
'
{{
video
_worker_service_name
}}'
when
:
not disable_edx_services
become_user
:
'
{{
supervisor_service_user
}}'
tags
:
...
...
playbooks/roles/video_worker/templates/edx/app/ecomworker/ecomworker.sh.j2
deleted
100644 → 0
View file @
cb0ada46
#!/usr/bin/env bash
# {{ ansible_managed }}
{
%
set
ecommerce_worker_venv_bin
=
ecommerce_worker_home +
'/venvs/'
+ ecommerce_worker_service_name +
'/bin'
%
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
{
%
set
executable
=
ecommerce_worker_venv_bin +
'/newrelic-admin run-program '
+ ecommerce_worker_venv_bin +
'/celery'
%
}
{
%
else
%
}
{
%
set
executable
=
ecommerce_worker_venv_bin +
'/celery'
%
}
{
% endif %
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
export
NEW_RELIC_APP_NAME
=
'{{ ECOMMERCE_WORKER_NEWRELIC_APPNAME }}'
export
NEW_RELIC_LICENSE_KEY
=
'{{ NEWRELIC_LICENSE_KEY }}'
{
% endif -%
}
source
{{
ecommerce_worker_home
}}
/
{{
ecommerce_worker_service_name
}}
_env
{{
executable
}}
-A
ecommerce_worker worker
--app
ecommerce_worker.celery_app:app
--concurrency
={{
ECOMMERCE_WORKER_CONCURRENCY
}}
--loglevel
=
info
--queue
=
fulfillment,email_marketing
playbooks/roles/video_worker/templates/edx/app/supervisor/conf.d.available/
ecom
worker.conf.j2
→
playbooks/roles/video_worker/templates/edx/app/supervisor/conf.d.available/
video_
worker.conf.j2
View file @
1f0ae246
#
# {{ ansible_managed }}
#
[program:{{
ecommerce
_worker_service_name }}]
#
[program:{{
video
_worker_service_name }}]
command={{
ecommerce_worker_home }}/{{ ecommerce
_worker_service_name }}.sh
command={{
video_worker_home }}/{{ video
_worker_service_name }}.sh
user={{ common_web_user }}
directory={{
ecommerce
_worker_code_dir }}
directory={{
video
_worker_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
...
...
playbooks/roles/video_worker/templates/edx/app/video_worker/video_worker.sh.j2
0 → 100644
View file @
1f0ae246
#!/usr/bin/env bash
# {{ ansible_managed }}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
{
%
set
executable
=
{{
video_worker_venv_bin
}}
+
'/newrelic-admin run-program '
+
{{
video_worker_venv_bin
}}
+
'/celery'
%
}
{
%
else
%
}
{
%
set
executable
=
{{
video_worker_venv_bin
}}
+
'/celery'
%
}
{
% endif %
}
{
%
if
COMMON_ENABLE_NEWRELIC_APP %
}
export
NEW_RELIC_APP_NAME
=
'{{ VIDEO_WORKER_NEWRELIC_APPNAME }}'
export
NEW_RELIC_LICENSE_KEY
=
'{{ NEWRELIC_LICENSE_KEY }}'
{
% endif -%
}
source
{{
video_worker_home
}}
/
{{
video_worker_service_name
}}
_env
{{
executable
}}
--app
video_worker.celeryapp:app
--concurrency
={{
VIDEO_WORKER_CONCURRENCY
}}
-Q
{{
VIDEO_WORKER_QUEUES
}}
-n
worker.%h
playbooks/roles/video_worker/templates/edx/app/
ecomworker/ecom
worker_env.j2
→
playbooks/roles/video_worker/templates/edx/app/
video_worker/video_
worker_env.j2
View file @
1f0ae246
# {{ ansible_managed }}
{% for name,value in
ecommerce
_worker_environment.items() -%}
{% for name,value in
video
_worker_environment.items() -%}
{%- if value -%}
export {{ name }}="{{ value }}"
{% endif %}
...
...
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