安装tutor部署工具
# 源码安装
git clone https://github.com/overhangio/tutor
cd tutor
pip install -e .
# pip安装
pip install tutor
初始化配置
tutor config save
: 初始化默认配置。添加--interactive
参数可以更改默认配置。tutor config printroot
:查看项目配置文件根目录
tutor config save
# ⚠️ Failed to enable plugin 'indigo': plugin 'indigo' is not installed.
# ⚠️ Failed to enable plugin 'mfe': plugin 'mfe' is not installed.
# Configuration saved to /home/santic/.local/share/tutor/config.yml
# Environment generated in /home/santic/.local/share/tutor/env
其他(可选): tutor local launch
: 初始化配置并安装
docker部署
docker启动
# 首次启动需要更新Docker镜像
tutor local dc pull
# 启动docker容器
# 以守护服务方式运行:tutor local start --detach
# tutor local start -d
tutor local start
启动容器后,输出如下:
⚠️ Failed to enable plugin 'indigo': plugin 'indigo' is not installed.
⚠️ Failed to enable plugin 'mfe': plugin 'mfe' is not installed.
ℹ️ To exit logs without stopping the containers, use ctrl+z
docker compose -f /home/santic/.local/share/tutor/env/local/docker-compose.yml -f /home/santic/.local/share/tutor/env/dev/docker-compose.yml --project-name tutor_dev stop
docker compose -f /home/santic/.local/share/tutor/env/local/docker-compose.yml -f /home/santic/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local up --remove-orphans
# 停止所有服务
tutor local stop
初始化数据库
tutor local do init
此命令应仅运行一次。它将初始化正在运行的平台中的所有应用程序。特别是,这将创建所需的数据库表,并为所有应用程序应用数据库迁移。
如果初始化以 Killed 消息停止,这肯定意味着 docker 容器没有足够的 RAM
挂载源码部署
除了tutor默认的部署方式,您还可以从git克隆源码仓库。挂载源码文件进行部署。
# 克隆下载源码文件
git clone https://github.com/openedx/edx-platform
cd edx-platform
# git checkout open-release/zebulon.master
git checkout master
# 挂载 edx-platform 源码目录
tutor mounts add /my/workspace/edx-plaform
下载Docker镜像并启动容器:
# tutor images build openedx-dev
tutor images build openedx
# tutor dev start
tutor local start -d
常见命令
tutor local stop
(tutorvenv) santic@santic:~$ tutor local --help
⚠️ Failed to enable plugin 'indigo': plugin 'indigo' is not installed.
⚠️ Failed to enable plugin 'mfe': plugin 'mfe' is not installed.
Usage: tutor local [OPTIONS] COMMAND [ARGS]...
Run Open edX locally with docker-compose
Options:
-h, --help Show this message and exit.
Commands:
copyfrom Copy files/folders from a container directory to the local...
dc Direct interface to docker compose.
do Run a custom job in the right container(s).
exec Run a command in a running container
launch Configure and run Open edX from scratch
logs View output from containers
reboot Reboot an existing platform
restart Restart some components from a running platform.
run Run a command in a new container
start Run all or a selection of services.
status Print status information for containers
stop Stop a running platform
upgrade Perform release-specific upgrade tasks
安装 Tutor: https://docs.tutor.edly.io/install.html
本地部署:https://docs.tutor.edly.io/local.html
Working on edx-platform as a developer: https://docs.tutor.edly.io/tutorials/edx-platform.html