acupedia-ops/README.md

146 lines
3.0 KiB
Markdown

# 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.