197 lines
3.9 KiB
Markdown
197 lines
3.9 KiB
Markdown
# Local development
|
|
|
|
`acupedia-ops local ...` coordinates the local AccuPedia workspace. It does not
|
|
replace the native development tools used by each repository.
|
|
|
|
## Workspace model
|
|
|
|
Recommended layout:
|
|
|
|
```text
|
|
/home/amit/Work/Project/acupedia/
|
|
├── acupedia-api/
|
|
├── acupedia-mobile-ui/
|
|
├── acupedia-web-portal/
|
|
├── acupedia-admin-portal/
|
|
├── acupedia-content/
|
|
└── acupedia-ops/
|
|
```
|
|
|
|
Copy `.env.example` to `.env`:
|
|
|
|
```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
|
|
|
|
ACUPEDIA_LOCAL_COMPOSE_FILE=acupedia-ops/docker-compose.local.yml
|
|
ACUPEDIA_API_BOOTSTRAP_COMMAND=acupedia-api/.venv/bin/acupedia-bootstrap
|
|
ACUPEDIA_API_PYTHON=acupedia-api/.venv/bin/python
|
|
```
|
|
|
|
`ACUPEDIA_WORKSPACE_BASE_PATH` is the canonical local workspace root.
|
|
|
|
All relative `ACUPEDIA_*_PATH` values are resolved against that base path,
|
|
never against the process current working directory.
|
|
|
|
For example:
|
|
|
|
```text
|
|
ACUPEDIA_WORKSPACE_BASE_PATH=/home/amit/Work/Project/acupedia
|
|
ACUPEDIA_API_PATH=acupedia-api
|
|
|
|
resolves to:
|
|
|
|
/home/amit/Work/Project/acupedia/acupedia-api
|
|
```
|
|
|
|
Absolute component paths remain supported and are used as-is.
|
|
|
|
The workspace base path must itself be absolute. This is intentional: local
|
|
operations should not change meaning based on the directory from which the CLI
|
|
was launched.
|
|
|
|
## Local machine versus deployment environment
|
|
|
|
The `.env` describes local workspace topology and local runtime secrets.
|
|
|
|
It is not the dev/staging/prod deployment selector.
|
|
|
|
```text
|
|
.env
|
|
-> where local repositories live
|
|
|
|
config/local.yaml
|
|
-> how repositories are operated locally
|
|
|
|
docker-compose.local.yml
|
|
-> local stateful dependencies
|
|
|
|
--env dev|staging|prod
|
|
-> explicit remote environment selection
|
|
|
|
Ansible inventories/config
|
|
-> remote environment hosts/settings
|
|
```
|
|
|
|
## Validate
|
|
|
|
```bash
|
|
acupedia-ops local validate
|
|
```
|
|
|
|
This verifies repository locations and expected repository markers.
|
|
|
|
## Setup
|
|
|
|
Validation only:
|
|
|
|
```bash
|
|
acupedia-ops local setup
|
|
```
|
|
|
|
Install dependencies using the commands in `config/local.yaml`:
|
|
|
|
```bash
|
|
acupedia-ops local setup --install
|
|
```
|
|
|
|
One component:
|
|
|
|
```bash
|
|
acupedia-ops local setup --component api --install
|
|
```
|
|
|
|
## Local infrastructure
|
|
|
|
Copy the example Compose file and align versions/settings with the API local
|
|
environment:
|
|
|
|
```bash
|
|
cp docker-compose.local.example.yml docker-compose.local.yml
|
|
```
|
|
|
|
Then:
|
|
|
|
```bash
|
|
acupedia-ops local infra-up
|
|
acupedia-ops local infra-status
|
|
acupedia-ops local logs
|
|
acupedia-ops local infra-down
|
|
```
|
|
|
|
Delete volumes only when explicitly intended:
|
|
|
|
```bash
|
|
acupedia-ops local infra-down --volumes
|
|
```
|
|
|
|
## Bootstrap
|
|
|
|
The actual bootstrap remains owned by `acupedia-api`.
|
|
|
|
Default local content bootstrap:
|
|
|
|
```bash
|
|
acupedia-ops local bootstrap
|
|
```
|
|
|
|
Publish seeded content:
|
|
|
|
```bash
|
|
acupedia-ops local bootstrap content --publish-content
|
|
```
|
|
|
|
Other targets:
|
|
|
|
```bash
|
|
acupedia-ops local bootstrap auth
|
|
acupedia-ops local bootstrap commerce
|
|
acupedia-ops local bootstrap media
|
|
acupedia-ops local bootstrap validate
|
|
acupedia-ops local bootstrap all
|
|
```
|
|
|
|
Additional backend bootstrap CLI options can be forwarded after `--`.
|
|
|
|
## Database reset
|
|
|
|
Dry-run:
|
|
|
|
```bash
|
|
acupedia-ops local reset-db
|
|
```
|
|
|
|
Execute:
|
|
|
|
```bash
|
|
acupedia-ops local reset-db --execute
|
|
```
|
|
|
|
`ACUPEDIA_API_PYTHON`, when relative, is resolved against
|
|
`ACUPEDIA_WORKSPACE_BASE_PATH`.
|
|
|
|
## Run application components
|
|
|
|
```bash
|
|
acupedia-ops local run api
|
|
acupedia-ops local run mobile
|
|
acupedia-ops local run web
|
|
acupedia-ops local run admin
|
|
```
|
|
|
|
These are foreground processes. Run multiple components in separate terminals,
|
|
tmux, or an IDE rather than turning `acupedia-ops` into a process supervisor.
|
|
|
|
## Workspace status
|
|
|
|
```bash
|
|
acupedia-ops local status
|
|
acupedia-ops local status --json
|
|
```
|