# Tutor + OpenEdx > 據說最近出了10.0版大更新,若有使用新版去運行舊版資料會出現"強制建議備份與更新資料"通知,這部分我暫時沒繼續使用縮在3.16,待之後有機會再來摸tutor。 ## 前置安裝 主要會需要安裝的有`docker`還有`docker-compose`部分 ### 安裝Docker 一開始若有舊版 移除後重新安裝: ```bash= $ sudo apt-get remove docker docker-engine docker.io containerd runc ``` 若有需要利用SSL來進行連線(HTTPS)可以安裝: ```bash= $ sudo apt-get install \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common ``` 新增Docker的官方GPG密鑰: ```bash= $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - ``` 接著來開始裝docker,輸入下面指令: ```bash= # 直接安裝最新版本 $ sudo apt-get install docker-ce docker-ce-cli containerd.io # 要指定安裝的版本 $ sudo apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io ``` 測試安裝是否成功,給他跑看看hello world ```bash= $ sudo docker run hello-world ``` 出現下面結果就是穩了: ```bash= Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 1b930d010525: Pull complete Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/ ``` ### 安裝docker-compose 輸入面指令來用`curl`安裝,要注意的是若安裝上有要決定其他版本需要到[Github上確定版本號](https://github.com/docker/compose/releases)再輸入到指令裡面的`1.25.4`裡面。 ```bash $ sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ``` 再給資料夾權限 ```bash= $ sudo chmod +x /usr/local/bin/docker-compose ``` 確認安裝是否成功可以利用檢查版本確認: ```bash= $ docker-compose --version ``` ### 安裝tutor 一樣用curl安裝,需要最新版本可以利用[這邊](https://github.com/overhangio/tutor/releases)來確認編號: ```bash= $ sudo curl -L "https://github.com/overhangio/tutor/releases/download/v3.11.6/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor ``` 提供資料夾權限 ```bash= $ sudo chmod 0755 /usr/local/bin/tutor ``` 接著確認是否有安裝`python3`、`python3-pip`和`libyaml-dev` 沒有輸入以下: ```bash= $ sudo apt install python3 libyaml-dev python3-pip ``` 安裝tutor-openedx ```bash= $ pip install tutor-openedx ``` 加入tutor指令進到bash裡 ```bash= $ _TUTOR_COMPLETE=source tutor >> ~/.bashrc # 若是使用zsh > _TUTOR_COMPLETE=source_zsh tutor >> ~/.zshrc ``` 確認是否安裝成功可以輸入下面指令確認。 ```bash= $ tutor ```  ## 建立專案 輸入 ```bash= $ tutor local quickstart ``` 接著會出現下面問答 ```bash= ================================================== Interactive platform configuration ================================================== Your website domain name for students (LMS) [lms.com] #有網域直接在這邊輸入/lms網站 Your website domain name for teachers (CMS) [studio.lms.com] #有網域直接在這邊輸入/lms工作站網站 Your platform name/title [My open edx] #這個平台/專案名稱 Your public contact email address [] #設定的email The default language code for the platform [en] #預設平台語言 Activate SSL/TLS certificates for HTTPS access? Important note: this will NOT work in a development environment. [y/N] #有需要SSL/TLS權證給HTTPS進行嗎(不支援dev環境) ``` 在出現這個訊息後可以測試是否成功  ## 模組(Plugins) ### 安裝 ```bash= # 1) Install the plugin $ pip install tutor-myapp # 2) Enable the plugin $ tutor plugins enable myapp # 3) Reconfigure and restart the platform $ tutor local quickstart ``` ### 狀態 確認模組清單以及目前啟動狀態: ```bash= $ tutor plugins list ``` 若要啟動或關閉模組: ```bash= $ tutor plugins enable myplugin $ tutor plugins disable myplugin ``` 若有更動plugins,都應該儲存config來儲存新環境: ```bash= $ tutor config save ``` ### 安裝 xblock套件 先把套件的git放在xblock的requirement文件夾中,位置應該會在`$(tutor config printroot)/env/build/openedx/requirements/private.txt`這邊。 再來進去`private.txt`,編輯套件git URL,格式是: ``` git+<https的git URL網址> ``` 結果大概長這樣  完成之後對檔案進行儲存,然後重新建立他 ```bash= $ tutor images build openedx ``` ### 證照建立 在tutor/config.yml當中新增一行 ``` CERTIFICATES_HTML_VIEW: true ``` 之後儲存config,你可以到`cms.env.json`和`lms.env.json`(在env/apps/openedx/config裡面)看到:  確認沒問題後再次進行image建立,重新啟動後,這時候回到studio選擇 <kbd>設定</kbd> > <kbd>證書</kbd> 一定還是空的  那是因為我們還沒有設定課程模式,到django設定頁面選擇`course modes`設定下面欄位  再回來看studio的 <kbd>設定</kbd> > <kbd>證書</kbd> 就會有新增按鈕了  ### 登入次數限制 主要是在這些地方確認一下設定值 ```python= # cms/envs/common.py FEATURE["ENABLE_MAX_FAILED_LOGIN_ATTEMPTS"] = True # 登入錯誤限制,開啟為True MAX_FAILED_LOGIN_ATTEMPTS_ALLOWED = 10 # 設定最多嘗試錯誤次數 MAX_FAILED_LOGIN_ATTEMPTS_LOCKOUT_PERIOD_SECS = 60 * 60 # 設定鎖定時間,以秒為單位。 ``` ### Zoom + LTI pro ## 問題排除 ### 在start時出現localhost問題 若有出現以下類似的錯誤 ```bash= ERROR: Couldn’t connect to Docker daemon at http+docker://localunixsocket - is it running? If it’s at a non-standard location, specify the URL with the DOCKER_HOST environment variable. ``` 要將目前user放入docker的群組裡,再重新登出/登入: ```bash= $ sudo gpasswd -a ${USER} docker $ su $ su <username> ``` ### tutor的部署檔案位置 通常使用的位置指令是`$(tutor config printroot)`,可以用cd移動到位置過去:  ### 證照建立起來怎麼開都是說錯誤 那是因為沒有設定`certificate html view configuration`,請到admin裡找到這個然後把`active`打勾。 ### start時出現mysql的port佔用 可以直接重啟docker功能,利用下方指令重啟 ```bash= $ sudo systemctl restart docker ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up