From a6d0f9ca9581b13aa8b4a84711696b6a3f5cb530 Mon Sep 17 00:00:00 2001 From: Rafael Lopes Date: Fri, 24 Apr 2026 14:55:37 -0300 Subject: [PATCH] =?UTF-8?q?FIX:=20Ajuste=20de=20configura=C3=A7=C3=A3o=20e?= =?UTF-8?q?=20cron=20para=20ambiente=20de=20produ=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- infra/crontab | 3 ++- infra/entrypoint.sh | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/infra/crontab b/infra/crontab index 8a0490a..5925f7d 100644 --- a/infra/crontab +++ b/infra/crontab @@ -3,4 +3,5 @@ # Fuso horário: UTC (ajustar se necessário) # A cada 5 minutos: executa o ETL -*/5 * * * * PYTHONPATH=/app /usr/local/bin/python -m app.main >> /var/log/wifi-etl.log 2>&1 +# WiFi ETL Pipeline — Cron Jobs +*/5 * * * * cd /app && /usr/local/bin/python -m app.main >> /var/log/wifi-etl.log 2>&1 \ No newline at end of file diff --git a/infra/entrypoint.sh b/infra/entrypoint.sh index b62a39d..37ed3cc 100644 --- a/infra/entrypoint.sh +++ b/infra/entrypoint.sh @@ -1,7 +1,17 @@ -#!/bin/sh - +#!/bin/bash echo "=== WiFi ETL Container Starting ===" + +# Exporta variáveis do .env para o ambiente do cron +if [ -f /app/.env ]; then + set -a + source /app/.env + set +a + # Persiste no ambiente do cron + printenv | grep -v "^_=" >> /etc/environment +fi + echo "Executando primeira corrida ETL..." -python -m app.main || echo "ETL inicial falhou (ver logs). O cron continuará rodando." +cd /app && python -m app.main || echo "ETL inicial falhou (ver logs). O cron continuará rodando." + echo "Iniciando cron..." -exec cron -f +exec "$@" \ No newline at end of file