6

Open-edx笔记系统尝鲜

 2 years ago
source link: http://wwj718.github.io/post/edx/try-open-edx-note-system-in-cloud/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

我此前写过几篇笔记系统相关的文章:

一图胜千言


使用我的笔记服务

之前搭建了一个笔记云服务,hack了许多代码(实际上弃用了安全保护机制,不建议大家这样做),已经面目全非,和官方版本相去甚远,建议大家笔记后端使用官方版本(估计下个版本就有了)

edx-platform中要做的配置

  • git checkout 70d57327eb3f592067cabb2b4655088101266bcd -- /edx/app/edxapp/edx-platform/lms/djangoapps/edxnotes/helpers.py
  • sudo /edx/bin/python.edxapp /edx/bin/manage.edxapp lms –setting=aws create_oauth2_client https://note.just4fun.site https://note.just4fun.site/complete/edx-oidc/ confidential –client_name edx-notes –client_id edx-notes-id –client_secret edx-notes-secret –trusted
  • 修改/edx/app/edxapp/lms.env.json,使ENABLE_EDXNOTES为true,在EDXNOTES_INTERNAL_API和EDXNOTES_PUBLIC_API都填入https://note.just4fun.site/api/v1
  • 修改/edx/app/edxapp/cms.env.json,使ENABLE_EDXNOTES为true
  • 在studio中进入课程的高级设置,启用笔记选项

设置note服务

cd /edx/app/edx_notes_api/edx_notes_api
sudo git checkout 05dba592531538ed113a86871161fced4fcf7fed

然后将8120映射到外部即可

nginx配置:

upstream notes {
            server 127.0.0.1:8120 fail_timeout=0;
    }

server {
  #listen 443 ssl;
  listen 80;
  ssl on;
  #ssl_certificate /etc/letsencrypt/live/note.just4fun.site/fullchain.pem;
  #ssl_certificate_key /etc/letsencrypt/live/note.just4fun.site/privkey.pem;
  #listen 18120;
  server_name note.just4fun.com;

  location / {
        try_files $uri @proxy_to_app;
  }

  # No basic auth security on the heartbeat url, so that ELB can use it


location @proxy_to_app {
    proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
    proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
    proxy_set_header X-Forwarded-For $http_x_forwarded_for;
    proxy_set_header Host $http_host;

    proxy_redirect off;
    proxy_pass http://notes;
  }

/edx/etc/edx_notes_api.yml里添加允许访问的域名

ALLOWED_HOSTS:
- localhost
- 192.168.0.100
- note.just4fun.site

把你的lms-url发我邮箱,我把你的lms-url加入白名单

需要先对内容批注,才能查阅/搜索笔记,否则可能报错

一些git的使用技巧

  • git show commit_id //显示一次提交的细节
  • gitk filename //查看一个文件的历史
  • git checkout commit_id – filename //重置某个文件

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK