- 涉及文档
<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>
注 诸多原因,不推荐腾讯企业邮箱
- 修改 (*)ms.auth.json
<code>"EMAIL_HOST_USER": "*****", "EMAIL_HOST_PASSWORD":"*****", </code>
- 然后重启 edxapp:
<code class="shell">sudo /edx/bin/supervisorctl restart edxapp: </code>
注 一般情况使用默认的本地 smtp 服务,绝对会被拦截
更换域名
- 切换至 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 参数未修改正确
- 然后重启 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>
注 暂不建议中文名字。
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 翻译包
加载主题
- 切换至 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 配置
- 然后重启 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 删除
如果删除失败,则数据库删除
删除课程代码为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>
- 数据库备份与恢复
备份
<code>mongodump -d edxapp -o /var/tmp/ mongodump -d cs_comments_service_development -o /var/tmp/ </code>
<code>mysqldump -uroot -p edxapp >/var/tmp/edxapp.sql mysqldump -uroot -p ora >/var/tmp/ora.sql mysqldump -uroot -p xqueue >/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>
恢复
<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>