diff --git a/config/z-ecosystem.production.env.example b/config/z-ecosystem.production.env.example new file mode 100644 index 0000000..f743b52 --- /dev/null +++ b/config/z-ecosystem.production.env.example @@ -0,0 +1,25 @@ +# Z Ecosystem production — copy to config/z-ecosystem.production.env +# Gitea binds :3000 on dev-bis-ali; Z API uses :3100 + +VITE_ECOSYSTEM=z +Z_SUPPORTED_CHAINS_CONFIG=config/z-supported-chains.v1.json +Z_ECOSYSTEM_PUBLIC_URL=https://zblockchainsystem.com +VITE_Z_ECOSYSTEM_URL=https://zblockchainsystem.com + +CHAIN_900002_RPC_URL=https://rpc.zblockchainsystem.com +VITE_RPC_URL_900002=https://rpc.zblockchainsystem.com +VITE_Z_CHAIN_EXPLORER_URL=https://explorer.zblockchainsystem.com +VITE_ENABLE_Z_WALLET=true + +Z_TOKEN_AGGREGATION_PORT=3100 +PORT=3100 +TOKEN_AGGREGATION_URL=http://127.0.0.1:3100 +SETTLEMENT_MIDDLEWARE_URL=http://127.0.0.1:3011 +SETTLEMENT_URL=http://127.0.0.1:3011 +SETTLEMENT_MIDDLEWARE_CONFIG=config/settlement-middleware.production.v1.json + +# Z Bot — Azure OpenAI (optional) +AZURE_OPENAI_ENDPOINT= +AZURE_OPENAI_API_KEY= +AZURE_OPENAI_DEPLOYMENT=gpt-4o-mini +AZURE_OPENAI_API_VERSION=2024-02-15-preview diff --git a/deploy/nginx/z-ecosystem-domains.conf b/deploy/nginx/z-ecosystem-domains.conf index a3f26b5..a513877 100644 --- a/deploy/nginx/z-ecosystem-domains.conf +++ b/deploy/nginx/z-ecosystem-domains.conf @@ -7,7 +7,7 @@ upstream z_ecosystem_frontend { } upstream z_ecosystem_api { - server 127.0.0.1:3000; + server 127.0.0.1:3100; } upstream z_ecosystem_settlement { diff --git a/scripts/deployment/build-z-ecosystem-stack.sh b/scripts/deployment/build-z-ecosystem-stack.sh index 871b3c7..a4b9c44 100644 --- a/scripts/deployment/build-z-ecosystem-stack.sh +++ b/scripts/deployment/build-z-ecosystem-stack.sh @@ -6,6 +6,7 @@ REPO_DIR="${Z_ECOSYSTEM_ROOT:-$HOME/smom-dbis-138}" LOG_DIR="${Z_ECOSYSTEM_LOG_DIR:-$HOME/z-ecosystem/logs}" ENV_FILE="${Z_ECOSYSTEM_ENV:-$REPO_DIR/config/z-ecosystem.local.env}" FRONTEND_PORT="${Z_ECOSYSTEM_FRONTEND_PORT:-3002}" +API_PORT="${Z_TOKEN_AGGREGATION_PORT:-${PORT:-3000}}" log() { echo "[$(date -Iseconds)] $*"; } @@ -69,7 +70,8 @@ start_svc() { SETTLEMENT_MIDDLEWARE_CONFIG="$SETTLEMENT_MIDDLEWARE_CONFIG" \ OMNL_SUPPORTED_CHAINS_CONFIG="$OMNL_SUPPORTED_CHAINS_CONFIG" \ Z_SUPPORTED_CHAINS_CONFIG="$OMNL_SUPPORTED_CHAINS_CONFIG" \ - TOKEN_AGGREGATION_URL="${TOKEN_AGGREGATION_URL:-http://127.0.0.1:3000}" \ + PORT="$port" \ + TOKEN_AGGREGATION_URL="${TOKEN_AGGREGATION_URL:-http://127.0.0.1:$port}" \ CHAIN_900002_RPC_URL="$CHAIN_900002_RPC_URL" \ AZURE_OPENAI_ENDPOINT="${AZURE_OPENAI_ENDPOINT:-}" \ AZURE_OPENAI_API_KEY="${AZURE_OPENAI_API_KEY:-}" \ @@ -79,7 +81,7 @@ start_svc() { echo $! >"$LOG_DIR/$name.pid" } -start_svc token-aggregation services/token-aggregation 3000 "npm run start" +start_svc token-aggregation services/token-aggregation "$API_PORT" "npm run start" sleep 2 start_svc settlement-middleware services/settlement-middleware 3011 "npm run start" sleep 2 @@ -93,7 +95,7 @@ echo $! >"$LOG_DIR/frontend.pid" sleep 5 log "Z health checks..." -curl -sf "http://127.0.0.1:3000/api/v1/z-bot/health" | head -c 200 || true +curl -sf "http://127.0.0.1:$API_PORT/api/v1/z-bot/health" | head -c 200 || true echo curl -sf "http://127.0.0.1:3011/api/v1/settlement/health" | head -c 200 || true echo diff --git a/scripts/deployment/deploy-z-ecosystem-production.sh b/scripts/deployment/deploy-z-ecosystem-production.sh index 6b2af14..3e49dbc 100644 --- a/scripts/deployment/deploy-z-ecosystem-production.sh +++ b/scripts/deployment/deploy-z-ecosystem-production.sh @@ -3,7 +3,7 @@ set -euo pipefail ROOT="$(cd "$(dirname "$0")/../.." && pwd)" -ENV_FILE="${Z_ECOSYSTEM_ENV:-$ROOT/config/z-ecosystem.local.env}" +ENV_FILE="${Z_ECOSYSTEM_ENV:-$ROOT/config/z-ecosystem.production.env}" PROD_CFG="$ROOT/config/z-chain-production.v1.json" DOMAIN_CFG="$ROOT/config/z-ecosystem-production-domains.v1.json" @@ -64,7 +64,7 @@ if [[ "${Z_ECOSYSTEM_PUSH_PCT:-0}" == "1" ]]; then fi log "Done. Verify:" -log " curl -sf http://127.0.0.1:3000/api/v1/z-bot/health" +log " curl -sf http://127.0.0.1:\${Z_TOKEN_AGGREGATION_PORT:-3100}/api/v1/z-bot/health" log " curl -sf http://127.0.0.1:3011/api/v1/settlement/health" log " curl -sI https://zblockchainsystem.com/z" log " bash scripts/deployment/print-z-dns-records.sh"