
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Cheminova网站的Wagtail CMS和API后端,提供以下功能:
uv和invoke运行脚本脚本定义在tasks.py中,可通过uv运行:
bashuv run invoke $TASK_NAME
列出可用任务:
bashuv run invoke --list
可用任务:
克隆仓库:
bashgit clone https://github.com/artcom/cheminova-backend.git cd cheminova-backend
配置环境变量
bashcp .env.example .env
编辑.env设置所需变量。
配置Minio客户端
bashcp config/mc/config.json.example config/mc/config.json
编辑以设置不同环境的访问密钥和秘密密钥。
启动完整栈(Postgres、Wagtail、Nginx、Minio)
bashuv run invoke dev
应用数据库迁移
bashdocker compose exec wagtail uv run manage.py migrate
创建超级用户
bashuv run invoke admin-user --password $ADMIN_PASSWORD
创建默认站点
bashuv run invoke init-site --site-url http://localhost
从实时环境导入站点数据(可选)
从S3桶获取最新转储文件名。
bashuv run invoke import-dump --file-name $LATEST_DUMP_FILENAME
从S3同步媒体资源(可选)
bashuv run invoke sync-assets
将前端站点复制到frontend目录(可选)
bashwget https://github.com/artcom/cheminova-frontend/releases/download/v1.0.7/cheminova-frontend-v1.0.7.tar.gz rm -rf frontend/* tar -xzf cheminova-frontend-v1.0.7.tar.gz -C frontend
Wagtail运行于 http://localhost:8000/cms
前端运行于 http://localhost:8080/
Wagtail CMS管理后台运行于 http://localhost:8080/cms/admin/
后端API运行于 http://localhost:8080/cms/api/
Minio web UI运行于 http://localhost:9001/
```bash uv run invoke test ```
构建并推送Docker镜像。
在生产环境中,确保设置以下环境变量: • SECRET_KEY • POSTGRES_DB、POSTGRES_USER、POSTGRES_PASSWORD、POSTGRES_HOST • (可选)如果在子路径下服务,设置BASE_PATH
production.py设置模块将配置: • 安全代理头 • CSRF信任源 • Wagtail管理后台基础URL
bashdocker compose exec wagtail uv run manage.py export_dump
选择S3桶中的转储文件。要从转储文件恢复数据库,可使用以下命令:
bashdocker compose exec wagtail uv run manage.py import_dump $DUMP_FILENAME
除非提供--no-restore-local-data标志,否则用户和站点数据将从本地数据库恢复。
mermaidsequenceDiagram participant Client participant nginx as nginx:8080 participant wagtail as Wagtail:8000 participant upload_view as image_upload.views participant serializer as ImageModelSerializer participant model as CustomImage Model participant db as PostgreSQL participant fs as File System Client->>nginx: POST /api/upload/<br/>(multipart/form-data with image) nginx->>wagtail: proxy_pass to wagtail:8000/api/upload/ wagtail->>upload_view: upload_image_view(request) upload_view->>upload_view: Extract file from request.data upload_view->>upload_view: Generate UUID filename<br/>(original-{uuid}.ext) upload_view->>serializer: ImageModelSerializer(data={file, title}) serializer->>serializer: validate() alt validation successful serializer->>model: CustomImage.objects.create() model->>db: INSERT image record model->>fs: Save image file to /media/original_images/ model->>serializer: return created instance serializer->>upload_view: return serialized data upload_view->>wagtail: Response(data, status=201) wagtail->>nginx: HTTP 201 with image data nginx->>Client: HTTP 201 with image metadata else validation failed serializer->>upload_view: return errors upload_view->>wagtail: Response(errors, status=400) wagtail->>nginx: HTTP 400 nginx->>Client: HTTP 400 with error details end
mermaidsequenceDiagram participant Client participant nginx as nginx:8080 participant wagtail as Wagtail:8000 participant auth_view as image_auth.views participant model as CustomImage Model participant db as PostgreSQL participant fs as File System Client->>nginx: GET /media/images/some-image.jpg nginx->>nginx: auth_request /api/image-auth/ nginx->>wagtail: GET /api/image-auth/<br/>(internal, X-Original-URI header) wagtail->>auth_view: check_permissions(request) alt user is authenticated auth_view->>wagtail: Response(200, "OK") wagtail->>nginx: HTTP 200 nginx->>fs: serve file from /media/ fs->>nginx: image file content nginx->>Client: HTTP 200 with image else user not authenticated auth_view->>auth_view: get_image_file(X-Original-URI) auth_view->>auth_view: get_image_type(image_path) alt image type is "rendition" auth_view->>model: RenditionModel.objects.get(file=path) model->>db: SELECT rendition db->>model: rendition record model->>auth_view: rendition.image else image type is "original" auth_view->>model: CustomImage.objects.get(file=path) model->>db: SELECT image db->>model: image record model->>auth_view: image end auth_view->>model: image.get_referenced_live_pages() model->>db: Query page references db->>model: live page references alt image has live page references model->>auth_view: [live_pages] auth_view->>wagtail: Response(200, "OK") wagtail->>nginx: HTTP 200 nginx->>fs: serve file from /media/ fs->>nginx: image file content nginx->>Client: HTTP 200 with image else no live page references model->>auth_view: [] auth_view->>wagtail: Response(401, "Unauthorized") wagtail->>nginx: HTTP 401 nginx->>Client: HTTP 401 Unauthorized end end
mermaidsequenceDiagram participant Client participant nginx as nginx:8080 participant wagtail as Wagtail:8000 participant api_view as custom_images.views participant serializer as CustomImageModelSerializer participant model as CustomImage Model participant db as PostgreSQL Client->>nginx: GET /api/images/<br/>(with Authorization header) nginx->>wagtail: proxy_pass to wagtail:8000/api/images/ wagtail->>api_view: CustomImageViewSet.list(request) api_view->>api_view: Check IsAuthenticated permission alt user is authenticated api_view->>model: CustomImage.objects.all() model->>db: SELECT * FROM custom_images db->>model: image records loop for each image model->>serializer: CustomImageModelSerializer(image) serializer->>model: get_referenced_live_pages() model->>db: Query page references db->>model: live page references model->>serializer: live pages list serializer->>serializer: set 'live' field (len > 0) serializer->>api_view: serialized image data end api_view->>wagtail: Response with image list wagtail->>nginx: HTTP 200 with JSON nginx->>Client: HTTP 200 with image metadata else user not authenticated api_view->>wagtail: Response(401, "Unauthorized") wagtail->>nginx: HTTP 401 nginx->>Client: HTTP 401 Unauthorized end
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务