feat(ops): add script to generate container git metadata and update manual setup guide

- Add scripts/generate-git-info.sh to capture branch and commit info for api, store, and admin
- Update MANUAL_SETUP_GUIDE.md with pre-build git info generation and container verification steps
- Resolve merge conflict markers in database validation section
This commit is contained in:
Urvish Prajapati 2026-10-09 14:04:25 +05:30
parent b6f39d8d82
commit 3cc4f81726
2 changed files with 80 additions and 7 deletions

View File

@ -41,9 +41,16 @@ With the clean Acupedia naming conventions:
- **Volumes**: `acupedia-postgres-data`, `acupedia-minio-data`
- **MinIO Bucket**: `acupedia-media`
### Start the containers:
### Step 2.1: Generate Container Git Info Metadata (Recommended)
Before building, run the script to capture the branch and commit of `api`, `store`, and `admin`:
```bash
cd ~/acupedia/acupedia_ops
./scripts/generate-git-info.sh
```
### Step 2.2: Start the Containers
```bash
docker compose -f docker-compose.dev.yml up -d --build
```
@ -58,7 +65,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/acupedia_db_v5.sql
psql postgresql://db_admin:C1234spl@postgres:5432/acupedia_db -f /app/schema/accupedia_db_v5.sql
```
---
@ -140,13 +147,8 @@ docker compose -f docker-compose.dev.yml exec backend \
---
<<<<<<< HEAD
### Step 3.6: Validate Database Integrity
Verifies all 9 required tables exist, counts roles, permissions, modules, published content items, and seeded media assets:
=======
### Step 3.5: Validate Database Integrity
Verifies all 9 required tables exist, counts roles, permissions, modules, and published content items:
>>>>>>> origin/main
```bash
docker compose -f docker-compose.dev.yml exec backend \
@ -191,3 +193,25 @@ After running the manual steps above, test your endpoints:
| **Admin Portal** | `3001` | `http://<IP_OR_DOMAIN>:3001/admin/` |
| **MinIO Console** | `9001` | `http://<IP_OR_DOMAIN>:9001` (`minioadmin` / `minioadmin`) |
| **MailHog UI** | `8025` | `http://<IP_OR_DOMAIN>:8025` |
### Git Identity Verification (Inspect Container Branch & Commit)
To verify which branch and commit are running inside each container:
```bash
# 1. API Backend
docker compose -f docker-compose.dev.yml exec backend cat /app/.git_api_info
# 2. Storefront
docker compose -f docker-compose.dev.yml exec store cat /app/.git_store_info
# 3. Admin Portal
docker compose -f docker-compose.dev.yml exec admin cat /app/.git_admin_info
```
Example output:
```text
Branch: main
Commit: 29279bfd72a6fa296d1aa05a825bd88ca1f36c91
```

49
scripts/generate-git-info.sh Executable file
View File

@ -0,0 +1,49 @@
#!/usr/bin/env bash
# ============================================================
# Generate Git metadata files for API, Storefront, and Admin
# ============================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OPS_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
cd "${OPS_DIR}"
# Load environment file if present to resolve custom repo paths
if [ -f .env ]; then
export $(grep -v '^#' .env | grep -v '^\s*$' | xargs -d '\n' 2>/dev/null || true)
fi
API_PATH="${ACUPEDIA_API_PATH:-../../acupedia-api}"
STORE_PATH="${ACUPEDIA_STORE_PATH:-../../acupedia_store_ui}"
ADMIN_PATH="${ACUPEDIA_ADMIN_PATH:-../../acupedia_web_ui}"
# 1. Acupedia API
if [ -d "${API_PATH}/.git" ]; then
echo "Branch: $(git -C "${API_PATH}" rev-parse --abbrev-ref HEAD)" > "${API_PATH}/.git_api_info"
echo "Commit: $(git -C "${API_PATH}" rev-parse HEAD)" >> "${API_PATH}/.git_api_info"
echo "✅ Generated: ${API_PATH}/.git_api_info"
else
echo "⚠️ Skipping API: ${API_PATH}/.git not found"
fi
# 2. Acupedia Storefront
if [ -d "${STORE_PATH}/.git" ]; then
echo "Branch: $(git -C "${STORE_PATH}" rev-parse --abbrev-ref HEAD)" > "${STORE_PATH}/.git_store_info"
echo "Commit: $(git -C "${STORE_PATH}" rev-parse HEAD)" >> "${STORE_PATH}/.git_store_info"
echo "✅ Generated: ${STORE_PATH}/.git_store_info"
else
echo "⚠️ Skipping Storefront: ${STORE_PATH}/.git not found"
fi
# 3. Acupedia Admin (Web UI)
if [ -d "${ADMIN_PATH}/.git" ]; then
echo "Branch: $(git -C "${ADMIN_PATH}" rev-parse --abbrev-ref HEAD)" > "${ADMIN_PATH}/.git_admin_info"
echo "Commit: $(git -C "${ADMIN_PATH}" rev-parse HEAD)" >> "${ADMIN_PATH}/.git_admin_info"
echo "✅ Generated: ${ADMIN_PATH}/.git_admin_info"
else
echo "⚠️ Skipping Admin: ${ADMIN_PATH}/.git not found"
fi
echo "Done! You can now run: docker compose -f docker-compose.dev.yml up --build"