Files
mcp-outline-postgresql/start-tunnel.sh
Emanuel Almeida 5f49cb63e8 feat: v1.3.1 - Multi-transport + Production deployment
- Add HTTP transport (StreamableHTTPServerTransport)
- Add shared server module (src/server/)
- Configure production for hub.descomplicar.pt
- Add SSH tunnel script (start-tunnel.sh)
- Fix connection leak in pg-client.ts
- Fix atomicity bug in comments deletion
- Update docs with test plan for 164 tools

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:06:30 +00:00

65 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Túnel SSH para MCP Outline PostgreSQL (hub.descomplicar.pt)
# Cria túnel para o PostgreSQL do Outline no EasyPanel
#
# Uso: ./start-tunnel.sh [start|stop|status]
TUNNEL_PORT=5433
REMOTE_HOST="root@178.63.18.51"
CONTAINER_IP="172.18.0.46"
CONTAINER_PORT=5432
start_tunnel() {
# Verificar se já está activo
if lsof -i :$TUNNEL_PORT >/dev/null 2>&1; then
echo "Túnel já activo na porta $TUNNEL_PORT"
return 0
fi
# Criar túnel em background
ssh -f -N -L $TUNNEL_PORT:$CONTAINER_IP:$CONTAINER_PORT $REMOTE_HOST
if [ $? -eq 0 ]; then
echo "Túnel criado: localhost:$TUNNEL_PORT -> Outline PostgreSQL"
echo "DATABASE_URL=postgres://postgres:***@localhost:$TUNNEL_PORT/descomplicar"
else
echo "Erro ao criar túnel"
return 1
fi
}
stop_tunnel() {
PID=$(lsof -t -i:$TUNNEL_PORT 2>/dev/null)
if [ -n "$PID" ]; then
kill $PID
echo "Túnel terminado (PID: $PID)"
else
echo "Nenhum túnel activo na porta $TUNNEL_PORT"
fi
}
status_tunnel() {
if lsof -i :$TUNNEL_PORT >/dev/null 2>&1; then
echo "Túnel ACTIVO na porta $TUNNEL_PORT"
lsof -i :$TUNNEL_PORT | grep ssh
else
echo "Túnel INACTIVO"
fi
}
case "${1:-start}" in
start)
start_tunnel
;;
stop)
stop_tunnel
;;
status)
status_tunnel
;;
*)
echo "Uso: $0 [start|stop|status]"
exit 1
;;
esac