feat(delivery): integrate PostgreSQL delivery

This commit is contained in:
l x
2026-07-31 10:30:03 +08:00
parent 048ac6507e
commit 66fde73792
25 changed files with 2110 additions and 139 deletions
+49
View File
@@ -0,0 +1,49 @@
# Local PostgreSQL AWX setup
This directory keeps the local configuration used to expose the PostgreSQL
delivery playbook through AWX. Files ending in `.env` are ignored; their
`.env.example` counterparts document the supported parameters.
The local object mapping is:
| AWX object | Local value |
| --- | --- |
| Project | `XINFRA PostgreSQL Project` |
| Project source | local `ansible/`, committed into AWX task pod local Git |
| Inventory | `XINFRA PostgreSQL Inventory` |
| Inventory host | `postgresql-218-11-5-224` -> public `218.11.5.224`, SSH via `192.168.1.5` |
| Machine credential | `XINFRA PostgreSQL SSH`, user `root` |
| Private key | `/Users/lx/xengineer-cs2.pem` |
| Secret credential | `XINFRA PostgreSQL Runtime Secrets` |
| Job Template | `XINFRA PostgreSQL Delivery` |
| Playbook | `postgresql-deploy.yml` |
| Instance Group | `xinfra-e2e-execution` |
Run the idempotent setup whenever the AWX task pod restarts or the local
playbook changes. This AWX installation has project persistence disabled and
cannot use a Manual Project, so the Project is Git-backed with launch updates
disabled. The script refreshes a local Git source inside the AWX task pod and
runs a project update so AWX rebuilds its playbook index.
```bash
./scripts/setup-postgresql-awx.sh
```
Start the backend with AWX delivery scheduling enabled:
```bash
./scripts/run-server-postgresql-local.sh
```
Then start the frontend and open `/service/catalog/pgsql`. Select
`XINFRA PostgreSQL Delivery` as the target. The inventory currently contains
one host, so only `standalone` can be deployed until more distinct inventory
hosts are added.
The frontend dev server listens on `http://127.0.0.1:5173`. Port `3000` is
reserved for the local `authserver` MySQL container and must not be used by
Vite. Set `XINFRA_BACKEND_PROXY_TARGET` only when the backend is listening on a
non-default address.
The AWX HTTP API is `http://127.0.0.1:59123`. Local port `59121` is Minikube
SSH and must not be used as `AWX_BASE_URL`.
+43
View File
@@ -0,0 +1,43 @@
# Local AWX API. Port 59121 is Minikube SSH, not the AWX HTTP API.
AWX_BASE_URL=http://127.0.0.1:59123
AWX_TOKEN=
AWX_USERNAME=admin
AWX_PASSWORD=
# When AWX_PASSWORD is empty, the setup script reads this Kubernetes Secret.
AWX_K8S_NAMESPACE=awx
AWX_K8S_ADMIN_PASSWORD_SECRET=awx-demo-admin-password
AWX_K8S_TASK_APP=awx-demo-task
AWX_K8S_TASK_POD=
AWX_K8S_TASK_CONTAINER=awx-demo-task
AWX_ORGANIZATION=Default
AWX_PROJECT_NAME="XINFRA PostgreSQL Project"
AWX_PROJECT_DESCRIPTION="Local-staged XINFRA PostgreSQL Ansible project"
AWX_PROJECT_SCM_URL=file:///var/lib/awx/projects/_xinfra_postgresql_source
AWX_PROJECT_SOURCE_PATH=_xinfra_postgresql_source
AWX_PROJECT_SOURCE_DIR=ansible
AWX_INVENTORY_NAME="XINFRA PostgreSQL Inventory"
AWX_INVENTORY_DESCRIPTION="PostgreSQL host pool for local delivery testing"
AWX_HOST_NAME=postgresql-218-11-5-224
AWX_HOST_ADDRESS=218.11.5.224
AWX_HOST_ANSIBLE_ADDRESS=192.168.1.5
AWX_HOST_SSH_PORT=22
AWX_HOST_SSH_USER=root
AWX_MACHINE_CREDENTIAL_NAME="XINFRA PostgreSQL SSH"
AWX_SSH_PRIVATE_KEY_FILE=/Users/lx/xengineer-cs2.pem
AWX_POSTGRES_CREDENTIAL_TYPE_NAME="XINFRA PostgreSQL Secrets"
AWX_POSTGRES_CREDENTIAL_NAME="XINFRA PostgreSQL Runtime Secrets"
# Leave both passwords empty on first setup to generate them inside AWX.
# To rotate them later, set both values together before running setup again.
XINFRA_POSTGRES_ADMIN_PASSWORD=
XINFRA_POSTGRES_REPLICATION_USER=xinfra_replication
XINFRA_POSTGRES_REPLICATION_PASSWORD=
AWX_JOB_TEMPLATE_NAME="XINFRA PostgreSQL Delivery"
AWX_JOB_TEMPLATE_DESCRIPTION="PostgreSQL host_pool delivery template for XINFRA"
AWX_PLAYBOOK=postgresql-deploy.yml
AWX_INSTANCE_GROUP=xinfra-e2e-execution
@@ -0,0 +1,16 @@
# Loaded by scripts/run-server-postgresql-local.sh before server/.env.
AWX_BASE_URL=http://127.0.0.1:59123
AWX_TOKEN=
AWX_USERNAME=admin
AWX_PASSWORD=
AWX_K8S_NAMESPACE=awx
AWX_K8S_ADMIN_PASSWORD_SECRET=awx-demo-admin-password
DELIVERY_SCHEDULER_ENABLED=true
DELIVERY_POLL_SECONDS=3
DELIVERY_RESERVATION_TTL_MINUTES=120
DELIVERY_GLOBAL_LIMIT=2
DELIVERY_TARGET_LIMIT=2
DELIVERY_BUSINESS_LIMIT=1
DELIVERY_DATA_DISKS=/data