Files
billing/deploy_on_s1.sh
2026-08-21 01:55:12 +00:00

42 lines
1.3 KiB
Bash

#!/bin/bash
# Deploy billing API on s1 in Docker, then smoke-test the endpoints.
set -e
cd /tmp/billing_api
echo "=== 1. Generate .env from admin-openrc.sh ==="
. /etc/kolla/admin-openrc.sh
cat > .env <<EOF
BILLING_KEYSTONE_AUTH_URL=${OS_AUTH_URL%/*}
BILLING_CLOUDKITTY_URL=https://internal.3engine.rootxwire.com:8889
BILLING_OS_USERNAME=${OS_USERNAME}
BILLING_OS_PASSWORD=${OS_PASSWORD}
BILLING_OS_PROJECT_NAME=${OS_PROJECT_NAME}
BILLING_VERIFY_SSL=false
BILLING_BILLING_TZ=Asia/Kolkata
EOF
chmod 600 .env
echo ".env written (password hidden)"
echo
echo "=== 2. Docker build ==="
docker build -q -t connectvm-billing-api . 2>&1 | tail -2
echo
echo "=== 3. (Re)start container ==="
docker rm -f billing_api 2>/dev/null || true
docker run -d --name billing_api --restart unless-stopped \
--network host --env-file .env connectvm-billing-api
sleep 8
docker ps --format '{{.Names}}\t{{.Status}}' | grep billing_api
echo
echo "=== 4. Smoke tests ==="
echo "--- /health ---"
curl -s http://127.0.0.1:8080/health
echo
echo "--- /api/v1/billing/summary (first 25 lines) ---"
curl -s http://127.0.0.1:8080/api/v1/billing/summary | python3 -m json.tool | head -25
echo
echo "--- /api/v1/billing/tenants/admin ---"
curl -s http://127.0.0.1:8080/api/v1/billing/tenants/admin | python3 -m json.tool | head -40