配置LMS/Studio SMTP

  • 涉及文檔
<code>/edx/app/edxapp/lms.env.json #|env文件 裏包含一些功能開關
/edx/app/edxapp/cms.env.json #|
/edx/app/edxapp/lms.auth.json #|auth 文件包含一些密碼 權限相關
/edx/app/edxapp/cms.auth.json #|
</code>
  • 切換至 edxapp 帳戶,並加載對應環境變量
<code class="shell">sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/
</code>
  • 修改 (*)ms.env.json
<code>"EMAIL_HOST": "smtp.iflab.org",
"EMAIL_PORT": 25,
"EMAIL_USE_TLS": true,
</code>

 諸多緣由,不推薦騰訊企業郵箱python

  • 修改 (*)ms.auth.json
<code>"EMAIL_HOST_USER": "*****",
"EMAIL_HOST_PASSWORD":"*****",
</code>
  • 而後重啓 edxapp:
<code class="shell">sudo /edx/bin/supervisorctl restart edxapp:
</code>

 通常狀況使用默認的本地 smtp 服務,絕對會被攔截

mysql

更換域名

  • 切換至 edxapp 帳戶,並加載對應環境變量
<code class="shell">sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/
</code>
  • 修改 (*)ms.env.json
<code>"CMS_BASE": "studio.edustack.net",
"PREVIEW_LMS_BASE": "lms.mnu.cn",
"LMS_BASE": "mooc.mnu.cn",
"SITE_NAME": "mooc.mnu.cn",
</code>

 若是收到郵件爲localhost,則是此處 SITE_NAME 參數未修改正確nginx

  • 而後重啓 edxapp:
<code class="shell">sudo /edx/bin/supervisorctl restart edxapp:
</code>

 

 

更換網站名

  • 切換至 edxapp 帳戶,並加載對應環境變量
<code class="shell">sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/
</code>
  • 修改 (*)ms.env.json
<code>"PLATFORM_NAME": "eduX",
</code>

 暫不建議中文名字。

git

i18n/漢化

  • 切換至 edxapp 帳戶,並加載對應環境變量
<code class="shell">sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/
</code>
  • 修改 (*)ms.env.json
<code>"LANGUAGE_CODE": "zh-cn",
</code>
  • 手動更新assets
<code>sudo /edx/bin/edxapp-update-assets-lms
sudo /edx/bin/edxapp-update-assets-cms
</code>
  • 而後重啓 edxapp:
<code class="shell">sudo /edx/bin/supervisorctl restart edxapp:
</code>

 此處只調用官方release 翻譯包

github

加載主題

  • 切換至 edxapp 帳戶,並加載對應環境變量
<code>sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/
</code>
  • 克隆主題至 /edx/app/edxapp/themes
<code>cd /edx/app/edxapp/themes
git clone https://github.com/eduStack/eduStack-theme.git
</code>
  • 修改 (*)ms.env.json
<code>"USE_CUSTOM_THEME": true
"THEME_NAME": "eduStack-theme",
</code>
  • 手動更新assets
<code>sudo /edx/bin/edxapp-update-assets-lms
sudo /edx/bin/edxapp-update-assets-cms
</code>
  • 而後重啓 edxapp:
<code class="shell">sudo /edx/bin/supervisorctl restart edxapp:
</code>

 

 

修改證書下載地址

  • 切換至 certs 帳戶
<code class="shell">sudo -u certs bash
cd /edx/app/certs
</code>
  • 修改 env.json
<code>"CERT_DOWNLOAD_URL": "http://www.edustack.net:18090",
"CERT_URL": "http://www.edustack.net:18090",
"CERT_VERIFY_URL": "http://www.edustack.net:18090",
</code>

 不要輕易更換端口。如若更換請記得更換 nginx 配置sql

  • 而後重啓 certs
<code class="shell">sudo /edx/bin/supervisorctl restart certs
</code>

 

 

一些管理命令

  • 列出全部 manage.py 命令參數(/edx/app/edxapp/edx-platform
<code>sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms --settings aws
</code>
  • 創建一個超級帳戶
<code>sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms --settings aws create_user -e iflab@bistu.edu.cn
sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp lms --settings aws changepassword iflab
sudo /edx/bin/edxapp-shell-lms aws
</code>
<code>from django.contrib.auth.models import User
me = User.objects.get(username="iflab")
me.is_superuser - True
me.is_staff - True
me.save()
</code>
  • 刪除一門課程
<code class="shell">sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms --settings aws delete_course 組織名/課程代碼/課程學期 commit
e.g:
sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms --settings aws delete_course bistu/M110/2014_T1 commit
</code>

 也可經過具備 staff 權限的帳號登錄 yourdomain/sysadmin 刪除
若是刪除失敗,則數據庫刪除shell

刪除課程代碼爲999的課程:數據庫

<code>mongo
use edxapp
db.modulestore.find( { "_id.category" : "course" }, {'name':'1'} )
db.modulestore.remove({'_id.course': '999'})
</code>
  • 手動編譯assets
<code class="shell">sudo /edx/bin/edxapp-update-assets-lms
sudo /edx/bin/edxapp-update-assets-cms
</code>
  • 查看服務運行狀態
<code class="shell">sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf status
</code>
  • 從github導入課程
<code>cd /var/tmp
git clone https://github.com/edx/edx-demo-course.git
sudo -u www-data /edx/bin/python.edxapp /edx/bin/manage.edxapp cms --settings aws import /edx/var/edxapp/data /var/tmp/edx-demo-course
</code>
  • 數據庫備份與恢復

備份django

<code>mongodump -d edxapp -o /var/tmp/
mongodump -d cs_comments_service_development -o /var/tmp/
</code>
<code>mysqldump -uroot -p edxapp &gt;/var/tmp/edxapp.sql
mysqldump -uroot -p ora &gt;/var/tmp/ora.sql
mysqldump -uroot -p xqueue &gt;/var/tmp/xqueue.sql
</code>
<code>cd /var/tmp
tar cvf cs_comments_service_development.tar cs_comments_service_development/
tar cvf edxapp.tar edxapp/
</code>

恢復json

<code class="shell">cd /var/tmp
tar xvf *******.tar
</code>
<code>mongorestore -d edxapp --directoryperdb /var/tmp/edxapp
mongorestore -d cs_comments_service_development --directoryperdb /var/tmp/cs_comments_service_development
</code>
<code>mysql -u root -p
use edxapp;
source /var/tmp/edxapp.sql;
use ora;
source /var/tmp/ora.sql;
use xqueue;
source /var/tmp/xqueue.sql;
</code>
相關文章
相關標籤/搜索