fix: health check route via /api/health to match Traefik PathPrefix rule
/health is routed to frontend nginx by Traefik (no /api prefix). Add /api/health alias so Traefik routes the check to the backend. Update workflow healthcheck step to call /api/health.
This commit is contained in:
parent
cf5603243c
commit
d3e4438a4f
2 changed files with 3 additions and 2 deletions
|
|
@ -169,8 +169,8 @@ jobs:
|
||||||
|
|
||||||
- name: Backend /api/health
|
- name: Backend /api/health
|
||||||
run: |
|
run: |
|
||||||
R=$(curl -s --max-time 15 --resolve "${{ vars.DOMAIN }}:443:${{ vars.SSH_HOST }}" "https://${{ vars.DOMAIN }}/health")
|
R=$(curl -s --max-time 15 --resolve "${{ vars.DOMAIN }}:443:${{ vars.SSH_HOST }}" "https://${{ vars.DOMAIN }}/api/health")
|
||||||
S=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 --resolve "${{ vars.DOMAIN }}:443:${{ vars.SSH_HOST }}" "https://${{ vars.DOMAIN }}/health")
|
S=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 --resolve "${{ vars.DOMAIN }}:443:${{ vars.SSH_HOST }}" "https://${{ vars.DOMAIN }}/api/health")
|
||||||
echo "Health: $S → $R"
|
echo "Health: $S → $R"
|
||||||
[ "$S" = "200" ] || (echo "❌ Health falhou ($S)" && exit 1)
|
[ "$S" = "200" ] || (echo "❌ Health falhou ($S)" && exit 1)
|
||||||
echo "$R" | grep -q '"db": "ok"' || (echo "❌ DB não conectado" && exit 1)
|
echo "$R" | grep -q '"db": "ok"' || (echo "❌ DB não conectado" && exit 1)
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ def create_app(config_name: str | None = None) -> Flask:
|
||||||
app.register_blueprint(jobs_admin_bp)
|
app.register_blueprint(jobs_admin_bp)
|
||||||
|
|
||||||
@app.route("/health")
|
@app.route("/health")
|
||||||
|
@app.route("/api/health")
|
||||||
def health():
|
def health():
|
||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue