# acupedia-ops Operational tooling for AccuPedia. The repository owns: - reusable content/data preprocessing; - local development orchestration; - backend bootstrap invocation through a CLI boundary; - remote deployment orchestration; - Gitea Actions runner lifecycle; - Ansible playbooks/roles; - operational validation and shared utilities. It does not own application business logic and does not import `app.*` from `acupedia-api`. ## Installation ```bash python -m venv .venv source .venv/bin/activate pip install -e . ``` For Ansible/deployment support: ```bash pip install -e ".[deployment]" ``` Development: ```bash pip install -e ".[dev]" ``` ## Workspace base path Local repositories can be configured relative to one canonical workspace root: ```dotenv ACUPEDIA_WORKSPACE_BASE_PATH=/home/amit/Work/Project/acupedia ACUPEDIA_API_PATH=acupedia-api ACUPEDIA_MOBILE_PATH=acupedia-mobile-ui ACUPEDIA_WEB_PORTAL_PATH=acupedia-web-portal ACUPEDIA_ADMIN_PORTAL_PATH=acupedia-admin-portal ACUPEDIA_CONTENT_PATH=acupedia-content ACUPEDIA_OPS_PATH=acupedia-ops ``` Relative paths are always resolved against `ACUPEDIA_WORKSPACE_BASE_PATH`, never against the current working directory. Absolute component paths remain supported. ## Local workspace ```bash cp .env.example .env acupedia-ops local validate acupedia-ops local setup ``` Typical local flow: ```bash acupedia-ops local infra-up acupedia-ops local bootstrap content --publish-content ``` Then, in separate terminals: ```bash acupedia-ops local run api acupedia-ops local run mobile ``` For complete documentation see: - `docs/local-development.md` - `docs/gitea-runner-lifecycle.md` ## Local commands ```text acupedia-ops local validate acupedia-ops local setup [--install] acupedia-ops local status [--json] acupedia-ops local run api|mobile|web|admin acupedia-ops local infra-up acupedia-ops local infra-down acupedia-ops local infra-restart acupedia-ops local infra-status acupedia-ops local logs acupedia-ops local bootstrap [auth|content|media|commerce|all|validate] acupedia-ops local reset-db [--execute] ``` ## Backend bootstrap boundary The bootstrap implementation remains in `acupedia-api`. `acupedia-ops` resolves and invokes the backend-owned `acupedia-bootstrap` executable instead of importing backend Python internals. Direct usage is also available: ```bash acupedia-ops bootstrap content \ --api-root ../acupedia-api \ -- \ --config ../acupedia-content/config.json \ --modules-root ../acupedia-content ``` ## Image preprocessing ```bash acupedia-ops image clean-border input.jpg output.jpg ``` Directory and ZIP processing remain supported. ## Gitea runner lifecycle ```bash export GITEA_RUNNER_REGISTRATION_TOKEN='...' acupedia-ops runner provision \ --inventory ansible/inventories/gitea-runners.yml ``` See `docs/gitea-runner-lifecycle.md`. ## Remote deployment ```bash acupedia-ops deploy backend --env dev acupedia-ops deploy database --env dev ``` Local development deliberately uses native dev processes and Docker Compose. Ansible remains the remote deployment/configuration mechanism. # Acupedia CLI acupedia-ops bootstrap all \ --content-config ./config.json \ --content-modules-root ./modules-data \ --content-module-code M0001 \ --media-manifest ./media.json \ --media-media-root ./modules-data/M0001-Acupuncture Points acupedia-ops bootstrap media \ --manifest "./modules-data/M0001-Acupuncture Points/media.json" \ --media-root "./modules-data/M0001-Acupuncture Points" \ --validate-only acupedia-ops bootstrap media \ --manifest "./modules-data/M0001-Acupuncture Points/media.json" \ --media-root "./modules-data/M0001-Acupuncture Points" acupedia-ops bootstrap content \ --config ./modules-data/config.json \ --modules-root ./modules-data \ --module-code M0001 \ --publish-content acupedia-ops bootstrap content \ --config ./modules-data/config.json \ --modules-root ./modules-data \ --module-code M0001 \ --seed-search-facets-only acupedia-ops bootstrap content \ --config ./modules-data/config.json \ --modules-root ./modules-data \ --module-code M0001 \ --template-code M0001_CT0003 \ --content-code LU-1 \ --publish-content aacupedia-ops bootstrap commerce --plans ./modules-data/plans.json acupedia-ops reset \ --scope module \ --module-code M0002 \ --execute acupedia-access grant-plan \ --email av.salunke@gmail.com \ --plan-code POINTS_ACU Grant a plan and all modules mapped through `commerce.access_plan_modules`: ```bash acupedia-ops access grant-plan \ --email user@example.com \ --plan-code POINTS_ACU ``` Optional finite test access: ```bash acupedia-ops access grant-plan \ --email user@example.com \ --plan-code POINTS_ACU \ --expires-in-days 30 ``` Revoke access sourced from the plan: ```bash acupedia-ops access revoke-plan \ --email user@example.com \ --plan-code POINTS_ACU ``` `--user-id ` can be used instead of `--email`. The grant operation is idempotent for an already-active subscription and active module entitlements. It never invents plan/module mappings; the selected plan must already have rows in `commerce.access_plan_modules`. ```bash python3 diff.py \ /home/chintan/Downloads/Acupedia_Dump/src \ /home/chintan/Work/Project/acupedia-api \ -o diff-report.txt \ --exclude "*.lock" \ --exclude "generated/**" \ --exclude "uploads/**" \ --exclude "alembic/versions/**" \ --no-new-file-content \ --no-removed-file-content python3 diff.py \ /home/chintan/Downloads/Acupedia_Dump/src \ /home/chintan/Work/Project/acupedia-mobile-ui/src \ -o diff-report.txt \ --no-new-file-content \ --no-removed-file-content ```