Skip to main content

Celery-beat and celery asynchronous running in daemon mode in Open-edX.

1. EDX production celery_beat configuration:


       
        cd /edx/app/supervisor/conf.available.d
sudo nano  celery_beat_worker.conf

Its content:
____________________________
[program:celery_beat_worker]

directory=/edx/app/edxapp/edx-platform
environment=DJANGO_SETTINGS_MODULE=lms.envs.aws,SERVICE_VARIANT="lms",PATH="/edx/app/       edxapp/venvs/edxapp/bin:/edx/app/edxapp/edx-platform/bin:/edx/app/edxapp/edx-platform/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

user=www-data
stdout_logfile=/edx/var/log/supervisor/%(program_name)s-stdout.log
stderr_logfile=/edx/var/log/supervisor/%(program_name)s-stderr.log
autostart=true
autorestart=true
command=/edx/app/celery_beat_script/celery_beat.sh

_________________________________________

sudo chown www-data:www-data  celery_beat_worker.conf

sudo ln -s /edx/app/supervisor/conf.available.d/celery_beat_worker.conf /edx/app/supervisor/conf.d/celery_beat_worker.conf 

cd /edx/var/log/supervisor

If logs are not created then create them:

sudo nano /edx/var/log/supervisor/celery_beat_worker-stdout.log
sudo nano /edx/var/log/supervisor/celery_beat_worker-stderr.log

sudo chown www-data:www-data /edx/var/log/supervisor/celery_beat_worker-stdout.log
sudo chown www-data:www-data /edx/var/log/supervisor/celery_beat_worker-stderr.log

cd /edx/app/
mkdir celery_beat_script

nano celery_beat.sh

Its content :

--------------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash

source /edx/app/edxapp/edxapp_env
source /edx/app/edxapp/venvs/edxapp/bin/activate
cd /edx/app/edxapp/edx-platform
exec /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms --settings=aws celerybeat --schedule="/edx/app/celery_beat_script/temp_file" --pidfile=

___________________________________________-----------------------------------------------------------

sudo chmod 777 celery_beat.sh

sudo nano temp_file   (set 644 permission)

cd ..
sudo chmod  777 /edx/app/celery_beat_script

(The permission folder celery_beat_script are 777 for now but should be set to more standard access)

 sudo /edx/app/supervisor/venvs/supervisor/bin/supervisorctl reread
 sudo /edx/app/supervisor/venvs/supervisor/bin/supervisorctl update

-------===================================================================================================

2. EDX production celery_async configuration:

        cd /edx/app/supervisor/conf.available.d
sudo nano  celery_async_worker.conf

Its content:
____________________________
[program:celery_async_worker]

directory=/edx/app/edxapp/edx-platform/
environment=DJANGO_SETTINGS_MODULE=lms.envs.aws,SERVICE_VARIANT="lms",PATH="/edx/app/edxapp/venvs/edxapp/bin:/edx/app/edxapp/edx-platform/bin:/edx/app/edxapp/edx-platform/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
user=www-data
stdout_logfile=/edx/var/log/supervisor/%(program_name)s-stdout.log
stderr_logfile=/edx/var/log/supervisor/%(program_name)s-stderr.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 1000
command=/edx/app/celery_beat_script/celery_async.sh
_________________________________________


sudo chown www-data:www-data  celery_async_worker.conf
sudo ln -s /edx/app/supervisor/conf.available.d/celery_async_worker.conf /edx/app/supervisor/conf.d/  celery_async_worker.conf 
cd /edx/var/log/supervisor

If logs are not created then create them:
------------------------------------------------------------------------
sudo nano /edx/var/log/supervisor/celery_async_worker-stdout.log
sudo nano /edx/var/log/supervisor/celery_async_worker-stderr.log

sudo chown www-data:www-data /edx/var/log/supervisor/celery_async_worker-stdout.log
sudo chown www-data:www-data /edx/var/log/supervisor/celery_async_worker-stderr.log
-------------------------------------------------------------------------------------

cd /edx/app/celery_beat_script/
nano celery_async.sh

Its content :
------------------------------------------------------------------------------------------------------------------------------------
#!/bin/bash
source /edx/app/edxapp/edxapp_env
source /edx/app/edxapp/venvs/edxapp/bin/activate
cd /edx/app/edxapp/edx-platform
exec /edx/app/edxapp/venvs/edxapp/bin/python /edx/app/edxapp/edx-platform/manage.py lms celery worker -A lms --loglevel=info --concurrency=5 --settings=aws  --pidfile=
___________________________________________-------------------------------------------------------

sudo chmod 777 celery_async.sh
sudo nano temp_file   (set 644 permission)

cd ..
sudo chmod  777 /edx/app/celery_beat_script

(The permission folder celery_beat_script are 777 for now but should be set to more standard access)

 sudo /edx/app/supervisor/venvs/supervisor/bin/supervisorctl reread
 sudo /edx/app/supervisor/venvs/supervisor/bin/supervisorctl update

Popular posts from this blog

How to read or extract text data from passport using python utility.

Hi ,  Lets get start with some utility which can be really helpful in extracting the text data from passport documents which can be images, pdf.  So instead of jumping to code directly lets understand the MRZ, & how it works basically. MRZ Parser :                 A machine-readable passport (MRP) is a machine-readable travel document (MRTD) with the data on the identity page encoded in optical character recognition format Most travel passports worldwide are MRPs.  It can have 2 lines or 3 lines of machine-readable data. This method allows to process MRZ written in accordance with ICAO Document 9303 (endorsed by the International Organization for Standardization and the International Electrotechnical Commission as ISO/IEC 7501-1)). Some applications will need to be able to scan such data of someway, so one of the easiest methods is to recognize it from an image file. I 'll show you how to retrieve the MRZ infor...

How to generate class diagrams pictures in a Django/Open-edX project from console

A class diagram in the Unified Modeling Language ( UML ) is a type of static structure diagram that describes the structure of a system by showing the system’s classes, their attributes, operations (or methods), and the relationships among objects. https://github.com/django-extensions/django-extensions Step 1:   Install django extensions Command:  pip install django-extensions Step 2:  Add to installed apps INSTALLED_APPS = ( ... 'django_extensions' , ... ) Step 3:  Install diagrams generators You have to choose between two diagram generators: Graphviz or Dotplus before using the command or you will get: python manage.py graph_models -a -o myapp_models.png Note:  I prefer to use   pydotplus   as it easier to install than Graphviz and its dependencies so we use   pip install pydotplus . Command:  pip install pydotplus Step 4:  Generate diagrams Now we have everything installed...

Open edX Step-By-Step Production Installation Guide

Get your first Open edX platform up and running with this detailed step-by-step how-to guide that provides detailed instructions on how to build your AWS EC2 Ubuntu Linux server, execute the Open edX native build scripts, and configure your new platform. The first time I installed an instance of Open edX, in many ways I felt like I was on the outside looking in. The project documentation that exists is very good, but, it assumes an extensive knowledge base that, at the time, I lacked. This article attempts to fill in some of the gaps in that knowledge base, and hopefully, make the Open edX platform more accessible. Note: this article references Bash scripts that are located in this Github repository: https://github.com/lpm0073/edx.ginkgo This is a step-by-step fully automated script to stand up a single-server full-stack production-ready instance of Open edX running on an Amazon Web Services (AWS) EC2 (Elastic Compute Cloud — aka virtual server) R3.Large instance (aka 2-cpu ser...