Added few playbooks
This commit is contained in:
parent
2a16c328cb
commit
b6f39d8d82
|
|
@ -1,4 +1,4 @@
|
|||
# Local AccuPedia workspace.
|
||||
# Local AcuPedia workspace.
|
||||
# Copy this file to .env and adjust for your machine.
|
||||
#
|
||||
# Do NOT commit .env.
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ With the clean Acupedia naming conventions:
|
|||
- **Database**: `acupedia_db`
|
||||
- **User**: `db_admin` / Password: `C1234spl`
|
||||
- **Volumes**: `acupedia-postgres-data`, `acupedia-minio-data`
|
||||
- **MinIO Bucket**: `accupedia-media`
|
||||
- **MinIO Bucket**: `acupedia-media`
|
||||
|
||||
### Start the containers:
|
||||
```bash
|
||||
|
|
@ -58,7 +58,7 @@ Applies the four schemas (`auth`, `content`, `commerce`, `platform`), tables, in
|
|||
|
||||
```bash
|
||||
docker compose -f docker-compose.dev.yml exec backend \
|
||||
psql postgresql://db_admin:C1234spl@postgres:5432/acupedia_db -f /app/schema/accupedia_db_v5.sql
|
||||
psql postgresql://db_admin:C1234spl@postgres:5432/acupedia_db -f /app/schema/acupedia_db_v5.sql
|
||||
```
|
||||
|
||||
---
|
||||
|
|
@ -89,7 +89,7 @@ docker compose -f docker-compose.dev.yml exec backend \
|
|||
---
|
||||
|
||||
### Step 3.4: Seed Clinical Media Assets (Images to MinIO)
|
||||
Seeds all 787 anatomical images, channel pathways, and charts across the 4 visual modules into MinIO object storage (`accupedia-media` bucket) and links them to their respective content items in PostgreSQL:
|
||||
Seeds all 787 anatomical images, channel pathways, and charts across the 4 visual modules into MinIO object storage (`acupedia-media` bucket) and links them to their respective content items in PostgreSQL:
|
||||
|
||||
**Option A (Recommended — Automated 1-line loop for all 4 modules):**
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# acupedia-ops
|
||||
|
||||
Operational tooling for AccuPedia.
|
||||
Operational tooling for AcuPedia.
|
||||
|
||||
The repository owns:
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
"""AccuPedia operational tooling."""
|
||||
"""AcuPedia operational tooling."""
|
||||
__version__ = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -6,6 +6,12 @@ from typing import Any, Callable, Mapping
|
|||
|
||||
from acupedia_ops.common.paths import ansible_root
|
||||
|
||||
try:
|
||||
import ansible_runner
|
||||
except ImportError as exc:
|
||||
raise RuntimeError(
|
||||
'Install deployment support with: pip install -e ".[deployment]"'
|
||||
) from exc
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class AnsibleRunResult:
|
||||
|
|
@ -43,12 +49,7 @@ def run_playbook(
|
|||
event_handler: Callable[[dict[str, Any]], bool | None] | None = None,
|
||||
status_handler: Callable[[str, dict[str, Any]], None] | None = None,
|
||||
) -> AnsibleRunResult:
|
||||
try:
|
||||
import ansible_runner
|
||||
except ImportError as exc:
|
||||
raise RuntimeError(
|
||||
'Install deployment support with: pip install -e ".[deployment]"'
|
||||
) from exc
|
||||
|
||||
|
||||
root = ansible_root().resolve()
|
||||
inventory_path = _resolve_inventory(inventory)
|
||||
|
|
|
|||
|
|
@ -28,20 +28,20 @@ def resolve_api_root(api_root: Path | None = None) -> Path:
|
|||
raw = os.environ.get("ACUPEDIA_API_PATH", "").strip()
|
||||
if not raw:
|
||||
raise RuntimeError(
|
||||
"AccuPedia API path is required. Supply --api-root or set "
|
||||
"AcuPedia API path is required. Supply --api-root or set "
|
||||
"ACUPEDIA_API_PATH."
|
||||
)
|
||||
root = resolve_workspace_path(raw, base_path=base)
|
||||
|
||||
if not root.is_dir():
|
||||
raise FileNotFoundError(f"AccuPedia API repository not found: {root}")
|
||||
raise FileNotFoundError(f"AcuPedia API repository not found: {root}")
|
||||
|
||||
if not (root / "app").is_dir():
|
||||
raise ValueError(f"Invalid AccuPedia API repository; missing: {root / 'app'}")
|
||||
raise ValueError(f"Invalid AcuPedia API repository; missing: {root / 'app'}")
|
||||
|
||||
if not (root / "pyproject.toml").is_file():
|
||||
raise ValueError(
|
||||
f"Invalid AccuPedia API repository; missing: {root / 'pyproject.toml'}"
|
||||
f"Invalid AcuPedia API repository; missing: {root / 'pyproject.toml'}"
|
||||
)
|
||||
|
||||
return root
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ LOCAL_COMPONENTS = ("api", "mobile", "web", "admin")
|
|||
def _build_parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="acupedia-ops",
|
||||
description="AccuPedia operational tooling",
|
||||
description="AcuPedia operational tooling",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--env-file",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ def workspace_base_path(
|
|||
*,
|
||||
required: bool = True,
|
||||
) -> Path | None:
|
||||
"""Return the AccuPedia workspace base path.
|
||||
"""Return the AcuPedia workspace base path.
|
||||
|
||||
Resolution order:
|
||||
1. explicit value
|
||||
|
|
@ -31,7 +31,7 @@ def workspace_base_path(
|
|||
if not raw:
|
||||
if required:
|
||||
raise RuntimeError(
|
||||
f"{WORKSPACE_BASE_ENV} is required for relative AccuPedia paths."
|
||||
f"{WORKSPACE_BASE_ENV} is required for relative AcuPedia paths."
|
||||
)
|
||||
return None
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ def resolve_workspace_path(
|
|||
*,
|
||||
base_path: Path | None = None,
|
||||
) -> Path:
|
||||
"""Resolve an AccuPedia path deterministically.
|
||||
"""Resolve an AcuPedia path deterministically.
|
||||
|
||||
Absolute paths are used as-is.
|
||||
Relative paths are always resolved against ACUPEDIA_WORKSPACE_BASE_PATH,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ def run_component(
|
|||
component: str,
|
||||
) -> None:
|
||||
config = workspace.components[component]
|
||||
print(config)
|
||||
if not config.run_command:
|
||||
raise RuntimeError(
|
||||
f"No run command configured for local component: {component}"
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ all:
|
|||
|
||||
vars:
|
||||
ansible_user: ops
|
||||
gitea_runner_instance_url: "https://gitea.example.com"
|
||||
gitea_runner_instance_url: "https://git.zedobject.local"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Deploy AccuPedia backend
|
||||
- name: Deploy AcuPedia backend
|
||||
hosts: backend
|
||||
gather_facts: true
|
||||
tasks:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Deploy AccuPedia database changes
|
||||
- name: Deploy AcuPedia database changes
|
||||
hosts: backend
|
||||
gather_facts: true
|
||||
tasks:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
- name: Provision AccuPedia infrastructure
|
||||
- name: Provision AcuPedia infrastructure
|
||||
hosts: all
|
||||
gather_facts: true
|
||||
tasks:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_os_family == "Debian"
|
||||
fail_msg: "Initial AccuPedia remote setup supports Debian/Ubuntu hosts only."
|
||||
fail_msg: "Initial AcuPedia remote setup supports Debian/Ubuntu hosts only."
|
||||
- name: Verify privilege escalation
|
||||
ansible.builtin.command: /usr/bin/true
|
||||
become: true
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
ansible.builtin.assert:
|
||||
that:
|
||||
- ansible_os_family == "Debian"
|
||||
fail_msg: "Initial AccuPedia remote setup supports Debian/Ubuntu hosts only."
|
||||
fail_msg: "Initial AcuPedia remote setup supports Debian/Ubuntu hosts only."
|
||||
|
||||
- name: Install common packages
|
||||
ansible.builtin.apt:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
environment: dev
|
||||
backend:
|
||||
application_name: accupedia-api
|
||||
application_name: acupedia-api
|
||||
database:
|
||||
run_migrations: true
|
||||
infra: {}
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ server {
|
|||
return 301 https://acupedia.in$request_uri;
|
||||
}
|
||||
|
||||
# MinIO S3 Presigned Media Proxy (/accupedia-media/)
|
||||
location /accupedia-media/ {
|
||||
# MinIO S3 Presigned Media Proxy (/acupedia-media/)
|
||||
location /acupedia-media/ {
|
||||
proxy_pass http://minio_storage;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
environment: prod
|
||||
backend:
|
||||
application_name: accupedia-api
|
||||
application_name: acupedia-api
|
||||
database:
|
||||
run_migrations: true
|
||||
infra: {}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
environment: staging
|
||||
backend:
|
||||
application_name: accupedia-api
|
||||
application_name: acupedia-api
|
||||
database:
|
||||
run_migrations: true
|
||||
infra: {}
|
||||
|
|
|
|||
|
|
@ -96,12 +96,12 @@ services:
|
|||
MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
|
||||
MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
|
||||
MINIO_SECURE: "false"
|
||||
MINIO_BUCKET: ${MINIO_BUCKET_NAME:-accupedia-media}
|
||||
MINIO_BUCKET: ${MINIO_BUCKET_NAME:-acupedia-media}
|
||||
MEDIA_STORAGE_SECURE: ${MEDIA_STORAGE_SECURE:-true}
|
||||
MEDIA_PRESIGN_ENDPOINT: ${MEDIA_PRESIGN_ENDPOINT:-http://localhost:9000}
|
||||
MEDIA_STORAGE_ACCESS_KEY: ${MINIO_ACCESS_KEY:-minioadmin}
|
||||
MEDIA_STORAGE_SECRET_KEY: ${MINIO_SECRET_KEY:-minioadmin}
|
||||
MEDIA_STORAGE_BUCKET: ${MINIO_BUCKET_NAME:-accupedia-media}
|
||||
MEDIA_STORAGE_BUCKET: ${MINIO_BUCKET_NAME:-acupedia-media}
|
||||
MEDIA_STORAGE_REGION: us-east-1
|
||||
MEDIA_URL_TTL_SECONDS: 900
|
||||
REDIS_HOST: redis
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Local development
|
||||
|
||||
`acupedia-ops local ...` coordinates the local AccuPedia workspace. It does not
|
||||
`acupedia-ops local ...` coordinates the local AcuPedia workspace. It does not
|
||||
replace the native development tools used by each repository.
|
||||
|
||||
## Workspace model
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Remote deployment foundation
|
||||
|
||||
AccuPedia remote environments are provisioned with Ansible through `ansible-runner`. Docker Compose is the runtime deployment mechanism on each target host.
|
||||
AcuPedia remote environments are provisioned with Ansible through `ansible-runner`. Docker Compose is the runtime deployment mechanism on each target host.
|
||||
|
||||
## Topology
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ build-backend = "setuptools.build_meta"
|
|||
[project]
|
||||
name = "acupedia-ops"
|
||||
version = "0.2.0"
|
||||
description = "Operational data-processing and deployment tooling for AccuPedia"
|
||||
description = "Operational data-processing and deployment tooling for AcuPedia"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"numpy>=2.0,<3.0",
|
||||
"opencv-python-headless>=4.10,<5.0",
|
||||
"PyYAML>=6.0,<7.0",
|
||||
"ansible-runner>=2.4,<3.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ from acupedia_ops.common.config import load_config
|
|||
|
||||
def test_load_config(tmp_path: Path) -> None:
|
||||
(tmp_path / "dev.yaml").write_text(
|
||||
"backend:\n application_name: accupedia-api\n",
|
||||
"backend:\n application_name: acupedia-api\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
config = load_config("dev", config_root=tmp_path)
|
||||
assert config.values["backend"]["application_name"] == "accupedia-api"
|
||||
assert config.values["backend"]["application_name"] == "acupedia-api"
|
||||
|
|
|
|||
2
uv.lock
2
uv.lock
|
|
@ -11,6 +11,7 @@ name = "acupedia-ops"
|
|||
version = "0.2.0"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "ansible-runner" },
|
||||
{ name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
||||
{ name = "numpy", version = "2.5.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||
{ name = "opencv-python-headless" },
|
||||
|
|
@ -27,6 +28,7 @@ dev = [
|
|||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "ansible-runner", specifier = ">=2.4,<3.0" },
|
||||
{ name = "ansible-runner", marker = "extra == 'deployment'", specifier = ">=2.4,<3.0" },
|
||||
{ name = "numpy", specifier = ">=2.0,<3.0" },
|
||||
{ name = "opencv-python-headless", specifier = ">=4.10,<5.0" },
|
||||
|
|
|
|||
Loading…
Reference in New Issue