diff --git a/docker-compose.yml b/docker-compose.yml index 95caa04..6d735c3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,9 +16,13 @@ services: - LOG_LEVEL=INFO volumes: - ./backend/src:/app/src + - ./backend/scripts:/app/scripts - /etc/localtime:/etc/localtime:ro networks: - shared_network + depends_on: + oracle18c: + condition: service_healthy restart: unless-stopped frontend: @@ -47,7 +51,7 @@ services: environment: - ORACLE_PASSWORD=local123 - ORACLE_CHARACTERSET=AL32UTF8 - - APP_USER=locasl123 + - APP_USER=local123 - APP_USER_PASSWORD=local123 - TZ=America/Sao_Paulo ports: @@ -69,4 +73,4 @@ networks: volumes: oracle_data: - driver: local \ No newline at end of file + driver: local diff --git a/start-ngrok.sh b/start-ngrok.sh index 116de2e..e9ea830 100755 --- a/start-ngrok.sh +++ b/start-ngrok.sh @@ -1,20 +1,27 @@ #!/bin/bash -echo "=== Ranking CAPES - Iniciando sistema ===" +echo "=== Ranking CAPES - Iniciando com ngrok ===" +cd /home/fred/projetos/ranking + +echo "[1/5] Parando containers antigos..." +docker compose down 2>/dev/null + +echo "[2/5] Limpando portas ocupadas..." +sudo fuser -k 8000/tcp 2>/dev/null +sudo fuser -k 5173/tcp 2>/dev/null + +echo "[3/5] Matando ngrok antigo..." pkill -f "ngrok http 5173" 2>/dev/null +echo "[4/5] Criando rede e subindo containers..." docker network create shared_network 2>/dev/null - -echo "[1/3] Liberando portas ocupadas..." -sudo lsof -i :8000 -t 2>/dev/null | xargs -r sudo kill -9 -sudo lsof -i :5173 -t 2>/dev/null | xargs -r sudo kill -9 - -echo "[2/3] Subindo containers Docker..." -cd /home/fred/projetos/ranking docker compose up -d backend frontend +echo "Aguardando backend subir (e Oracle ficar healthy)..." +sleep 10 +docker compose up -d backend frontend >/dev/null -sleep 3 +sleep 2 if ! docker ps | grep -q ranking_backend; then echo "ERRO: Backend não subiu!" @@ -26,7 +33,10 @@ if ! docker ps | grep -q ranking_frontend; then exit 1 fi -echo "[3/3] Iniciando ngrok..." +echo "[4b/5] Rodando bootstrap (ranking + componente B) dentro do backend..." +docker exec ranking_backend bash -lc "ORACLE_LOCAL_DSN=oracle18c:1521/XEPDB1 /app/scripts/bootstrap_ranking.sh" + +echo "[5/5] Iniciando ngrok..." ngrok http 5173 --log=stdout > /tmp/ngrok-ranking.log 2>&1 & sleep 4