dayuse-commands
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDayuse App Commands
Dayuse 应用命令
Overview
概述
All local development commands for the Dayuse.com project use Python Invoke (prefixed with ) and must be run through pipenv from the current working directory.
inv所有Dayuse.com项目的本地开发命令都使用Python Invoke(前缀为),并且必须从当前工作目录通过pipenv运行。
invPrerequisites
前置条件
- Docker Desktop running
- pipenv installed ()
pip install pipenv
- Docker Desktop 处于运行状态
- 已安装pipenv()
pip install pipenv
Critical Rules
重要规则
- Always prefix commands with to ensure the correct Python environment:
pipenv runbashpipenv run inv <command> - Docker containers must be running for most commands. If unsure, run first.
pipenv run inv up - Never run directly without
inv— it may use the wrong Python/invoke version.pipenv run
- 始终以为命令前缀,以确保使用正确的Python环境:
pipenv runbashpipenv run inv <command> - 大多数命令需要Docker容器处于运行状态。如果不确定,请先运行。
pipenv run inv up - **切勿直接运行**而不添加
inv——这可能会使用错误的Python/invoke版本。pipenv run
Quick Reference
快速参考
| Action | Command |
|---|---|
| Start everything | |
| Start containers only | |
| Stop containers | |
| Run PHP tests | |
| Run specific PHP test | |
| PHPStan analysis | |
| Fix code style | |
| Frontend tests | |
| DB migration | |
| 操作 | 命令 |
|---|---|
| 启动所有服务 | |
| 仅启动容器 | |
| 停止容器 | |
| 运行PHP测试 | |
| 运行特定PHP测试 | |
| PHPStan代码分析 | |
| 修复代码风格 | |
| 前端测试 | |
| 数据库迁移 | |
Infrastructure
基础设施
Start & Stop
启动与停止
bash
undefinedbash
undefinedFull setup: build + start + install deps + migrate DB
完整设置:构建 + 启动 + 安装依赖 + 数据库迁移
pipenv run inv start
pipenv run inv start
Build Docker images + start containers (no install/migrate)
构建Docker镜像 + 启动容器(不执行安装/迁移)
pipenv run inv up
pipenv run inv up
Build Docker images only
仅构建Docker镜像
pipenv run inv build
pipenv run inv build
Stop all containers
停止所有容器
pipenv run inv stop
pipenv run inv stop
Destroy everything (containers, volumes, networks) — DESTRUCTIVE
销毁所有资源(容器、卷、网络)—— 此操作具有破坏性
pipenv run inv destroy
undefinedpipenv run inv destroy
undefinedMonitoring
监控
bash
undefinedbash
undefinedList container status
列出容器状态
pipenv run inv ps
pipenv run inv ps
Show container logs
查看容器日志
pipenv run inv logs
pipenv run inv logs
Open bash shell in builder container
在builder容器中打开bash shell
pipenv run inv builder
undefinedpipenv run inv builder
undefinedWorkers (RabbitMQ consumers)
工作进程(RabbitMQ 消费者)
bash
undefinedbash
undefinedStart worker containers
启动工作进程容器
pipenv run inv start-workers
pipenv run inv start-workers
Stop worker containers
停止工作进程容器
pipenv run inv stop-workers
---pipenv run inv stop-workers
---PHP Backend Testing
PHP后端测试
bash
undefinedbash
undefinedFull test suite (creates test DB + fixtures + PHPUnit)
完整测试套件(创建测试数据库 + 测试数据 + 运行PHPUnit)
pipenv run inv tests
pipenv run inv tests
Run PHPUnit only (assumes test DB already exists)
仅运行PHPUnit(假设测试数据库已存在)
pipenv run inv phpunit
pipenv run inv phpunit
Run specific test(s) by filter
通过过滤器运行特定测试
pipenv run inv phpunit --filter-tests=MyTestClass
pipenv run inv phpunit --filter-tests=testMethodName
pipenv run inv phpunit --filter-tests=MyTestClass
pipenv run inv phpunit --filter-tests=testMethodName
Run with code coverage
带代码覆盖率的测试
pipenv run inv phpunit --coverage
pipenv run inv phpunit --coverage
Create/reset test database with fixtures
创建/重置带测试数据的测试数据库
pipenv run inv create-test-env
pipenv run inv create-test-env
Import specific fixtures
导入特定测试数据
pipenv run inv import-fixtures
---pipenv run inv import-fixtures
---PHP Code Quality
PHP代码质量
bash
undefinedbash
undefinedPHPStan static analysis (level 10)
PHPStan静态分析(级别10)
pipenv run inv phpstan
pipenv run inv phpstan
PHP-CS-Fixer — auto-fix code style
PHP-CS-Fixer — 自动修复代码风格
pipenv run inv cs-fix
pipenv run inv cs-fix
PHP-CS-Fixer — check only (dry-run, used in CI)
PHP-CS-Fixer — 仅检查(试运行,用于CI)
pipenv run inv cs-fix --dry-run
pipenv run inv cs-fix --dry-run
PHP syntax + YAML + Twig linting
PHP语法 + YAML + Twig代码检查
pipenv run inv lint
pipenv run inv lint
Validate Doctrine schema against entities
验证Doctrine映射与实体的一致性
pipenv run inv schema-validate
---pipenv run inv schema-validate
---Frontend (Next.js / React)
前端(Next.js / React)
Web
Web端
bash
undefinedbash
undefinedJest tests
Jest测试
pipenv run inv front-web-test
pipenv run inv front-web-test
ESLint
ESLint代码检查
pipenv run inv front-web-lint
pipenv run inv front-web-lint
TypeScript type check
TypeScript类型检查
pipenv run inv front-web-type
pipenv run inv front-web-type
Prettier formatting check
Prettier格式检查
pipenv run inv front-web-prettier
pipenv run inv front-web-prettier
Unit tests (alternative)
单元测试(替代命令)
pipenv run inv tests-unit-front
pipenv run inv tests-unit-front
Reset frontend API cache
重置前端API缓存
pipenv run inv reset-frontend-api
undefinedpipenv run inv reset-frontend-api
undefinedMobile App
移动端应用
bash
undefinedbash
undefinedUnit tests
单元测试
pipenv run inv test-app
pipenv run inv test-app
ESLint
ESLint代码检查
pipenv run inv lint-app
pipenv run inv lint-app
TypeScript compliance
TypeScript合规性检查
pipenv run inv typing-app
pipenv run inv typing-app
Format check
格式检查
pipenv run inv format-app
pipenv run inv format-app
Check XCode plist files
检查XCode plist文件
pipenv run inv check-plist
---pipenv run inv check-plist
---Database
数据库
bash
undefinedbash
undefinedRun pending migrations
运行待处理的迁移
pipenv run inv migrate
pipenv run inv migrate
Generate a new migration
生成新的迁移文件
pipenv run inv make-migration
pipenv run inv make-migration
Load a SQL dump into dayuse_dev
将SQL转储文件导入dayuse_dev数据库
pipenv run inv mysql-load-dump
pipenv run inv mysql-load-dump
Snapshot current MySQL volume (for fast restore later)
快照当前MySQL卷(用于后续快速恢复)
pipenv run inv volume-mysql-snapshot
pipenv run inv volume-mysql-snapshot
Restore MySQL volume from snapshot
从快照恢复MySQL卷
pipenv run inv volume-mysql-snapshot-restore
---pipenv run inv volume-mysql-snapshot-restore
---Elasticsearch
Elasticsearch
bash
undefinedbash
undefinedRebuild hotel index (full)
重建酒店索引(全量)
pipenv run inv es-build-hotel
pipenv run inv es-build-hotel
Rebuild hotel index for specific country
重建特定国家的酒店索引
pipenv run inv es-build-hotel --country=FR
pipenv run inv es-build-hotel --country=FR
Rebuild POI index
重建POI索引
pipenv run inv es-build-poi
pipenv run inv es-build-poi
Rebuild billing index
重建账单索引
pipenv run inv es-build-billing
pipenv run inv es-build-billing
Rebuild order index
重建订单索引
pipenv run inv es-build-order
pipenv run inv es-build-order
Setup ES snapshot
设置ES快照
pipenv run inv es-setup-snapshot
pipenv run inv es-setup-snapshot
Reset ES snapshot
重置ES快照
pipenv run inv es-reset-snapshot
pipenv run inv es-reset-snapshot
Restore hotel index from snapshot
从快照恢复酒店索引
pipenv run inv es-restore-hotel-snapshot
pipenv run inv es-restore-hotel-snapshot
Restore POI index from snapshot
从快照恢复POI索引
pipenv run inv es-restore-poi-snapshot
---pipenv run inv es-restore-poi-snapshot
---Translations
翻译管理
bash
undefinedbash
undefinedDownload translations from Loco (frontend + backend)
从Loco下载翻译(前端 + 后端)
pipenv run inv loco-download
pipenv run inv loco-download
Download translations, commit, and push (for releases)
下载翻译、提交并推送(用于发布)
pipenv run inv finalize-release
---pipenv run inv finalize-release
---Other Utilities
其他工具命令
bash
undefinedbash
undefinedClear Symfony cache
清除Symfony缓存
pipenv run inv cache-clear
pipenv run inv cache-clear
Clear dev.log
清空dev.log日志
pipenv run inv log-clear
pipenv run inv log-clear
Install all dependencies (composer + yarn)
安装所有依赖(composer + yarn)
pipenv run inv install
pipenv run inv install
Install composer dependencies only
仅安装composer依赖
pipenv run inv composer-install
pipenv run inv composer-install
Generate SSL certificates
生成SSL证书
pipenv run inv generate-certificates
pipenv run inv generate-certificates
Display help with local URLs
显示包含本地URL的帮助信息
pipenv run inv help
---pipenv run inv help
---CI Pipeline Commands
CI流水线命令
When running in CI mode, first set the CI flag:
bash
pipenv run inv ciCI runs these checks (all must pass):
- — PHP unit tests
pipenv run inv phpunit - — Static analysis
pipenv run inv phpstan - — Code style check
pipenv run inv cs-fix --dry-run - — Syntax linting
pipenv run inv lint - — Doctrine schema
pipenv run inv schema-validate - — Frontend ESLint
pipenv run inv front-web-lint - — Frontend TypeScript
pipenv run inv front-web-type - — Frontend formatting
pipenv run inv front-web-prettier
在CI模式下运行时,首先设置CI标志:
bash
pipenv run inv ciCI会运行以下检查(所有检查必须通过):
- — PHP单元测试
pipenv run inv phpunit - — 静态代码分析
pipenv run inv phpstan - — 代码风格检查
pipenv run inv cs-fix --dry-run - — 语法检查
pipenv run inv lint - — Doctrine映射验证
pipenv run inv schema-validate - — 前端ESLint检查
pipenv run inv front-web-lint - — 前端TypeScript检查
pipenv run inv front-web-type - — 前端格式检查
pipenv run inv front-web-prettier
Local Development URLs
本地开发URL
Once containers are running ():
pipenv run inv up| Service | URL |
|---|---|
| API | https://api.dayuse.test/ |
| Back Office | https://bo.dayuse.test/ |
| Partners Extranet | https://partners.dayuse.test/ |
| Search API | https://api-search.dayuse.test/ |
| Redirects | https://r.dayuse.test/ |
| RabbitMQ | https://rabbitmq.dayuse.test/ |
| Mailcatcher | https://mail.dayuse.test/ |
当容器启动后():
pipenv run inv up| 服务 | URL |
|---|---|
| API | https://api.dayuse.test/ |
| 后台管理系统 | https://bo.dayuse.test/ |
| 合作伙伴外联网 | https://partners.dayuse.test/ |
| 搜索API | https://api-search.dayuse.test/ |
| 重定向服务 | https://r.dayuse.test/ |
| RabbitMQ | https://rabbitmq.dayuse.test/ |
| Mailcatcher | https://mail.dayuse.test/ |
Troubleshooting
故障排查
Containers not starting
容器无法启动
Symptoms: fails or containers crash
Solution:
inv upbash
pipenv run inv destroy
pipenv run inv start症状:失败或容器崩溃
解决方案:
inv upbash
pipenv run inv destroy
pipenv run inv startTest DB out of date
测试数据库过期
Symptoms: PHPUnit fails with schema errors
Solution:
bash
pipenv run inv create-test-env
pipenv run inv phpunit症状:PHPUnit运行时出现映射错误
解决方案:
bash
pipenv run inv create-test-env
pipenv run inv phpunitpipenv not found or wrong Python
pipenv未找到或Python版本错误
Symptoms: or import errors
Solution:
pipenv: command not foundbash
pip install pipenv
pipenv install症状: 或导入错误
解决方案:
pipenv: command not foundbash
pip install pipenv
pipenv installElasticsearch index empty or stale
Elasticsearch索引为空或过期
Symptoms: Search returns no results
Solution:
bash
pipenv run inv es-build-hotel
pipenv run inv es-build-poi症状:搜索无结果返回
解决方案:
bash
pipenv run inv es-build-hotel
pipenv run inv es-build-poi